public abstract class OrgPolicyClient
Reference documentation and code samples for the Organization Policy v2 API class OrgPolicyClient.
OrgPolicy client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.OrgPolicy.V2Assembly
Google.Cloud.OrgPolicy.V2.dll
Remarks
An interface for managing organization policies.
The Cloud Org Policy service provides a simple mechanism for organizations to restrict the allowed configurations across their entire Cloud Resource hierarchy.
You can use a policy
to configure restrictions in Cloud resources. For
example, you can enforce a policy
that restricts which Google
Cloud Platform 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.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the OrgPolicy service, which is a host of "orgpolicy.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default OrgPolicy scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default OrgPolicy scopes are:
GrpcClient
public virtual OrgPolicy.OrgPolicyClient GrpcClient { get; }
The underlying gRPC OrgPolicy client
Property Value | |
---|---|
Type | Description |
OrgPolicy.OrgPolicyClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static OrgPolicyClient Create()
Synchronously creates a OrgPolicyClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OrgPolicyClientBuilder.
Returns | |
---|---|
Type | Description |
OrgPolicyClient | The created OrgPolicyClient. |
CreateAsync(CancellationToken)
public static Task<OrgPolicyClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a OrgPolicyClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OrgPolicyClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<OrgPolicyClient> | The task representing the created OrgPolicyClient. |
CreatePolicy(FolderName, Policy, CallSettings)
public virtual Policy CreatePolicy(FolderName parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
Policy policy = new Policy();
// Make the request
Policy response = orgPolicyClient.CreatePolicy(parent, policy);
CreatePolicy(OrganizationName, Policy, CallSettings)
public virtual Policy CreatePolicy(OrganizationName parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
Policy policy = new Policy();
// Make the request
Policy response = orgPolicyClient.CreatePolicy(parent, policy);
CreatePolicy(ProjectName, Policy, CallSettings)
public virtual Policy CreatePolicy(ProjectName parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Policy policy = new Policy();
// Make the request
Policy response = orgPolicyClient.CreatePolicy(parent, policy);
CreatePolicy(CreatePolicyRequest, CallSettings)
public virtual 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 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. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
CreatePolicyRequest request = new CreatePolicyRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
Policy = new Policy(),
};
// Make the request
Policy response = orgPolicyClient.CreatePolicy(request);
CreatePolicy(String, Policy, CallSettings)
public virtual Policy CreatePolicy(string parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | String Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Policy policy = new Policy();
// Make the request
Policy response = orgPolicyClient.CreatePolicy(parent, policy);
CreatePolicyAsync(FolderName, Policy, CallSettings)
public virtual Task<Policy> CreatePolicyAsync(FolderName parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
CreatePolicyAsync(FolderName, Policy, CancellationToken)
public virtual Task<Policy> CreatePolicyAsync(FolderName parent, Policy policy, CancellationToken cancellationToken)
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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
CreatePolicyAsync(OrganizationName, Policy, CallSettings)
public virtual Task<Policy> CreatePolicyAsync(OrganizationName parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
CreatePolicyAsync(OrganizationName, Policy, CancellationToken)
public virtual Task<Policy> CreatePolicyAsync(OrganizationName parent, Policy policy, CancellationToken cancellationToken)
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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
CreatePolicyAsync(ProjectName, Policy, CallSettings)
public virtual Task<Policy> CreatePolicyAsync(ProjectName parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
CreatePolicyAsync(ProjectName, Policy, CancellationToken)
public virtual Task<Policy> CreatePolicyAsync(ProjectName parent, Policy policy, CancellationToken cancellationToken)
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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
CreatePolicyAsync(CreatePolicyRequest, CallSettings)
public virtual 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 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 |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
CreatePolicyRequest request = new CreatePolicyRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
Policy = new Policy(),
};
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(request);
CreatePolicyAsync(CreatePolicyRequest, CancellationToken)
public virtual Task<Policy> CreatePolicyAsync(CreatePolicyRequest request, CancellationToken cancellationToken)
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 Cloud resource.
Parameters | |
---|---|
Name | Description |
request | CreatePolicyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
CreatePolicyRequest request = new CreatePolicyRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
Policy = new Policy(),
};
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(request);
CreatePolicyAsync(String, Policy, CallSettings)
public virtual Task<Policy> CreatePolicyAsync(string parent, Policy policy, 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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | String Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
CreatePolicyAsync(String, Policy, CancellationToken)
public virtual Task<Policy> CreatePolicyAsync(string parent, Policy policy, CancellationToken cancellationToken)
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 Cloud resource.
Parameters | |
---|---|
Name | Description |
parent | String Required. The Cloud resource that will parent the new Policy. Must be in one of the following forms:
|
policy | Policy Required. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.CreatePolicyAsync(parent, policy);
DeletePolicy(DeletePolicyRequest, CallSettings)
public virtual 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 Org 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. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
DeletePolicyRequest request = new DeletePolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
orgPolicyClient.DeletePolicy(request);
DeletePolicy(PolicyName, CallSettings)
public virtual void DeletePolicy(PolicyName name, CallSettings callSettings = null)
Deletes a Policy.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the
constraint or Org Policy does not exist.
Parameters | |
---|---|
Name | Description |
name | PolicyName Required. Name of the policy to delete.
See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
orgPolicyClient.DeletePolicy(name);
DeletePolicy(String, CallSettings)
public virtual void DeletePolicy(string name, CallSettings callSettings = null)
Deletes a Policy.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the
constraint or Org Policy does not exist.
Parameters | |
---|---|
Name | Description |
name | String Required. Name of the policy to delete.
See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
orgPolicyClient.DeletePolicy(name);
DeletePolicyAsync(DeletePolicyRequest, CallSettings)
public virtual 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 Org 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. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
DeletePolicyRequest request = new DeletePolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
await orgPolicyClient.DeletePolicyAsync(request);
DeletePolicyAsync(DeletePolicyRequest, CancellationToken)
public virtual Task DeletePolicyAsync(DeletePolicyRequest request, CancellationToken cancellationToken)
Deletes a Policy.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the
constraint or Org Policy does not exist.
Parameters | |
---|---|
Name | Description |
request | DeletePolicyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
DeletePolicyRequest request = new DeletePolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
await orgPolicyClient.DeletePolicyAsync(request);
DeletePolicyAsync(PolicyName, CallSettings)
public virtual Task DeletePolicyAsync(PolicyName name, CallSettings callSettings = null)
Deletes a Policy.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the
constraint or Org Policy does not exist.
Parameters | |
---|---|
Name | Description |
name | PolicyName Required. Name of the policy to delete.
See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
await orgPolicyClient.DeletePolicyAsync(name);
DeletePolicyAsync(PolicyName, CancellationToken)
public virtual Task DeletePolicyAsync(PolicyName name, CancellationToken cancellationToken)
Deletes a Policy.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the
constraint or Org Policy does not exist.
Parameters | |
---|---|
Name | Description |
name | PolicyName Required. Name of the policy to delete.
See |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
await orgPolicyClient.DeletePolicyAsync(name);
DeletePolicyAsync(String, CallSettings)
public virtual Task DeletePolicyAsync(string name, CallSettings callSettings = null)
Deletes a Policy.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the
constraint or Org Policy does not exist.
Parameters | |
---|---|
Name | Description |
name | String Required. Name of the policy to delete.
See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
await orgPolicyClient.DeletePolicyAsync(name);
DeletePolicyAsync(String, CancellationToken)
public virtual Task DeletePolicyAsync(string name, CancellationToken cancellationToken)
Deletes a Policy.
Returns a google.rpc.Status
with google.rpc.Code.NOT_FOUND
if the
constraint or Org Policy does not exist.
Parameters | |
---|---|
Name | Description |
name | String Required. Name of the policy to delete.
See |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
await orgPolicyClient.DeletePolicyAsync(name);
GetEffectivePolicy(GetEffectivePolicyRequest, CallSettings)
public virtual 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
a computed 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. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
GetEffectivePolicyRequest request = new GetEffectivePolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
Policy response = orgPolicyClient.GetEffectivePolicy(request);
GetEffectivePolicy(PolicyName, CallSettings)
public virtual Policy GetEffectivePolicy(PolicyName name, 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
a computed Policy
across multiple resources.
Subtrees of Resource Manager resource hierarchy with 'under:' prefix will
not be expanded.
Parameters | |
---|---|
Name | Description |
name | PolicyName Required. The effective policy to compute. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
Policy response = orgPolicyClient.GetEffectivePolicy(name);
GetEffectivePolicy(String, CallSettings)
public virtual Policy GetEffectivePolicy(string name, 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
a computed Policy
across multiple resources.
Subtrees of Resource Manager resource hierarchy with 'under:' prefix will
not be expanded.
Parameters | |
---|---|
Name | Description |
name | String Required. The effective policy to compute. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
Policy response = orgPolicyClient.GetEffectivePolicy(name);
GetEffectivePolicyAsync(GetEffectivePolicyRequest, CallSettings)
public virtual 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
a computed 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 |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
GetEffectivePolicyRequest request = new GetEffectivePolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
Policy response = await orgPolicyClient.GetEffectivePolicyAsync(request);
GetEffectivePolicyAsync(GetEffectivePolicyRequest, CancellationToken)
public virtual Task<Policy> GetEffectivePolicyAsync(GetEffectivePolicyRequest request, CancellationToken cancellationToken)
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
a computed 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. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
GetEffectivePolicyRequest request = new GetEffectivePolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
Policy response = await orgPolicyClient.GetEffectivePolicyAsync(request);
GetEffectivePolicyAsync(PolicyName, CallSettings)
public virtual Task<Policy> GetEffectivePolicyAsync(PolicyName name, 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
a computed Policy
across multiple resources.
Subtrees of Resource Manager resource hierarchy with 'under:' prefix will
not be expanded.
Parameters | |
---|---|
Name | Description |
name | PolicyName Required. The effective policy to compute. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
Policy response = await orgPolicyClient.GetEffectivePolicyAsync(name);
GetEffectivePolicyAsync(PolicyName, CancellationToken)
public virtual Task<Policy> GetEffectivePolicyAsync(PolicyName name, CancellationToken cancellationToken)
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
a computed Policy
across multiple resources.
Subtrees of Resource Manager resource hierarchy with 'under:' prefix will
not be expanded.
Parameters | |
---|---|
Name | Description |
name | PolicyName Required. The effective policy to compute. See |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
Policy response = await orgPolicyClient.GetEffectivePolicyAsync(name);
GetEffectivePolicyAsync(String, CallSettings)
public virtual Task<Policy> GetEffectivePolicyAsync(string name, 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
a computed Policy
across multiple resources.
Subtrees of Resource Manager resource hierarchy with 'under:' prefix will
not be expanded.
Parameters | |
---|---|
Name | Description |
name | String Required. The effective policy to compute. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
Policy response = await orgPolicyClient.GetEffectivePolicyAsync(name);
GetEffectivePolicyAsync(String, CancellationToken)
public virtual Task<Policy> GetEffectivePolicyAsync(string name, CancellationToken cancellationToken)
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
a computed Policy
across multiple resources.
Subtrees of Resource Manager resource hierarchy with 'under:' prefix will
not be expanded.
Parameters | |
---|---|
Name | Description |
name | String Required. The effective policy to compute. See |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
Policy response = await orgPolicyClient.GetEffectivePolicyAsync(name);
GetPolicy(GetPolicyRequest, CallSettings)
public virtual 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. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
GetPolicyRequest request = new GetPolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
Policy response = orgPolicyClient.GetPolicy(request);
GetPolicy(PolicyName, CallSettings)
public virtual Policy GetPolicy(PolicyName name, 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 |
name | PolicyName Required. Resource name of the policy. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
Policy response = orgPolicyClient.GetPolicy(name);
GetPolicy(String, CallSettings)
public virtual Policy GetPolicy(string name, 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 |
name | String Required. Resource name of the policy. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
Policy response = orgPolicyClient.GetPolicy(name);
GetPolicyAsync(GetPolicyRequest, CallSettings)
public virtual 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 |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
GetPolicyRequest request = new GetPolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
Policy response = await orgPolicyClient.GetPolicyAsync(request);
GetPolicyAsync(GetPolicyRequest, CancellationToken)
public virtual Task<Policy> GetPolicyAsync(GetPolicyRequest request, CancellationToken cancellationToken)
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. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
GetPolicyRequest request = new GetPolicyRequest
{
PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"),
};
// Make the request
Policy response = await orgPolicyClient.GetPolicyAsync(request);
GetPolicyAsync(PolicyName, CallSettings)
public virtual Task<Policy> GetPolicyAsync(PolicyName name, 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 |
name | PolicyName Required. Resource name of the policy. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
Policy response = await orgPolicyClient.GetPolicyAsync(name);
GetPolicyAsync(PolicyName, CancellationToken)
public virtual Task<Policy> GetPolicyAsync(PolicyName name, CancellationToken cancellationToken)
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 |
name | PolicyName Required. Resource name of the policy. See |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
PolicyName name = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]");
// Make the request
Policy response = await orgPolicyClient.GetPolicyAsync(name);
GetPolicyAsync(String, CallSettings)
public virtual Task<Policy> GetPolicyAsync(string name, 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 |
name | String Required. Resource name of the policy. See |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
Policy response = await orgPolicyClient.GetPolicyAsync(name);
GetPolicyAsync(String, CancellationToken)
public virtual Task<Policy> GetPolicyAsync(string name, CancellationToken cancellationToken)
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 |
name | String Required. Resource name of the policy. See |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/policies/[POLICY]";
// Make the request
Policy response = await orgPolicyClient.GetPolicyAsync(name);
ListConstraints(FolderName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListConstraintsResponse, Constraint> ListConstraints(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListConstraintsResponse, Constraint> | A pageable sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraints(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Constraint item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConstraintsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraints(OrganizationName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListConstraintsResponse, Constraint> ListConstraints(OrganizationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListConstraintsResponse, Constraint> | A pageable sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraints(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Constraint item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConstraintsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraints(ProjectName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListConstraintsResponse, Constraint> ListConstraints(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListConstraintsResponse, Constraint> | A pageable sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraints(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Constraint item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConstraintsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraints(ListConstraintsRequest, CallSettings)
public virtual 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 |
PagedEnumerable<ListConstraintsResponse, Constraint> | A pageable sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
ListConstraintsRequest request = new ListConstraintsRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraints(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Constraint item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConstraintsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraints(String, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListConstraintsResponse, Constraint> ListConstraints(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | String Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListConstraintsResponse, Constraint> | A pageable sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraints(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Constraint item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConstraintsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraintsAsync(FolderName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListConstraintsResponse, Constraint> ListConstraintsAsync(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> | A pageable asynchronous sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraintsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Constraint item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConstraintsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraintsAsync(OrganizationName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListConstraintsResponse, Constraint> ListConstraintsAsync(OrganizationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> | A pageable asynchronous sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraintsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Constraint item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConstraintsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraintsAsync(ProjectName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListConstraintsResponse, Constraint> ListConstraintsAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> | A pageable asynchronous sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraintsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Constraint item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConstraintsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraintsAsync(ListConstraintsRequest, CallSettings)
public virtual 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 |
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> | A pageable asynchronous sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
ListConstraintsRequest request = new ListConstraintsRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraintsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Constraint item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConstraintsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConstraintsAsync(String, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListConstraintsResponse, Constraint> ListConstraintsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists Constraints
that could be applied on the specified resource.
Parameters | |
---|---|
Name | Description |
parent | String Required. The Cloud resource that parents the constraint. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> | A pageable asynchronous sequence of Constraint resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListConstraintsResponse, Constraint> response = orgPolicyClient.ListConstraintsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Constraint item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConstraintsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Constraint item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Constraint> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Constraint item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPolicies(FolderName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListPoliciesResponse, Policy> ListPolicies(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListPoliciesResponse, Policy> | A pageable sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPolicies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Policy item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPolicies(OrganizationName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListPoliciesResponse, Policy> ListPolicies(OrganizationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListPoliciesResponse, Policy> | A pageable sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPolicies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Policy item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPolicies(ProjectName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListPoliciesResponse, Policy> ListPolicies(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListPoliciesResponse, Policy> | A pageable sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPolicies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Policy item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPolicies(ListPoliciesRequest, CallSettings)
public virtual 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 |
PagedEnumerable<ListPoliciesResponse, Policy> | A pageable sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
ListPoliciesRequest request = new ListPoliciesRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPolicies(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Policy item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPolicies(String, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListPoliciesResponse, Policy> ListPolicies(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | String Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListPoliciesResponse, Policy> | A pageable sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPolicies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Policy item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPoliciesAsync(FolderName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListPoliciesResponse, Policy> ListPoliciesAsync(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListPoliciesResponse, Policy> | A pageable asynchronous sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedAsyncEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPoliciesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Policy item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPoliciesAsync(OrganizationName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListPoliciesResponse, Policy> ListPoliciesAsync(OrganizationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListPoliciesResponse, Policy> | A pageable asynchronous sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedAsyncEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPoliciesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Policy item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPoliciesAsync(ProjectName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListPoliciesResponse, Policy> ListPoliciesAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListPoliciesResponse, Policy> | A pageable asynchronous sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPoliciesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Policy item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPoliciesAsync(ListPoliciesRequest, CallSettings)
public virtual 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 |
PagedAsyncEnumerable<ListPoliciesResponse, Policy> | A pageable asynchronous sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
ListPoliciesRequest request = new ListPoliciesRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPoliciesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Policy item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListPoliciesAsync(String, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListPoliciesResponse, Policy> ListPoliciesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves all of the Policies
that exist on a particular resource.
Parameters | |
---|---|
Name | Description |
parent | String Required. The target Cloud resource that parents the set of constraints and policies that will be returned from this call. Must be in one of the following forms:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListPoliciesResponse, Policy> | A pageable asynchronous sequence of Policy resources. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListPoliciesResponse, Policy> response = orgPolicyClient.ListPoliciesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Policy item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Policy item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Policy> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Policy item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.
UpdatePolicy(Policy, CallSettings)
public virtual Policy UpdatePolicy(Policy policy, 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 |
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Policy | The RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
Policy policy = new Policy();
// Make the request
Policy response = orgPolicyClient.UpdatePolicy(policy);
UpdatePolicy(UpdatePolicyRequest, CallSettings)
public virtual 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. |
// Create client
OrgPolicyClient orgPolicyClient = OrgPolicyClient.Create();
// Initialize request argument(s)
UpdatePolicyRequest request = new UpdatePolicyRequest
{
Policy = new Policy(),
UpdateMask = new FieldMask(),
};
// Make the request
Policy response = orgPolicyClient.UpdatePolicy(request);
UpdatePolicyAsync(Policy, CallSettings)
public virtual Task<Policy> UpdatePolicyAsync(Policy policy, 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 |
policy | Policy Required. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.UpdatePolicyAsync(policy);
UpdatePolicyAsync(Policy, CancellationToken)
public virtual Task<Policy> UpdatePolicyAsync(Policy policy, CancellationToken cancellationToken)
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 |
policy | Policy Required. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
Policy policy = new Policy();
// Make the request
Policy response = await orgPolicyClient.UpdatePolicyAsync(policy);
UpdatePolicyAsync(UpdatePolicyRequest, CallSettings)
public virtual 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 |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
UpdatePolicyRequest request = new UpdatePolicyRequest
{
Policy = new Policy(),
UpdateMask = new FieldMask(),
};
// Make the request
Policy response = await orgPolicyClient.UpdatePolicyAsync(request);
UpdatePolicyAsync(UpdatePolicyRequest, CancellationToken)
public virtual Task<Policy> UpdatePolicyAsync(UpdatePolicyRequest request, CancellationToken cancellationToken)
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. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Policy> | A Task containing the RPC response. |
// Create client
OrgPolicyClient orgPolicyClient = await OrgPolicyClient.CreateAsync();
// Initialize request argument(s)
UpdatePolicyRequest request = new UpdatePolicyRequest
{
Policy = new Policy(),
UpdateMask = new FieldMask(),
};
// Make the request
Policy response = await orgPolicyClient.UpdatePolicyAsync(request);