public abstract class SimulatorClient
Reference documentation and code samples for the Policy Simulator v1 API class SimulatorClient.
Simulator client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.PolicySimulator.V1Assembly
Google.Cloud.PolicySimulator.V1.dll
Remarks
Policy Simulator API service.
Policy Simulator is a collection of endpoints for creating, running, and viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that lets you see how your principals' access to resources might change if you changed your IAM policy.
During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator re-evaluates, or replays, past access attempts under both the current policy and your proposed policy, and compares those results to determine how your principals' access might change under the proposed policy.
Properties
CreateReplayOperationsClient
public virtual OperationsClient CreateReplayOperationsClient { get; }
The long-running operations client for CreateReplay
.
Property Value | |
---|---|
Type | Description |
OperationsClient |
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the Simulator 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 Simulator scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default Simulator scopes are:
GrpcClient
public virtual Simulator.SimulatorClient GrpcClient { get; }
The underlying gRPC Simulator client
Property Value | |
---|---|
Type | Description |
SimulatorSimulatorClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static SimulatorClient Create()
Synchronously creates a SimulatorClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use SimulatorClientBuilder.
Returns | |
---|---|
Type | Description |
SimulatorClient | The created SimulatorClient. |
CreateAsync(CancellationToken)
public static Task<SimulatorClient> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a SimulatorClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use SimulatorClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskSimulatorClient | The task representing the created SimulatorClient. |
CreateReplay(CreateReplayRequest, CallSettings)
public virtual Operation<Replay, ReplayOperationMetadata> CreateReplay(CreateReplayRequest request, CallSettings callSettings = null)
Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
Parameters | |
---|---|
Name | Description |
request | CreateReplayRequest 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 |
OperationReplayReplayOperationMetadata | The RPC response. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
CreateReplayRequest request = new CreateReplayRequest
{
Parent = "",
Replay = new Replay(),
};
// Make the request
Operation<Replay, ReplayOperationMetadata> response = simulatorClient.CreateReplay(request);
// Poll until the returned long-running operation is complete
Operation<Replay, ReplayOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Replay 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<Replay, ReplayOperationMetadata> retrievedResponse = simulatorClient.PollOnceCreateReplay(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Replay retrievedResult = retrievedResponse.Result;
}
CreateReplay(string, Replay, CallSettings)
public virtual Operation<Replay, ReplayOperationMetadata> CreateReplay(string parent, Replay replay, CallSettings callSettings = null)
Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
Parameters | |
---|---|
Name | Description |
parent | string Required. The parent resource where this [Replay][google.cloud.policysimulator.v1.Replay] will be created. This resource must be a project, folder, or organization with a location. Example: |
replay | Replay Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
Set |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationReplayReplayOperationMetadata | The RPC response. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
string parent = "";
Replay replay = new Replay();
// Make the request
Operation<Replay, ReplayOperationMetadata> response = simulatorClient.CreateReplay(parent, replay);
// Poll until the returned long-running operation is complete
Operation<Replay, ReplayOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Replay 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<Replay, ReplayOperationMetadata> retrievedResponse = simulatorClient.PollOnceCreateReplay(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Replay retrievedResult = retrievedResponse.Result;
}
CreateReplayAsync(CreateReplayRequest, CallSettings)
public virtual Task<Operation<Replay, ReplayOperationMetadata>> CreateReplayAsync(CreateReplayRequest request, CallSettings callSettings = null)
Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
Parameters | |
---|---|
Name | Description |
request | CreateReplayRequest 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 |
TaskOperationReplayReplayOperationMetadata | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
CreateReplayRequest request = new CreateReplayRequest
{
Parent = "",
Replay = new Replay(),
};
// Make the request
Operation<Replay, ReplayOperationMetadata> response = await simulatorClient.CreateReplayAsync(request);
// Poll until the returned long-running operation is complete
Operation<Replay, ReplayOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Replay 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<Replay, ReplayOperationMetadata> retrievedResponse = await simulatorClient.PollOnceCreateReplayAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Replay retrievedResult = retrievedResponse.Result;
}
CreateReplayAsync(CreateReplayRequest, CancellationToken)
public virtual Task<Operation<Replay, ReplayOperationMetadata>> CreateReplayAsync(CreateReplayRequest request, CancellationToken cancellationToken)
Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
Parameters | |
---|---|
Name | Description |
request | CreateReplayRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationReplayReplayOperationMetadata | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
CreateReplayRequest request = new CreateReplayRequest
{
Parent = "",
Replay = new Replay(),
};
// Make the request
Operation<Replay, ReplayOperationMetadata> response = await simulatorClient.CreateReplayAsync(request);
// Poll until the returned long-running operation is complete
Operation<Replay, ReplayOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Replay 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<Replay, ReplayOperationMetadata> retrievedResponse = await simulatorClient.PollOnceCreateReplayAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Replay retrievedResult = retrievedResponse.Result;
}
CreateReplayAsync(string, Replay, CallSettings)
public virtual Task<Operation<Replay, ReplayOperationMetadata>> CreateReplayAsync(string parent, Replay replay, CallSettings callSettings = null)
Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
Parameters | |
---|---|
Name | Description |
parent | string Required. The parent resource where this [Replay][google.cloud.policysimulator.v1.Replay] will be created. This resource must be a project, folder, or organization with a location. Example: |
replay | Replay Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
Set |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationReplayReplayOperationMetadata | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
string parent = "";
Replay replay = new Replay();
// Make the request
Operation<Replay, ReplayOperationMetadata> response = await simulatorClient.CreateReplayAsync(parent, replay);
// Poll until the returned long-running operation is complete
Operation<Replay, ReplayOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Replay 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<Replay, ReplayOperationMetadata> retrievedResponse = await simulatorClient.PollOnceCreateReplayAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Replay retrievedResult = retrievedResponse.Result;
}
CreateReplayAsync(string, Replay, CancellationToken)
public virtual Task<Operation<Replay, ReplayOperationMetadata>> CreateReplayAsync(string parent, Replay replay, CancellationToken cancellationToken)
Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
Parameters | |
---|---|
Name | Description |
parent | string Required. The parent resource where this [Replay][google.cloud.policysimulator.v1.Replay] will be created. This resource must be a project, folder, or organization with a location. Example: |
replay | Replay Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
Set |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationReplayReplayOperationMetadata | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
string parent = "";
Replay replay = new Replay();
// Make the request
Operation<Replay, ReplayOperationMetadata> response = await simulatorClient.CreateReplayAsync(parent, replay);
// Poll until the returned long-running operation is complete
Operation<Replay, ReplayOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Replay 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<Replay, ReplayOperationMetadata> retrievedResponse = await simulatorClient.PollOnceCreateReplayAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Replay retrievedResult = retrievedResponse.Result;
}
GetReplay(GetReplayRequest, CallSettings)
public virtual Replay GetReplay(GetReplayRequest request, CallSettings callSettings = null)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
request | GetReplayRequest 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 |
Replay | The RPC response. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
GetReplayRequest request = new GetReplayRequest
{
ReplayName = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]"),
};
// Make the request
Replay response = simulatorClient.GetReplay(request);
GetReplay(ReplayName, CallSettings)
public virtual Replay GetReplay(ReplayName name, CallSettings callSettings = null)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
name | ReplayName Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to retrieve, in the following format:
Example:
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Replay | The RPC response. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
ReplayName name = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]");
// Make the request
Replay response = simulatorClient.GetReplay(name);
GetReplay(string, CallSettings)
public virtual Replay GetReplay(string name, CallSettings callSettings = null)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
name | string Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to retrieve, in the following format:
Example:
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Replay | The RPC response. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/replays/[REPLAY]";
// Make the request
Replay response = simulatorClient.GetReplay(name);
GetReplayAsync(GetReplayRequest, CallSettings)
public virtual Task<Replay> GetReplayAsync(GetReplayRequest request, CallSettings callSettings = null)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
request | GetReplayRequest 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 |
TaskReplay | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
GetReplayRequest request = new GetReplayRequest
{
ReplayName = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]"),
};
// Make the request
Replay response = await simulatorClient.GetReplayAsync(request);
GetReplayAsync(GetReplayRequest, CancellationToken)
public virtual Task<Replay> GetReplayAsync(GetReplayRequest request, CancellationToken cancellationToken)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
request | GetReplayRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskReplay | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
GetReplayRequest request = new GetReplayRequest
{
ReplayName = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]"),
};
// Make the request
Replay response = await simulatorClient.GetReplayAsync(request);
GetReplayAsync(ReplayName, CallSettings)
public virtual Task<Replay> GetReplayAsync(ReplayName name, CallSettings callSettings = null)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
name | ReplayName Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to retrieve, in the following format:
Example:
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskReplay | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
ReplayName name = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]");
// Make the request
Replay response = await simulatorClient.GetReplayAsync(name);
GetReplayAsync(ReplayName, CancellationToken)
public virtual Task<Replay> GetReplayAsync(ReplayName name, CancellationToken cancellationToken)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
name | ReplayName Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to retrieve, in the following format:
Example:
|
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskReplay | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
ReplayName name = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]");
// Make the request
Replay response = await simulatorClient.GetReplayAsync(name);
GetReplayAsync(string, CallSettings)
public virtual Task<Replay> GetReplayAsync(string name, CallSettings callSettings = null)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
name | string Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to retrieve, in the following format:
Example:
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskReplay | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/replays/[REPLAY]";
// Make the request
Replay response = await simulatorClient.GetReplayAsync(name);
GetReplayAsync(string, CancellationToken)
public virtual Task<Replay> GetReplayAsync(string name, CancellationToken cancellationToken)
Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
Replay
is available for at least 7 days.
Parameters | |
---|---|
Name | Description |
name | string Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to retrieve, in the following format:
Example:
|
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskReplay | A Task containing the RPC response. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/replays/[REPLAY]";
// Make the request
Replay response = await simulatorClient.GetReplayAsync(name);
ListReplayResults(ListReplayResultsRequest, CallSettings)
public virtual PagedEnumerable<ListReplayResultsResponse, ReplayResult> ListReplayResults(ListReplayResultsRequest request, CallSettings callSettings = null)
Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay].
Parameters | |
---|---|
Name | Description |
request | ListReplayResultsRequest 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 |
PagedEnumerableListReplayResultsResponseReplayResult | A pageable sequence of ReplayResult resources. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
ListReplayResultsRequest request = new ListReplayResultsRequest
{
ParentAsReplayName = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]"),
};
// Make the request
PagedEnumerable<ListReplayResultsResponse, ReplayResult> response = simulatorClient.ListReplayResults(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (ReplayResult 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 (ListReplayResultsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReplayResult 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<ReplayResult> 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 (ReplayResult 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;
ListReplayResults(ReplayName, string, int?, CallSettings)
public virtual PagedEnumerable<ListReplayResultsResponse, ReplayResult> ListReplayResults(ReplayName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay].
Parameters | |
---|---|
Name | Description |
parent | ReplayName Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose results are listed, in the following format:
Example:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int 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 |
PagedEnumerableListReplayResultsResponseReplayResult | A pageable sequence of ReplayResult resources. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
ReplayName parent = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]");
// Make the request
PagedEnumerable<ListReplayResultsResponse, ReplayResult> response = simulatorClient.ListReplayResults(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (ReplayResult 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 (ListReplayResultsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReplayResult 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<ReplayResult> 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 (ReplayResult 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;
ListReplayResults(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListReplayResultsResponse, ReplayResult> ListReplayResults(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay].
Parameters | |
---|---|
Name | Description |
parent | string Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose results are listed, in the following format:
Example:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int 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 |
PagedEnumerableListReplayResultsResponseReplayResult | A pageable sequence of ReplayResult resources. |
// Create client
SimulatorClient simulatorClient = SimulatorClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/replays/[REPLAY]";
// Make the request
PagedEnumerable<ListReplayResultsResponse, ReplayResult> response = simulatorClient.ListReplayResults(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (ReplayResult 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 (ListReplayResultsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReplayResult 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<ReplayResult> 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 (ReplayResult 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;
ListReplayResultsAsync(ListReplayResultsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListReplayResultsResponse, ReplayResult> ListReplayResultsAsync(ListReplayResultsRequest request, CallSettings callSettings = null)
Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay].
Parameters | |
---|---|
Name | Description |
request | ListReplayResultsRequest 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 |
PagedAsyncEnumerableListReplayResultsResponseReplayResult | A pageable asynchronous sequence of ReplayResult resources. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
ListReplayResultsRequest request = new ListReplayResultsRequest
{
ParentAsReplayName = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]"),
};
// Make the request
PagedAsyncEnumerable<ListReplayResultsResponse, ReplayResult> response = simulatorClient.ListReplayResultsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ReplayResult 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((ListReplayResultsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReplayResult 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<ReplayResult> 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 (ReplayResult 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;
ListReplayResultsAsync(ReplayName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListReplayResultsResponse, ReplayResult> ListReplayResultsAsync(ReplayName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay].
Parameters | |
---|---|
Name | Description |
parent | ReplayName Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose results are listed, in the following format:
Example:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int 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 |
PagedAsyncEnumerableListReplayResultsResponseReplayResult | A pageable asynchronous sequence of ReplayResult resources. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
ReplayName parent = ReplayName.FromProjectLocationReplay("[PROJECT]", "[LOCATION]", "[REPLAY]");
// Make the request
PagedAsyncEnumerable<ListReplayResultsResponse, ReplayResult> response = simulatorClient.ListReplayResultsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ReplayResult 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((ListReplayResultsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReplayResult 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<ReplayResult> 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 (ReplayResult 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;
ListReplayResultsAsync(string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListReplayResultsResponse, ReplayResult> ListReplayResultsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay].
Parameters | |
---|---|
Name | Description |
parent | string Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose results are listed, in the following format:
Example:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int 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 |
PagedAsyncEnumerableListReplayResultsResponseReplayResult | A pageable asynchronous sequence of ReplayResult resources. |
// Create client
SimulatorClient simulatorClient = await SimulatorClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/replays/[REPLAY]";
// Make the request
PagedAsyncEnumerable<ListReplayResultsResponse, ReplayResult> response = simulatorClient.ListReplayResultsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ReplayResult 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((ListReplayResultsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReplayResult 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<ReplayResult> 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 (ReplayResult 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;
PollOnceCreateReplay(string, CallSettings)
public virtual Operation<Replay, ReplayOperationMetadata> PollOnceCreateReplay(string operationName, CallSettings callSettings = null)
Poll an operation once, using an operationName
from a previous invocation of CreateReplay
.
Parameters | |
---|---|
Name | Description |
operationName | string The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationReplayReplayOperationMetadata | The result of polling the operation. |
PollOnceCreateReplayAsync(string, CallSettings)
public virtual Task<Operation<Replay, ReplayOperationMetadata>> PollOnceCreateReplayAsync(string operationName, CallSettings callSettings = null)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
CreateReplay
.
Parameters | |
---|---|
Name | Description |
operationName | string The name of a previously invoked operation. Must not be |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationReplayReplayOperationMetadata | 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.