Google Cloud Dialogflow v2beta1 API - Class EnvironmentsClient (1.0.0-beta21)

public abstract class EnvironmentsClient

Reference documentation and code samples for the Google Cloud Dialogflow v2beta1 API class EnvironmentsClient.

Environments client wrapper, for convenient use.

Inheritance

object > EnvironmentsClient

Derived Types

Namespace

Google.Cloud.Dialogflow.V2Beta1

Assembly

Google.Cloud.Dialogflow.V2Beta1.dll

Remarks

Service for managing [Environments][google.cloud.dialogflow.v2beta1.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
IReadOnlyListstring
Remarks

GrpcClient

public virtual Environments.EnvironmentsClient GrpcClient { get; }

The underlying gRPC Environments client

Property Value
Type Description
EnvironmentsEnvironmentsClient

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)

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
TaskEnvironmentsClient

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.

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

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
TaskEnvironment

A Task containing the RPC response.

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

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
TaskEnvironment

A Task containing the RPC response.

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

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.

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

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.

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

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.

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

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.

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

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
TaskEnvironment

A Task containing the RPC response.

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

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
TaskEnvironment

A Task containing the RPC response.

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

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
PagedEnumerableEnvironmentHistoryEnvironmentHistoryTypesEntry

A pageable sequence of EnvironmentHistory.Types.Entry resources.

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

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
PagedAsyncEnumerableEnvironmentHistoryEnvironmentHistoryTypesEntry

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

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

public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(AgentName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent AgentName

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

  • projects/<Project ID>/agent
  • projects/<Project ID>/locations/<Location ID>/agent
pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListEnvironmentsResponseEnvironment

A pageable sequence of Environment resources.

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

public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(ListEnvironmentsRequest request, CallSettings callSettings = null)

Returns the list of all non-draft 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
PagedEnumerableListEnvironmentsResponseEnvironment

A pageable sequence of Environment resources.

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

public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent string

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

  • projects/<Project ID>/agent
  • projects/<Project ID>/locations/<Location ID>/agent
pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListEnvironmentsResponseEnvironment

A pageable sequence of Environment resources.

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

public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(AgentName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent AgentName

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

  • projects/<Project ID>/agent
  • projects/<Project ID>/locations/<Location ID>/agent
pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListEnvironmentsResponseEnvironment

A pageable asynchronous sequence of Environment resources.

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

public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(ListEnvironmentsRequest request, CallSettings callSettings = null)

Returns the list of all non-draft 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
PagedAsyncEnumerableListEnvironmentsResponseEnvironment

A pageable asynchronous sequence of Environment resources.

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

public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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

Parameters
Name Description
parent string

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

  • projects/<Project ID>/agent
  • projects/<Project ID>/locations/<Location ID>/agent
pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListEnvironmentsResponseEnvironment

A pageable asynchronous sequence of Environment resources.

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

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.

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 keeps on 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 version in "draft" environment. WARNING: this will negate all recent changes to draft and can't be undone. You may want to save the draft to a version before calling this function.

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.

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

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 keeps on 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 version in "draft" environment. WARNING: this will negate all recent changes to draft and can't be undone. You may want to save the draft to a version before calling this function.

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
TaskEnvironment

A Task containing the RPC response.

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

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 keeps on 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 version in "draft" environment. WARNING: this will negate all recent changes to draft and can't be undone. You may want to save the draft to a version before calling this function.

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
TaskEnvironment

A Task containing the RPC response.

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