public abstract class OrgPolicyViolationsPreviewServiceClientReference documentation and code samples for the Policy Simulator v1 API class OrgPolicyViolationsPreviewServiceClient.
OrgPolicyViolationsPreviewService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.PolicySimulator.V1Assembly
Google.Cloud.PolicySimulator.V1.dll
Remarks
Violations Preview API service for OrgPolicy.
An [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is a preview of the violations that will exist as soon as a proposed OrgPolicy change is submitted. To create an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview], the API user specifies the changes they wish to make and requests the generation of a preview via [GenerateViolationsPreview][]. the OrgPolicy Simulator service then scans the API user's currently existing resources to determine these resources violate the newly set OrgPolicy.
Properties
CreateOrgPolicyViolationsPreviewOperationsClient
public virtual OperationsClient CreateOrgPolicyViolationsPreviewOperationsClient { get; }The long-running operations client for CreateOrgPolicyViolationsPreview.
| Property Value | |
|---|---|
| Type | Description |
OperationsClient |
|
DefaultEndpoint
public static string DefaultEndpoint { get; }The default endpoint for the OrgPolicyViolationsPreviewService service, which is a host of "policysimulator.googleapis.com" and a port of 443.
| Property Value | |
|---|---|
| Type | Description |
string |
|
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }The default OrgPolicyViolationsPreviewService scopes.
| Property Value | |
|---|---|
| Type | Description |
IReadOnlyListstring |
|
The default OrgPolicyViolationsPreviewService scopes are:
GrpcClient
public virtual OrgPolicyViolationsPreviewService.OrgPolicyViolationsPreviewServiceClient GrpcClient { get; }The underlying gRPC OrgPolicyViolationsPreviewService client
| Property Value | |
|---|---|
| Type | Description |
OrgPolicyViolationsPreviewServiceOrgPolicyViolationsPreviewServiceClient |
|
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }The service metadata associated with this client type.
| Property Value | |
|---|---|
| Type | Description |
ServiceMetadata |
|
Methods
Create()
public static OrgPolicyViolationsPreviewServiceClient Create()Synchronously creates a OrgPolicyViolationsPreviewServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OrgPolicyViolationsPreviewServiceClientBuilder.
| Returns | |
|---|---|
| Type | Description |
OrgPolicyViolationsPreviewServiceClient |
The created OrgPolicyViolationsPreviewServiceClient. |
CreateAsync(CancellationToken)
public static Task<OrgPolicyViolationsPreviewServiceClient> CreateAsync(CancellationToken cancellationToken = default)Asynchronously creates a OrgPolicyViolationsPreviewServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OrgPolicyViolationsPreviewServiceClientBuilder.
| Parameter | |
|---|---|
| Name | Description |
cancellationToken |
CancellationTokenThe CancellationToken to use while creating the client. |
| Returns | |
|---|---|
| Type | Description |
TaskOrgPolicyViolationsPreviewServiceClient |
The task representing the created OrgPolicyViolationsPreviewServiceClient. |
CreateOrgPolicyViolationsPreview(CreateOrgPolicyViolationsPreviewRequest, CallSettings)
public virtual Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> CreateOrgPolicyViolationsPreview(CreateOrgPolicyViolationsPreviewRequest request, CallSettings callSettings = null)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
request |
CreateOrgPolicyViolationsPreviewRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
The RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
CreateOrgPolicyViolationsPreviewRequest request = new CreateOrgPolicyViolationsPreviewRequest
{
ParentAsOrganizationLocationName = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
OrgPolicyViolationsPreview = new OrgPolicyViolationsPreview(),
OrgPolicyViolationsPreviewId = "",
};
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreview(request);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreview(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreview(OrganizationLocationName, OrgPolicyViolationsPreview, string, CallSettings)
public virtual Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> CreateOrgPolicyViolationsPreview(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, string orgPolicyViolationsPreviewId, CallSettings callSettings = null)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
parent |
OrganizationLocationNameRequired. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created. Example: |
orgPolicyViolationsPreview |
OrgPolicyViolationsPreviewRequired. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate. |
orgPolicyViolationsPreviewId |
stringOptional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
The RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
OrgPolicyViolationsPreview orgPolicyViolationsPreview = new OrgPolicyViolationsPreview();
string orgPolicyViolationsPreviewId = "";
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreview(parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreview(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreview(string, OrgPolicyViolationsPreview, string, CallSettings)
public virtual Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> CreateOrgPolicyViolationsPreview(string parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, string orgPolicyViolationsPreviewId, CallSettings callSettings = null)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created. Example: |
orgPolicyViolationsPreview |
OrgPolicyViolationsPreviewRequired. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate. |
orgPolicyViolationsPreviewId |
stringOptional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
The RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]";
OrgPolicyViolationsPreview orgPolicyViolationsPreview = new OrgPolicyViolationsPreview();
string orgPolicyViolationsPreviewId = "";
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreview(parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreview(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest, CallSettings)
public virtual Task<Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata>> CreateOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest request, CallSettings callSettings = null)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
request |
CreateOrgPolicyViolationsPreviewRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
CreateOrgPolicyViolationsPreviewRequest request = new CreateOrgPolicyViolationsPreviewRequest
{
ParentAsOrganizationLocationName = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
OrgPolicyViolationsPreview = new OrgPolicyViolationsPreview(),
OrgPolicyViolationsPreviewId = "",
};
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = await orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreviewAsync(request);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = await orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreviewAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest, CancellationToken)
public virtual Task<Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata>> CreateOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest request, CancellationToken cancellationToken)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
request |
CreateOrgPolicyViolationsPreviewRequestThe request object containing all of the parameters for the API call. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
CreateOrgPolicyViolationsPreviewRequest request = new CreateOrgPolicyViolationsPreviewRequest
{
ParentAsOrganizationLocationName = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
OrgPolicyViolationsPreview = new OrgPolicyViolationsPreview(),
OrgPolicyViolationsPreviewId = "",
};
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = await orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreviewAsync(request);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = await orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreviewAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreviewAsync(OrganizationLocationName, OrgPolicyViolationsPreview, string, CallSettings)
public virtual Task<Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata>> CreateOrgPolicyViolationsPreviewAsync(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, string orgPolicyViolationsPreviewId, CallSettings callSettings = null)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
parent |
OrganizationLocationNameRequired. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created. Example: |
orgPolicyViolationsPreview |
OrgPolicyViolationsPreviewRequired. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate. |
orgPolicyViolationsPreviewId |
stringOptional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
OrgPolicyViolationsPreview orgPolicyViolationsPreview = new OrgPolicyViolationsPreview();
string orgPolicyViolationsPreviewId = "";
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = await orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreviewAsync(parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = await orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreviewAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreviewAsync(OrganizationLocationName, OrgPolicyViolationsPreview, string, CancellationToken)
public virtual Task<Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata>> CreateOrgPolicyViolationsPreviewAsync(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, string orgPolicyViolationsPreviewId, CancellationToken cancellationToken)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
parent |
OrganizationLocationNameRequired. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created. Example: |
orgPolicyViolationsPreview |
OrgPolicyViolationsPreviewRequired. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate. |
orgPolicyViolationsPreviewId |
stringOptional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
OrgPolicyViolationsPreview orgPolicyViolationsPreview = new OrgPolicyViolationsPreview();
string orgPolicyViolationsPreviewId = "";
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = await orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreviewAsync(parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = await orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreviewAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreviewAsync(string, OrgPolicyViolationsPreview, string, CallSettings)
public virtual Task<Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata>> CreateOrgPolicyViolationsPreviewAsync(string parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, string orgPolicyViolationsPreviewId, CallSettings callSettings = null)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created. Example: |
orgPolicyViolationsPreview |
OrgPolicyViolationsPreviewRequired. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate. |
orgPolicyViolationsPreviewId |
stringOptional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]";
OrgPolicyViolationsPreview orgPolicyViolationsPreview = new OrgPolicyViolationsPreview();
string orgPolicyViolationsPreviewId = "";
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = await orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreviewAsync(parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = await orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreviewAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
CreateOrgPolicyViolationsPreviewAsync(string, OrgPolicyViolationsPreview, string, CancellationToken)
public virtual Task<Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata>> CreateOrgPolicyViolationsPreviewAsync(string parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, string orgPolicyViolationsPreviewId, CancellationToken cancellationToken)CreateOrgPolicyViolationsPreview creates an
[OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]
for the proposed changes in the provided
[OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy
are specified by this OrgPolicyOverlay. The resources to scan are
inferred from these specified changes.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created. Example: |
orgPolicyViolationsPreview |
OrgPolicyViolationsPreviewRequired. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate. |
orgPolicyViolationsPreviewId |
stringOptional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]";
OrgPolicyViolationsPreview orgPolicyViolationsPreview = new OrgPolicyViolationsPreview();
string orgPolicyViolationsPreviewId = "";
// Make the request
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> response = await orgPolicyViolationsPreviewServiceClient.CreateOrgPolicyViolationsPreviewAsync(parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId);
// Poll until the returned long-running operation is complete
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
OrgPolicyViolationsPreview result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> retrievedResponse = await orgPolicyViolationsPreviewServiceClient.PollOnceCreateOrgPolicyViolationsPreviewAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
OrgPolicyViolationsPreview retrievedResult = retrievedResponse.Result;
}
GetOrgPolicyViolationsPreview(GetOrgPolicyViolationsPreviewRequest, CallSettings)
public virtual OrgPolicyViolationsPreview GetOrgPolicyViolationsPreview(GetOrgPolicyViolationsPreviewRequest request, CallSettings callSettings = null)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
request |
GetOrgPolicyViolationsPreviewRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OrgPolicyViolationsPreview |
The RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
GetOrgPolicyViolationsPreviewRequest request = new GetOrgPolicyViolationsPreviewRequest
{
OrgPolicyViolationsPreviewName = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]"),
};
// Make the request
OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreview(request);
GetOrgPolicyViolationsPreview(OrgPolicyViolationsPreviewName, CallSettings)
public virtual OrgPolicyViolationsPreview GetOrgPolicyViolationsPreview(OrgPolicyViolationsPreviewName name, CallSettings callSettings = null)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
name |
OrgPolicyViolationsPreviewNameRequired. The name of the OrgPolicyViolationsPreview to get. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OrgPolicyViolationsPreview |
The RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
OrgPolicyViolationsPreviewName name = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]");
// Make the request
OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreview(name);
GetOrgPolicyViolationsPreview(string, CallSettings)
public virtual OrgPolicyViolationsPreview GetOrgPolicyViolationsPreview(string name, CallSettings callSettings = null)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
name |
stringRequired. The name of the OrgPolicyViolationsPreview to get. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OrgPolicyViolationsPreview |
The RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/orgPolicyViolationsPreviews/[ORG_POLICY_VIOLATIONS_PREVIEW]";
// Make the request
OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreview(name);
GetOrgPolicyViolationsPreviewAsync(GetOrgPolicyViolationsPreviewRequest, CallSettings)
public virtual Task<OrgPolicyViolationsPreview> GetOrgPolicyViolationsPreviewAsync(GetOrgPolicyViolationsPreviewRequest request, CallSettings callSettings = null)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
request |
GetOrgPolicyViolationsPreviewRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOrgPolicyViolationsPreview |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
GetOrgPolicyViolationsPreviewRequest request = new GetOrgPolicyViolationsPreviewRequest
{
OrgPolicyViolationsPreviewName = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]"),
};
// Make the request
OrgPolicyViolationsPreview response = await orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreviewAsync(request);
GetOrgPolicyViolationsPreviewAsync(GetOrgPolicyViolationsPreviewRequest, CancellationToken)
public virtual Task<OrgPolicyViolationsPreview> GetOrgPolicyViolationsPreviewAsync(GetOrgPolicyViolationsPreviewRequest request, CancellationToken cancellationToken)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
request |
GetOrgPolicyViolationsPreviewRequestThe request object containing all of the parameters for the API call. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOrgPolicyViolationsPreview |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
GetOrgPolicyViolationsPreviewRequest request = new GetOrgPolicyViolationsPreviewRequest
{
OrgPolicyViolationsPreviewName = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]"),
};
// Make the request
OrgPolicyViolationsPreview response = await orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreviewAsync(request);
GetOrgPolicyViolationsPreviewAsync(OrgPolicyViolationsPreviewName, CallSettings)
public virtual Task<OrgPolicyViolationsPreview> GetOrgPolicyViolationsPreviewAsync(OrgPolicyViolationsPreviewName name, CallSettings callSettings = null)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
name |
OrgPolicyViolationsPreviewNameRequired. The name of the OrgPolicyViolationsPreview to get. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOrgPolicyViolationsPreview |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
OrgPolicyViolationsPreviewName name = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]");
// Make the request
OrgPolicyViolationsPreview response = await orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreviewAsync(name);
GetOrgPolicyViolationsPreviewAsync(OrgPolicyViolationsPreviewName, CancellationToken)
public virtual Task<OrgPolicyViolationsPreview> GetOrgPolicyViolationsPreviewAsync(OrgPolicyViolationsPreviewName name, CancellationToken cancellationToken)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
name |
OrgPolicyViolationsPreviewNameRequired. The name of the OrgPolicyViolationsPreview to get. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOrgPolicyViolationsPreview |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
OrgPolicyViolationsPreviewName name = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]");
// Make the request
OrgPolicyViolationsPreview response = await orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreviewAsync(name);
GetOrgPolicyViolationsPreviewAsync(string, CallSettings)
public virtual Task<OrgPolicyViolationsPreview> GetOrgPolicyViolationsPreviewAsync(string name, CallSettings callSettings = null)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
name |
stringRequired. The name of the OrgPolicyViolationsPreview to get. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOrgPolicyViolationsPreview |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/orgPolicyViolationsPreviews/[ORG_POLICY_VIOLATIONS_PREVIEW]";
// Make the request
OrgPolicyViolationsPreview response = await orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreviewAsync(name);
GetOrgPolicyViolationsPreviewAsync(string, CancellationToken)
public virtual Task<OrgPolicyViolationsPreview> GetOrgPolicyViolationsPreviewAsync(string name, CancellationToken cancellationToken)GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
name |
stringRequired. The name of the OrgPolicyViolationsPreview to get. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOrgPolicyViolationsPreview |
A Task containing the RPC response. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/orgPolicyViolationsPreviews/[ORG_POLICY_VIOLATIONS_PREVIEW]";
// Make the request
OrgPolicyViolationsPreview response = await orgPolicyViolationsPreviewServiceClient.GetOrgPolicyViolationsPreviewAsync(name);
ListOrgPolicyViolations(ListOrgPolicyViolationsRequest, CallSettings)
public virtual PagedEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> ListOrgPolicyViolations(ListOrgPolicyViolationsRequest request, CallSettings callSettings = null)ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].
| Parameters | |
|---|---|
| Name | Description |
request |
ListOrgPolicyViolationsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableListOrgPolicyViolationsResponseOrgPolicyViolation |
A pageable sequence of OrgPolicyViolation resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
ListOrgPolicyViolationsRequest request = new ListOrgPolicyViolationsRequest
{
ParentAsOrgPolicyViolationsPreviewName = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]"),
};
// Make the request
PagedEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolations(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (OrgPolicyViolation 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 (ListOrgPolicyViolationsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolation 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<OrgPolicyViolation> 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 (OrgPolicyViolation 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;
ListOrgPolicyViolations(OrgPolicyViolationsPreviewName, string, int?, CallSettings)
public virtual PagedEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> ListOrgPolicyViolations(OrgPolicyViolationsPreviewName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].
| Parameters | |
|---|---|
| Name | Description |
parent |
OrgPolicyViolationsPreviewNameRequired. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview} |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableListOrgPolicyViolationsResponseOrgPolicyViolation |
A pageable sequence of OrgPolicyViolation resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
OrgPolicyViolationsPreviewName parent = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]");
// Make the request
PagedEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolations(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (OrgPolicyViolation 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 (ListOrgPolicyViolationsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolation 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<OrgPolicyViolation> 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 (OrgPolicyViolation 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;
ListOrgPolicyViolations(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> ListOrgPolicyViolations(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview} |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableListOrgPolicyViolationsResponseOrgPolicyViolation |
A pageable sequence of OrgPolicyViolation resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]/orgPolicyViolationsPreviews/[ORG_POLICY_VIOLATIONS_PREVIEW]";
// Make the request
PagedEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolations(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (OrgPolicyViolation 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 (ListOrgPolicyViolationsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolation 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<OrgPolicyViolation> 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 (OrgPolicyViolation 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;
ListOrgPolicyViolationsAsync(ListOrgPolicyViolationsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> ListOrgPolicyViolationsAsync(ListOrgPolicyViolationsRequest request, CallSettings callSettings = null)ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].
| Parameters | |
|---|---|
| Name | Description |
request |
ListOrgPolicyViolationsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableListOrgPolicyViolationsResponseOrgPolicyViolation |
A pageable asynchronous sequence of OrgPolicyViolation resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
ListOrgPolicyViolationsRequest request = new ListOrgPolicyViolationsRequest
{
ParentAsOrgPolicyViolationsPreviewName = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]"),
};
// Make the request
PagedAsyncEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OrgPolicyViolation 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((ListOrgPolicyViolationsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolation 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<OrgPolicyViolation> 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 (OrgPolicyViolation 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;
ListOrgPolicyViolationsAsync(OrgPolicyViolationsPreviewName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> ListOrgPolicyViolationsAsync(OrgPolicyViolationsPreviewName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].
| Parameters | |
|---|---|
| Name | Description |
parent |
OrgPolicyViolationsPreviewNameRequired. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview} |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableListOrgPolicyViolationsResponseOrgPolicyViolation |
A pageable asynchronous sequence of OrgPolicyViolation resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
OrgPolicyViolationsPreviewName parent = OrgPolicyViolationsPreviewName.FromOrganizationLocationOrgPolicyViolationsPreview("[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]");
// Make the request
PagedAsyncEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OrgPolicyViolation 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((ListOrgPolicyViolationsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolation 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<OrgPolicyViolation> 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 (OrgPolicyViolation 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;
ListOrgPolicyViolationsAsync(string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> ListOrgPolicyViolationsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview} |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableListOrgPolicyViolationsResponseOrgPolicyViolation |
A pageable asynchronous sequence of OrgPolicyViolation resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]/orgPolicyViolationsPreviews/[ORG_POLICY_VIOLATIONS_PREVIEW]";
// Make the request
PagedAsyncEnumerable<ListOrgPolicyViolationsResponse, OrgPolicyViolation> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OrgPolicyViolation 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((ListOrgPolicyViolationsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolation 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<OrgPolicyViolation> 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 (OrgPolicyViolation 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;
ListOrgPolicyViolationsPreviews(ListOrgPolicyViolationsPreviewsRequest, CallSettings)
public virtual PagedEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> ListOrgPolicyViolationsPreviews(ListOrgPolicyViolationsPreviewsRequest request, CallSettings callSettings = null)ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
request |
ListOrgPolicyViolationsPreviewsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableListOrgPolicyViolationsPreviewsResponseOrgPolicyViolationsPreview |
A pageable sequence of OrgPolicyViolationsPreview resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
ListOrgPolicyViolationsPreviewsRequest request = new ListOrgPolicyViolationsPreviewsRequest
{
ParentAsOrganizationLocationName = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
};
// Make the request
PagedEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviews(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (OrgPolicyViolationsPreview 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 (ListOrgPolicyViolationsPreviewsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolationsPreview 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<OrgPolicyViolationsPreview> 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 (OrgPolicyViolationsPreview 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;
ListOrgPolicyViolationsPreviews(OrganizationLocationName, string, int?, CallSettings)
public virtual PagedEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> ListOrgPolicyViolationsPreviews(OrganizationLocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
parent |
OrganizationLocationNameRequired. The parent the violations are scoped to.
Format:
Example: |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableListOrgPolicyViolationsPreviewsResponseOrgPolicyViolationsPreview |
A pageable sequence of OrgPolicyViolationsPreview resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
// Make the request
PagedEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviews(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (OrgPolicyViolationsPreview 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 (ListOrgPolicyViolationsPreviewsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolationsPreview 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<OrgPolicyViolationsPreview> 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 (OrgPolicyViolationsPreview 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;
ListOrgPolicyViolationsPreviews(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> ListOrgPolicyViolationsPreviews(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The parent the violations are scoped to.
Format:
Example: |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableListOrgPolicyViolationsPreviewsResponseOrgPolicyViolationsPreview |
A pageable sequence of OrgPolicyViolationsPreview resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.Create();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviews(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (OrgPolicyViolationsPreview 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 (ListOrgPolicyViolationsPreviewsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolationsPreview 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<OrgPolicyViolationsPreview> 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 (OrgPolicyViolationsPreview 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;
ListOrgPolicyViolationsPreviewsAsync(ListOrgPolicyViolationsPreviewsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> ListOrgPolicyViolationsPreviewsAsync(ListOrgPolicyViolationsPreviewsRequest request, CallSettings callSettings = null)ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
request |
ListOrgPolicyViolationsPreviewsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableListOrgPolicyViolationsPreviewsResponseOrgPolicyViolationsPreview |
A pageable asynchronous sequence of OrgPolicyViolationsPreview resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
ListOrgPolicyViolationsPreviewsRequest request = new ListOrgPolicyViolationsPreviewsRequest
{
ParentAsOrganizationLocationName = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
};
// Make the request
PagedAsyncEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OrgPolicyViolationsPreview 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((ListOrgPolicyViolationsPreviewsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolationsPreview 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<OrgPolicyViolationsPreview> 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 (OrgPolicyViolationsPreview 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;
ListOrgPolicyViolationsPreviewsAsync(OrganizationLocationName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> ListOrgPolicyViolationsPreviewsAsync(OrganizationLocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
parent |
OrganizationLocationNameRequired. The parent the violations are scoped to.
Format:
Example: |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableListOrgPolicyViolationsPreviewsResponseOrgPolicyViolationsPreview |
A pageable asynchronous sequence of OrgPolicyViolationsPreview resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OrgPolicyViolationsPreview 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((ListOrgPolicyViolationsPreviewsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolationsPreview 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<OrgPolicyViolationsPreview> 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 (OrgPolicyViolationsPreview 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;
ListOrgPolicyViolationsPreviewsAsync(string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> ListOrgPolicyViolationsPreviewsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The parent the violations are scoped to.
Format:
Example: |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableListOrgPolicyViolationsPreviewsResponseOrgPolicyViolationsPreview |
A pageable asynchronous sequence of OrgPolicyViolationsPreview resources. |
// Create client
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = await OrgPolicyViolationsPreviewServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListOrgPolicyViolationsPreviewsResponse, OrgPolicyViolationsPreview> response = orgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OrgPolicyViolationsPreview 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((ListOrgPolicyViolationsPreviewsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OrgPolicyViolationsPreview 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<OrgPolicyViolationsPreview> 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 (OrgPolicyViolationsPreview 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;
PollOnceCreateOrgPolicyViolationsPreview(string, CallSettings)
public virtual Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> PollOnceCreateOrgPolicyViolationsPreview(string operationName, CallSettings callSettings = null)Poll an operation once, using an operationName from a previous invocation of
CreateOrgPolicyViolationsPreview.
| Parameters | |
|---|---|
| Name | Description |
operationName |
stringThe name of a previously invoked operation. Must not be |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
The result of polling the operation. |
PollOnceCreateOrgPolicyViolationsPreviewAsync(string, CallSettings)
public virtual Task<Operation<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata>> PollOnceCreateOrgPolicyViolationsPreviewAsync(string operationName, CallSettings callSettings = null)Asynchronously poll an operation once, using an operationName from a previous invocation of
CreateOrgPolicyViolationsPreview.
| Parameters | |
|---|---|
| Name | Description |
operationName |
stringThe name of a previously invoked operation. Must not be |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOrgPolicyViolationsPreviewCreateOrgPolicyViolationsPreviewOperationMetadata |
A task representing the result of polling the operation. |
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.