public abstract class EnvironmentsClient
Reference documentation and code samples for the Google Cloud Dialogflow v2 API class EnvironmentsClient.
Environments client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Dialogflow.V2Assembly
Google.Cloud.Dialogflow.V2.dll
Remarks
Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the Environments service, which is a host of "dialogflow.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default Environments scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default Environments scopes are:
GrpcClient
public virtual Environments.EnvironmentsClient GrpcClient { get; }
The underlying gRPC Environments client
Property Value | |
---|---|
Type | Description |
Environments.EnvironmentsClient |
LocationsClient
public virtual LocationsClient LocationsClient { get; }
The LocationsClient associated with this client.
Property Value | |
---|---|
Type | Description |
LocationsClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static EnvironmentsClient Create()
Synchronously creates a EnvironmentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EnvironmentsClientBuilder.
Returns | |
---|---|
Type | Description |
EnvironmentsClient | The created EnvironmentsClient. |
CreateAsync(CancellationToken)
public static Task<EnvironmentsClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a EnvironmentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EnvironmentsClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<EnvironmentsClient> | The task representing the created EnvironmentsClient. |
CreateEnvironment(CreateEnvironmentRequest, CallSettings)
public virtual Environment CreateEnvironment(CreateEnvironmentRequest request, CallSettings callSettings = null)
Creates an agent environment.
Parameters | |
---|---|
Name | Description |
request | CreateEnvironmentRequest 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 |
Environment | The RPC response. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
CreateEnvironmentRequest request = new CreateEnvironmentRequest
{
ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
Environment = new gcdv::Environment(),
EnvironmentId = "",
};
// Make the request
gcdv::Environment response = environmentsClient.CreateEnvironment(request);
CreateEnvironmentAsync(CreateEnvironmentRequest, CallSettings)
public virtual Task<Environment> CreateEnvironmentAsync(CreateEnvironmentRequest request, CallSettings callSettings = null)
Creates an agent environment.
Parameters | |
---|---|
Name | Description |
request | CreateEnvironmentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Environment> | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
CreateEnvironmentRequest request = new CreateEnvironmentRequest
{
ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
Environment = new gcdv::Environment(),
EnvironmentId = "",
};
// Make the request
gcdv::Environment response = await environmentsClient.CreateEnvironmentAsync(request);
CreateEnvironmentAsync(CreateEnvironmentRequest, CancellationToken)
public virtual Task<Environment> CreateEnvironmentAsync(CreateEnvironmentRequest request, CancellationToken cancellationToken)
Creates an agent environment.
Parameters | |
---|---|
Name | Description |
request | CreateEnvironmentRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Environment> | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
CreateEnvironmentRequest request = new CreateEnvironmentRequest
{
ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
Environment = new gcdv::Environment(),
EnvironmentId = "",
};
// Make the request
gcdv::Environment response = await environmentsClient.CreateEnvironmentAsync(request);
DeleteEnvironment(DeleteEnvironmentRequest, CallSettings)
public virtual void DeleteEnvironment(DeleteEnvironmentRequest request, CallSettings callSettings = null)
Deletes the specified agent environment.
Parameters | |
---|---|
Name | Description |
request | DeleteEnvironmentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
DeleteEnvironmentRequest request = new DeleteEnvironmentRequest
{
EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
environmentsClient.DeleteEnvironment(request);
DeleteEnvironmentAsync(DeleteEnvironmentRequest, CallSettings)
public virtual Task DeleteEnvironmentAsync(DeleteEnvironmentRequest request, CallSettings callSettings = null)
Deletes the specified agent environment.
Parameters | |
---|---|
Name | Description |
request | DeleteEnvironmentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
DeleteEnvironmentRequest request = new DeleteEnvironmentRequest
{
EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
await environmentsClient.DeleteEnvironmentAsync(request);
DeleteEnvironmentAsync(DeleteEnvironmentRequest, CancellationToken)
public virtual Task DeleteEnvironmentAsync(DeleteEnvironmentRequest request, CancellationToken cancellationToken)
Deletes the specified agent environment.
Parameters | |
---|---|
Name | Description |
request | DeleteEnvironmentRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
DeleteEnvironmentRequest request = new DeleteEnvironmentRequest
{
EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
await environmentsClient.DeleteEnvironmentAsync(request);
GetEnvironment(GetEnvironmentRequest, CallSettings)
public virtual Environment GetEnvironment(GetEnvironmentRequest request, CallSettings callSettings = null)
Retrieves the specified agent environment.
Parameters | |
---|---|
Name | Description |
request | GetEnvironmentRequest 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 |
Environment | The RPC response. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
GetEnvironmentRequest request = new GetEnvironmentRequest
{
EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
gcdv::Environment response = environmentsClient.GetEnvironment(request);
GetEnvironmentAsync(GetEnvironmentRequest, CallSettings)
public virtual Task<Environment> GetEnvironmentAsync(GetEnvironmentRequest request, CallSettings callSettings = null)
Retrieves the specified agent environment.
Parameters | |
---|---|
Name | Description |
request | GetEnvironmentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Environment> | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
GetEnvironmentRequest request = new GetEnvironmentRequest
{
EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
gcdv::Environment response = await environmentsClient.GetEnvironmentAsync(request);
GetEnvironmentAsync(GetEnvironmentRequest, CancellationToken)
public virtual Task<Environment> GetEnvironmentAsync(GetEnvironmentRequest request, CancellationToken cancellationToken)
Retrieves the specified agent environment.
Parameters | |
---|---|
Name | Description |
request | GetEnvironmentRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Environment> | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
GetEnvironmentRequest request = new GetEnvironmentRequest
{
EnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
gcdv::Environment response = await environmentsClient.GetEnvironmentAsync(request);
GetEnvironmentHistory(GetEnvironmentHistoryRequest, CallSettings)
public virtual PagedEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> GetEnvironmentHistory(GetEnvironmentHistoryRequest request, CallSettings callSettings = null)
Gets the history of the specified environment.
Parameters | |
---|---|
Name | Description |
request | GetEnvironmentHistoryRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> | A pageable sequence of EnvironmentHistory.Types.Entry resources. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
GetEnvironmentHistoryRequest request = new GetEnvironmentHistoryRequest
{
ParentAsEnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
PagedEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> response = environmentsClient.GetEnvironmentHistory(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (EnvironmentHistory.Types.Entry 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 (EnvironmentHistory page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (EnvironmentHistory.Types.Entry 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<EnvironmentHistory.Types.Entry> 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 (EnvironmentHistory.Types.Entry 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;
GetEnvironmentHistoryAsync(GetEnvironmentHistoryRequest, CallSettings)
public virtual PagedAsyncEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> GetEnvironmentHistoryAsync(GetEnvironmentHistoryRequest request, CallSettings callSettings = null)
Gets the history of the specified environment.
Parameters | |
---|---|
Name | Description |
request | GetEnvironmentHistoryRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> | A pageable asynchronous sequence of EnvironmentHistory.Types.Entry resources. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
GetEnvironmentHistoryRequest request = new GetEnvironmentHistoryRequest
{
ParentAsEnvironmentName = EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
PagedAsyncEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> response = environmentsClient.GetEnvironmentHistoryAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((EnvironmentHistory.Types.Entry 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((EnvironmentHistory page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (EnvironmentHistory.Types.Entry 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<EnvironmentHistory.Types.Entry> 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 (EnvironmentHistory.Types.Entry 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;
ListEnvironments(AgentName, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(AgentName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Returns the list of all non-default environments of the specified agent.
Parameters | |
---|---|
Name | Description |
parent | AgentName Required. The agent to list all environments from. Format:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListEnvironmentsResponse, Environment> | A pageable sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
AgentName parent = AgentName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironments(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (gcdv::Environment 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 (ListEnvironmentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment 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;
ListEnvironments(ListEnvironmentsRequest, CallSettings)
public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(ListEnvironmentsRequest request, CallSettings callSettings = null)
Returns the list of all non-default environments of the specified agent.
Parameters | |
---|---|
Name | Description |
request | ListEnvironmentsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListEnvironmentsResponse, Environment> | A pageable sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
ListEnvironmentsRequest request = new ListEnvironmentsRequest
{
ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironments(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (gcdv::Environment 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 (ListEnvironmentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment 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;
ListEnvironments(String, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Returns the list of all non-default environments of the specified agent.
Parameters | |
---|---|
Name | Description |
parent | String Required. The agent to list all environments from. Format:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListEnvironmentsResponse, Environment> | A pageable sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent";
// Make the request
PagedEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironments(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (gcdv::Environment 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 (ListEnvironmentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment 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;
ListEnvironmentsAsync(AgentName, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(AgentName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Returns the list of all non-default environments of the specified agent.
Parameters | |
---|---|
Name | Description |
parent | AgentName Required. The agent to list all environments from. Format:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> | A pageable asynchronous sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
AgentName parent = AgentName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironmentsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gcdv::Environment 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((ListEnvironmentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment 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;
ListEnvironmentsAsync(ListEnvironmentsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(ListEnvironmentsRequest request, CallSettings callSettings = null)
Returns the list of all non-default environments of the specified agent.
Parameters | |
---|---|
Name | Description |
request | ListEnvironmentsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> | A pageable asynchronous sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
ListEnvironmentsRequest request = new ListEnvironmentsRequest
{
ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironmentsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gcdv::Environment 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((ListEnvironmentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment 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;
ListEnvironmentsAsync(String, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Returns the list of all non-default environments of the specified agent.
Parameters | |
---|---|
Name | Description |
parent | String Required. The agent to list all environments from. Format:
|
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> | A pageable asynchronous sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent";
// Make the request
PagedAsyncEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironmentsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gcdv::Environment 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((ListEnvironmentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.
UpdateEnvironment(UpdateEnvironmentRequest, CallSettings)
public virtual Environment UpdateEnvironment(UpdateEnvironmentRequest request, CallSettings callSettings = null)
Updates the specified agent environment.
This method allows you to deploy new agent versions into the environment.
When an environment is pointed to a new agent version by setting
environment.agent_version
, the environment is temporarily set to the
LOADING
state. During that time, the environment continues serving the
previous version of the agent. After the new agent version is done loading,
the environment is set back to the RUNNING
state.
You can use "-" as Environment ID in environment name to update an agent
version in the default environment. WARNING: this will negate all recent
changes to the draft agent and can't be undone. You may want to save the
draft agent to a version before calling this method.
Parameters | |
---|---|
Name | Description |
request | UpdateEnvironmentRequest 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 |
Environment | The RPC response. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
UpdateEnvironmentRequest request = new UpdateEnvironmentRequest
{
Environment = new gcdv::Environment(),
UpdateMask = new FieldMask(),
AllowLoadToDraftAndDiscardChanges = false,
};
// Make the request
gcdv::Environment response = environmentsClient.UpdateEnvironment(request);
UpdateEnvironmentAsync(UpdateEnvironmentRequest, CallSettings)
public virtual Task<Environment> UpdateEnvironmentAsync(UpdateEnvironmentRequest request, CallSettings callSettings = null)
Updates the specified agent environment.
This method allows you to deploy new agent versions into the environment.
When an environment is pointed to a new agent version by setting
environment.agent_version
, the environment is temporarily set to the
LOADING
state. During that time, the environment continues serving the
previous version of the agent. After the new agent version is done loading,
the environment is set back to the RUNNING
state.
You can use "-" as Environment ID in environment name to update an agent
version in the default environment. WARNING: this will negate all recent
changes to the draft agent and can't be undone. You may want to save the
draft agent to a version before calling this method.
Parameters | |
---|---|
Name | Description |
request | UpdateEnvironmentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Environment> | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
UpdateEnvironmentRequest request = new UpdateEnvironmentRequest
{
Environment = new gcdv::Environment(),
UpdateMask = new FieldMask(),
AllowLoadToDraftAndDiscardChanges = false,
};
// Make the request
gcdv::Environment response = await environmentsClient.UpdateEnvironmentAsync(request);
UpdateEnvironmentAsync(UpdateEnvironmentRequest, CancellationToken)
public virtual Task<Environment> UpdateEnvironmentAsync(UpdateEnvironmentRequest request, CancellationToken cancellationToken)
Updates the specified agent environment.
This method allows you to deploy new agent versions into the environment.
When an environment is pointed to a new agent version by setting
environment.agent_version
, the environment is temporarily set to the
LOADING
state. During that time, the environment continues serving the
previous version of the agent. After the new agent version is done loading,
the environment is set back to the RUNNING
state.
You can use "-" as Environment ID in environment name to update an agent
version in the default environment. WARNING: this will negate all recent
changes to the draft agent and can't be undone. You may want to save the
draft agent to a version before calling this method.
Parameters | |
---|---|
Name | Description |
request | UpdateEnvironmentRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Environment> | A Task containing the RPC response. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
UpdateEnvironmentRequest request = new UpdateEnvironmentRequest
{
Environment = new gcdv::Environment(),
UpdateMask = new FieldMask(),
AllowLoadToDraftAndDiscardChanges = false,
};
// Make the request
gcdv::Environment response = await environmentsClient.UpdateEnvironmentAsync(request);