Class EnvironmentsClient (3.10.0)

public abstract class EnvironmentsClient

Environments client wrapper, for convenient use.

Inheritance

Object > EnvironmentsClient

Derived Types

Namespace

Google.Cloud.Dialogflow.V2

Assembly

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
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Environments scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual Environments.EnvironmentsClient GrpcClient { get; }

The underlying gRPC Environments client

Property Value
TypeDescription
Environments.EnvironmentsClient

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
TypeDescription
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
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
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
NameDescription
requestCreateEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Environment

The RPC response.

Example
// 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
NameDescription
requestCreateEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Environment>

A Task containing the RPC response.

Example
// 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
NameDescription
requestCreateEnvironmentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Environment>

A Task containing the RPC response.

Example
// 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
NameDescription
requestDeleteEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// 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
NameDescription
requestDeleteEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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
NameDescription
requestDeleteEnvironmentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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
NameDescription
requestGetEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Environment

The RPC response.

Example
// 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
NameDescription
requestGetEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Environment>

A Task containing the RPC response.

Example
// 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
NameDescription
requestGetEnvironmentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Environment>

A Task containing the RPC response.

Example
// 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
NameDescription
requestGetEnvironmentHistoryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry>

A pageable sequence of EnvironmentHistory.Types.Entry resources.

Example
// 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
NameDescription
requestGetEnvironmentHistoryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<EnvironmentHistory, EnvironmentHistory.Types.Entry>

A pageable asynchronous sequence of EnvironmentHistory.Types.Entry resources.

Example
// 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 = default(int? ), CallSettings callSettings = null)

Returns the list of all non-default environments of the specified agent.

Parameters
NameDescription
parentAgentName

Required. The agent to list all environments from. Format:

  • projects/{Project ID}/agent
  • projects/{Project ID}/locations/{Location ID}/agent
pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListEnvironmentsResponse, Environment>

A pageable sequence of Environment resources.

Example
// 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
NameDescription
requestListEnvironmentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListEnvironmentsResponse, Environment>

A pageable sequence of Environment resources.

Example
// 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 = default(int? ), CallSettings callSettings = null)

Returns the list of all non-default environments of the specified agent.

Parameters
NameDescription
parentString

Required. The agent to list all environments from. Format:

  • projects/{Project ID}/agent
  • projects/{Project ID}/locations/{Location ID}/agent
pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListEnvironmentsResponse, Environment>

A pageable sequence of Environment resources.

Example
// 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 = default(int? ), CallSettings callSettings = null)

Returns the list of all non-default environments of the specified agent.

Parameters
NameDescription
parentAgentName

Required. The agent to list all environments from. Format:

  • projects/{Project ID}/agent
  • projects/{Project ID}/locations/{Location ID}/agent
pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListEnvironmentsResponse, Environment>

A pageable asynchronous sequence of Environment resources.

Example
// 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
NameDescription
requestListEnvironmentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListEnvironmentsResponse, Environment>

A pageable asynchronous sequence of Environment resources.

Example
// 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 = default(int? ), CallSettings callSettings = null)

Returns the list of all non-default environments of the specified agent.

Parameters
NameDescription
parentString

Required. The agent to list all environments from. Format:

  • projects/{Project ID}/agent
  • projects/{Project ID}/locations/{Location ID}/agent
pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListEnvironmentsResponse, Environment>

A pageable asynchronous sequence of Environment resources.

Example
// 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
TypeDescription
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)

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
NameDescription
requestUpdateEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Environment

The RPC response.

Example
// 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
NameDescription
requestUpdateEnvironmentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Environment>

A Task containing the RPC response.

Example
// 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
NameDescription
requestUpdateEnvironmentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Environment>

A Task containing the RPC response.

Example
// 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);