Organization Policy v2 API - Class OrgPolicyClientImpl (2.7.0)

public sealed class OrgPolicyClientImpl : OrgPolicyClient

Reference documentation and code samples for the Organization Policy v2 API class OrgPolicyClientImpl.

OrgPolicy client wrapper implementation, for convenient use.

Inheritance

object > OrgPolicyClient > OrgPolicyClientImpl

Namespace

Google.Cloud.OrgPolicy.V2

Assembly

Google.Cloud.OrgPolicy.V2.dll

Remarks

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.

Constructors

OrgPolicyClientImpl(OrgPolicyClient, OrgPolicySettings, ILogger)

public OrgPolicyClientImpl(OrgPolicy.OrgPolicyClient grpcClient, OrgPolicySettings settings, ILogger logger)

Constructs a client wrapper for the OrgPolicy service, with the specified gRPC client and settings.

Parameters
Name Description
grpcClient OrgPolicyOrgPolicyClient

The underlying gRPC client.

settings OrgPolicySettings

The base OrgPolicySettings used within this client.

logger ILogger

Optional ILogger to use within this client.

Properties

GrpcClient

public override OrgPolicy.OrgPolicyClient GrpcClient { get; }

The underlying gRPC OrgPolicy client

Property Value
Type Description
OrgPolicyOrgPolicyClient
Overrides

Methods

CreateCustomConstraint(CreateCustomConstraintRequest, CallSettings)

public override CustomConstraint CreateCustomConstraint(CreateCustomConstraintRequest request, CallSettings callSettings = null)

Creates a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the organization does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the constraint already exists on the given organization.

Parameters
Name Description
request CreateCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CustomConstraint

The RPC response.

Overrides

CreateCustomConstraintAsync(CreateCustomConstraintRequest, CallSettings)

public override Task<CustomConstraint> CreateCustomConstraintAsync(CreateCustomConstraintRequest request, CallSettings callSettings = null)

Creates a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the organization does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the constraint already exists on the given organization.

Parameters
Name Description
request CreateCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCustomConstraint

A Task containing the RPC response.

Overrides

CreatePolicy(CreatePolicyRequest, CallSettings)

public override Policy CreatePolicy(CreatePolicyRequest request, CallSettings callSettings = null)

Creates a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the policy already exists on the given Google Cloud resource.

Parameters
Name Description
request CreatePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

CreatePolicyAsync(CreatePolicyRequest, CallSettings)

public override Task<Policy> CreatePolicyAsync(CreatePolicyRequest request, CallSettings callSettings = null)

Creates a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the policy already exists on the given Google Cloud resource.

Parameters
Name Description
request CreatePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides

DeleteCustomConstraint(DeleteCustomConstraintRequest, CallSettings)

public override void DeleteCustomConstraint(DeleteCustomConstraintRequest request, CallSettings callSettings = null)

Deletes a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist.

Parameters
Name Description
request DeleteCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DeleteCustomConstraintAsync(DeleteCustomConstraintRequest, CallSettings)

public override Task DeleteCustomConstraintAsync(DeleteCustomConstraintRequest request, CallSettings callSettings = null)

Deletes a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist.

Parameters
Name Description
request DeleteCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

DeletePolicy(DeletePolicyRequest, CallSettings)

public override void DeletePolicy(DeletePolicyRequest request, CallSettings callSettings = null)

Deletes a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint or organization policy does not exist.

Parameters
Name Description
request DeletePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DeletePolicyAsync(DeletePolicyRequest, CallSettings)

public override Task DeletePolicyAsync(DeletePolicyRequest request, CallSettings callSettings = null)

Deletes a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint or organization policy does not exist.

Parameters
Name Description
request DeletePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

GetCustomConstraint(GetCustomConstraintRequest, CallSettings)

public override CustomConstraint GetCustomConstraint(GetCustomConstraintRequest request, CallSettings callSettings = null)

Gets a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the custom constraint does not exist.

Parameters
Name Description
request GetCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CustomConstraint

The RPC response.

Overrides

GetCustomConstraintAsync(GetCustomConstraintRequest, CallSettings)

public override Task<CustomConstraint> GetCustomConstraintAsync(GetCustomConstraintRequest request, CallSettings callSettings = null)

Gets a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the custom constraint does not exist.

Parameters
Name Description
request GetCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCustomConstraint

A Task containing the RPC response.

Overrides

GetEffectivePolicy(GetEffectivePolicyRequest, CallSettings)

public override Policy GetEffectivePolicy(GetEffectivePolicyRequest request, CallSettings callSettings = null)

Gets the effective policy on a resource. This is the result of merging policies in the resource hierarchy and evaluating conditions. The returned policy will not have an etag or condition set because it is an evaluated policy across multiple resources. Subtrees of Resource Manager resource hierarchy with 'under:' prefix will not be expanded.

Parameters
Name Description
request GetEffectivePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

GetEffectivePolicyAsync(GetEffectivePolicyRequest, CallSettings)

public override Task<Policy> GetEffectivePolicyAsync(GetEffectivePolicyRequest request, CallSettings callSettings = null)

Gets the effective policy on a resource. This is the result of merging policies in the resource hierarchy and evaluating conditions. The returned policy will not have an etag or condition set because it is an evaluated policy across multiple resources. Subtrees of Resource Manager resource hierarchy with 'under:' prefix will not be expanded.

Parameters
Name Description
request GetEffectivePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides

GetPolicy(GetPolicyRequest, CallSettings)

public override Policy GetPolicy(GetPolicyRequest request, CallSettings callSettings = null)

Gets a policy on a resource.

If no policy is set on the resource, NOT_FOUND is returned. The etag value can be used with UpdatePolicy() to update a policy during read-modify-write.

Parameters
Name Description
request GetPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

GetPolicyAsync(GetPolicyRequest, CallSettings)

public override Task<Policy> GetPolicyAsync(GetPolicyRequest request, CallSettings callSettings = null)

Gets a policy on a resource.

If no policy is set on the resource, NOT_FOUND is returned. The etag value can be used with UpdatePolicy() to update a policy during read-modify-write.

Parameters
Name Description
request GetPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides

ListConstraints(ListConstraintsRequest, CallSettings)

public override PagedEnumerable<ListConstraintsResponse, Constraint> ListConstraints(ListConstraintsRequest request, CallSettings callSettings = null)

Lists constraints that could be applied on the specified resource.

Parameters
Name Description
request ListConstraintsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListConstraintsResponseConstraint

A pageable sequence of Constraint resources.

Overrides

ListConstraintsAsync(ListConstraintsRequest, CallSettings)

public override PagedAsyncEnumerable<ListConstraintsResponse, Constraint> ListConstraintsAsync(ListConstraintsRequest request, CallSettings callSettings = null)

Lists constraints that could be applied on the specified resource.

Parameters
Name Description
request ListConstraintsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListConstraintsResponseConstraint

A pageable asynchronous sequence of Constraint resources.

Overrides

ListCustomConstraints(ListCustomConstraintsRequest, CallSettings)

public override PagedEnumerable<ListCustomConstraintsResponse, CustomConstraint> ListCustomConstraints(ListCustomConstraintsRequest request, CallSettings callSettings = null)

Retrieves all of the custom constraints that exist on a particular organization resource.

Parameters
Name Description
request ListCustomConstraintsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCustomConstraintsResponseCustomConstraint

A pageable sequence of CustomConstraint resources.

Overrides

ListCustomConstraintsAsync(ListCustomConstraintsRequest, CallSettings)

public override PagedAsyncEnumerable<ListCustomConstraintsResponse, CustomConstraint> ListCustomConstraintsAsync(ListCustomConstraintsRequest request, CallSettings callSettings = null)

Retrieves all of the custom constraints that exist on a particular organization resource.

Parameters
Name Description
request ListCustomConstraintsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCustomConstraintsResponseCustomConstraint

A pageable asynchronous sequence of CustomConstraint resources.

Overrides

ListPolicies(ListPoliciesRequest, CallSettings)

public override PagedEnumerable<ListPoliciesResponse, Policy> ListPolicies(ListPoliciesRequest request, CallSettings callSettings = null)

Retrieves all of the policies that exist on a particular resource.

Parameters
Name Description
request ListPoliciesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListPoliciesResponsePolicy

A pageable sequence of Policy resources.

Overrides

ListPoliciesAsync(ListPoliciesRequest, CallSettings)

public override PagedAsyncEnumerable<ListPoliciesResponse, Policy> ListPoliciesAsync(ListPoliciesRequest request, CallSettings callSettings = null)

Retrieves all of the policies that exist on a particular resource.

Parameters
Name Description
request ListPoliciesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListPoliciesResponsePolicy

A pageable asynchronous sequence of Policy resources.

Overrides

UpdateCustomConstraint(UpdateCustomConstraintRequest, CallSettings)

public override CustomConstraint UpdateCustomConstraint(UpdateCustomConstraintRequest request, CallSettings callSettings = null)

Updates a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist.

Note: the supplied policy will perform a full overwrite of all fields.

Parameters
Name Description
request UpdateCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CustomConstraint

The RPC response.

Overrides

UpdateCustomConstraintAsync(UpdateCustomConstraintRequest, CallSettings)

public override Task<CustomConstraint> UpdateCustomConstraintAsync(UpdateCustomConstraintRequest request, CallSettings callSettings = null)

Updates a custom constraint.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint does not exist.

Note: the supplied policy will perform a full overwrite of all fields.

Parameters
Name Description
request UpdateCustomConstraintRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCustomConstraint

A Task containing the RPC response.

Overrides

UpdatePolicy(UpdatePolicyRequest, CallSettings)

public override Policy UpdatePolicy(UpdatePolicyRequest request, CallSettings callSettings = null)

Updates a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint or the policy do not exist. Returns a google.rpc.Status with google.rpc.Code.ABORTED if the etag supplied in the request does not match the persisted etag of the policy

Note: the supplied policy will perform a full overwrite of all fields.

Parameters
Name Description
request UpdatePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

UpdatePolicyAsync(UpdatePolicyRequest, CallSettings)

public override Task<Policy> UpdatePolicyAsync(UpdatePolicyRequest request, CallSettings callSettings = null)

Updates a policy.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the constraint or the policy do not exist. Returns a google.rpc.Status with google.rpc.Code.ABORTED if the etag supplied in the request does not match the persisted etag of the policy

Note: the supplied policy will perform a full overwrite of all fields.

Parameters
Name Description
request UpdatePolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides