Package com.google.cloud.orgpolicy.v2


@Generated("by gapic-generator-java") package com.google.cloud.orgpolicy.v2
A client to Organization Policy API

The interfaces provided are listed below, along with usage samples.

======================= OrgPolicyClient =======================

Service Description: An interface for managing organization policies.

The Organization Policy Service provides a simple mechanism for organizations to restrict the allowed configurations across their entire resource hierarchy.

You can use a policy to configure restrictions on resources. For example, you can enforce a policy that restricts which Google Cloud APIs can be activated in a certain part of your resource hierarchy, or prevents serial port access to VM instances in a particular folder.

Policies are inherited down through the resource hierarchy. A policy applied to a parent resource automatically applies to all its child resources unless overridden with a policy lower in the hierarchy.

A constraint defines an aspect of a resource's configuration that can be controlled by an organization's policy administrator. Policies are a collection of constraints that defines their allowable configuration on a particular resource and its child resources.

Sample for OrgPolicyClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (OrgPolicyClient orgPolicyClient = OrgPolicyClient.create()) {
   PolicyName name = PolicyName.ofProjectPolicyName("[PROJECT]", "[POLICY]");
   Policy response = orgPolicyClient.getPolicy(name);
 }