Class EnvironmentsClient
Environments client wrapper, for convenient use.
Namespace: Google.Cloud.Dialogflow.V2
Assembly: Google.Cloud.Dialogflow.V2.dll
Syntax
public abstract class EnvironmentsClient
Remarks
Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
Properties
DefaultEndpoint
The default endpoint for the Environments service, which is a host of "dialogflow.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
Type | Description |
---|---|
string |
DefaultScopes
The default Environments scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default Environments scopes are:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/dialogflow
GrpcClient
The underlying gRPC Environments client
Declaration
public virtual Environments.EnvironmentsClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
Environments.EnvironmentsClient |
LocationsClient
The Google.Cloud.Location.LocationsClient associated with this client.
Declaration
public virtual LocationsClient LocationsClient { get; }
Property Value
Type | Description |
---|---|
LocationsClient |
ServiceMetadata
The service metadata associated with this client type.
Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
Type | Description |
---|---|
ServiceMetadata |
Methods
Create()
Synchronously creates a EnvironmentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EnvironmentsClientBuilder.
Declaration
public static EnvironmentsClient Create()
Returns
Type | Description |
---|---|
EnvironmentsClient | The created EnvironmentsClient. |
CreateAsync(CancellationToken)
Asynchronously creates a EnvironmentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EnvironmentsClientBuilder.
Declaration
public static Task<EnvironmentsClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | 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)
Creates an agent environment.
Declaration
public virtual Environment CreateEnvironment(CreateEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CreateEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
gcdv::CreateEnvironmentRequest request = new gcdv::CreateEnvironmentRequest
{
ParentAsAgentName = gcdv::AgentName.FromProject("[PROJECT]"),
Environment = new gcdv::Environment(),
EnvironmentId = "",
};
// Make the request
gcdv::Environment response = environmentsClient.CreateEnvironment(request);
CreateEnvironmentAsync(CreateEnvironmentRequest, CallSettings)
Creates an agent environment.
Declaration
public virtual Task<Environment> CreateEnvironmentAsync(CreateEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CreateEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::CreateEnvironmentRequest request = new gcdv::CreateEnvironmentRequest
{
ParentAsAgentName = gcdv::AgentName.FromProject("[PROJECT]"),
Environment = new gcdv::Environment(),
EnvironmentId = "",
};
// Make the request
gcdv::Environment response = await environmentsClient.CreateEnvironmentAsync(request);
CreateEnvironmentAsync(CreateEnvironmentRequest, CancellationToken)
Creates an agent environment.
Declaration
public virtual Task<Environment> CreateEnvironmentAsync(CreateEnvironmentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CreateEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::CreateEnvironmentRequest request = new gcdv::CreateEnvironmentRequest
{
ParentAsAgentName = gcdv::AgentName.FromProject("[PROJECT]"),
Environment = new gcdv::Environment(),
EnvironmentId = "",
};
// Make the request
gcdv::Environment response = await environmentsClient.CreateEnvironmentAsync(request);
DeleteEnvironment(DeleteEnvironmentRequest, CallSettings)
Deletes the specified agent environment.
Declaration
public virtual void DeleteEnvironment(DeleteEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteEnvironmentRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
gcdv::DeleteEnvironmentRequest request = new gcdv::DeleteEnvironmentRequest
{
EnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
environmentsClient.DeleteEnvironment(request);
DeleteEnvironmentAsync(DeleteEnvironmentRequest, CallSettings)
Deletes the specified agent environment.
Declaration
public virtual Task DeleteEnvironmentAsync(DeleteEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::DeleteEnvironmentRequest request = new gcdv::DeleteEnvironmentRequest
{
EnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
await environmentsClient.DeleteEnvironmentAsync(request);
DeleteEnvironmentAsync(DeleteEnvironmentRequest, CancellationToken)
Deletes the specified agent environment.
Declaration
public virtual Task DeleteEnvironmentAsync(DeleteEnvironmentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DeleteEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::DeleteEnvironmentRequest request = new gcdv::DeleteEnvironmentRequest
{
EnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
await environmentsClient.DeleteEnvironmentAsync(request);
GetEnvironment(GetEnvironmentRequest, CallSettings)
Retrieves the specified agent environment.
Declaration
public virtual Environment GetEnvironment(GetEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
gcdv::GetEnvironmentRequest request = new gcdv::GetEnvironmentRequest
{
EnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
gcdv::Environment response = environmentsClient.GetEnvironment(request);
GetEnvironmentAsync(GetEnvironmentRequest, CallSettings)
Retrieves the specified agent environment.
Declaration
public virtual Task<Environment> GetEnvironmentAsync(GetEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::GetEnvironmentRequest request = new gcdv::GetEnvironmentRequest
{
EnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
gcdv::Environment response = await environmentsClient.GetEnvironmentAsync(request);
GetEnvironmentAsync(GetEnvironmentRequest, CancellationToken)
Retrieves the specified agent environment.
Declaration
public virtual Task<Environment> GetEnvironmentAsync(GetEnvironmentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::GetEnvironmentRequest request = new gcdv::GetEnvironmentRequest
{
EnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
gcdv::Environment response = await environmentsClient.GetEnvironmentAsync(request);
GetEnvironmentHistory(GetEnvironmentHistoryRequest, CallSettings)
Gets the history of the specified environment.
Declaration
public virtual PagedEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> GetEnvironmentHistory(GetEnvironmentHistoryRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetEnvironmentHistoryRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
gcdv::GetEnvironmentHistoryRequest request = new gcdv::GetEnvironmentHistoryRequest
{
ParentAsEnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
PagedEnumerable<gcdv::EnvironmentHistory, gcdv::EnvironmentHistory.Types.Entry> response = environmentsClient.GetEnvironmentHistory(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (gcdv::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 (gcdv::EnvironmentHistory page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::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<gcdv::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 (gcdv::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)
Gets the history of the specified environment.
Declaration
public virtual PagedAsyncEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry> GetEnvironmentHistoryAsync(GetEnvironmentHistoryRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetEnvironmentHistoryRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::GetEnvironmentHistoryRequest request = new gcdv::GetEnvironmentHistoryRequest
{
ParentAsEnvironmentName = gcdv::EnvironmentName.FromProjectEnvironment("[PROJECT]", "[ENVIRONMENT]"),
};
// Make the request
PagedAsyncEnumerable<gcdv::EnvironmentHistory, gcdv::EnvironmentHistory.Types.Entry> response = environmentsClient.GetEnvironmentHistoryAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gcdv::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((gcdv::EnvironmentHistory page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::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<gcdv::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 (gcdv::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, int?, CallSettings)
Returns the list of all non-default environments of the specified agent.
Declaration
public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(AgentName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
AgentName | parent | Required. The agent to list all environments from. Format:
|
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
gcdv::AgentName parent = gcdv::AgentName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<gcdv::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 (gcdv::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)
Returns the list of all non-default environments of the specified agent.
Declaration
public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(ListEnvironmentsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListEnvironmentsRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
gcdv::ListEnvironmentsRequest request = new gcdv::ListEnvironmentsRequest
{
ParentAsAgentName = gcdv::AgentName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<gcdv::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 (gcdv::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, int?, CallSettings)
Returns the list of all non-default environments of the specified agent.
Declaration
public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The agent to list all environments from. Format:
|
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent";
// Make the request
PagedEnumerable<gcdv::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 (gcdv::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, int?, CallSettings)
Returns the list of all non-default environments of the specified agent.
Declaration
public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(AgentName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
AgentName | parent | Required. The agent to list all environments from. Format:
|
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::AgentName parent = gcdv::AgentName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<gcdv::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((gcdv::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)
Returns the list of all non-default environments of the specified agent.
Declaration
public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(ListEnvironmentsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListEnvironmentsRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::ListEnvironmentsRequest request = new gcdv::ListEnvironmentsRequest
{
ParentAsAgentName = gcdv::AgentName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<gcdv::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((gcdv::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, int?, CallSettings)
Returns the list of all non-default environments of the specified agent.
Declaration
public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The agent to list all environments from. Format:
|
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent";
// Make the request
PagedAsyncEnumerable<gcdv::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((gcdv::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()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous shutdown operation. |
Remarks
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)
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.
Declaration
public virtual Environment UpdateEnvironment(UpdateEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
UpdateEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = gcdv::EnvironmentsClient.Create();
// Initialize request argument(s)
gcdv::UpdateEnvironmentRequest request = new gcdv::UpdateEnvironmentRequest
{
Environment = new gcdv::Environment(),
UpdateMask = new FieldMask(),
AllowLoadToDraftAndDiscardChanges = false,
};
// Make the request
gcdv::Environment response = environmentsClient.UpdateEnvironment(request);
UpdateEnvironmentAsync(UpdateEnvironmentRequest, CallSettings)
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.
Declaration
public virtual Task<Environment> UpdateEnvironmentAsync(UpdateEnvironmentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
UpdateEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::UpdateEnvironmentRequest request = new gcdv::UpdateEnvironmentRequest
{
Environment = new gcdv::Environment(),
UpdateMask = new FieldMask(),
AllowLoadToDraftAndDiscardChanges = false,
};
// Make the request
gcdv::Environment response = await environmentsClient.UpdateEnvironmentAsync(request);
UpdateEnvironmentAsync(UpdateEnvironmentRequest, 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.
Declaration
public virtual Task<Environment> UpdateEnvironmentAsync(UpdateEnvironmentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
UpdateEnvironmentRequest | request | 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. |
Sample code
// Create client
gcdv::EnvironmentsClient environmentsClient = await gcdv::EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
gcdv::UpdateEnvironmentRequest request = new gcdv::UpdateEnvironmentRequest
{
Environment = new gcdv::Environment(),
UpdateMask = new FieldMask(),
AllowLoadToDraftAndDiscardChanges = false,
};
// Make the request
gcdv::Environment response = await environmentsClient.UpdateEnvironmentAsync(request);