Freigeben über


DeploymentEnvironmentsClient.GetAllEnvironmentsAsync Method

Definition

Overloads

GetAllEnvironmentsAsync(String, Nullable<Int32>, RequestContext)

[Protocol Method] Lists the environments for a project.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
GetAllEnvironmentsAsync(String, RequestContext)

[Protocol Method] Lists the environments for a project.

GetAllEnvironmentsAsync(String, CancellationToken)

Lists the environments for a project.

GetAllEnvironmentsAsync(String, Nullable<Int32>, RequestContext)

Source:
DeploymentEnvironmentsClient.cs

[Protocol Method] Lists the environments for a project.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.AsyncPageable<BinaryData> GetAllEnvironmentsAsync (string projectName, int? maxCount, Azure.RequestContext context);
abstract member GetAllEnvironmentsAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetAllEnvironmentsAsync : string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetAllEnvironmentsAsync (projectName As String, maxCount As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

projectName
String

The DevCenter Project upon which to execute operations.

maxCount
Nullable<Int32>

The maximum number of resources to return from the operation. Example: 'top=10'.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

projectName is null.

projectName is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetAllEnvironmentsAsync and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential);

await foreach (BinaryData item in client.GetAllEnvironmentsAsync("<projectName>", null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("environmentType").ToString());
    Console.WriteLine(result.GetProperty("catalogName").ToString());
    Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString());
}

This sample shows how to call GetAllEnvironmentsAsync with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential);

await foreach (BinaryData item in client.GetAllEnvironmentsAsync("<projectName>", 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("parameters").ToString());
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("environmentType").ToString());
    Console.WriteLine(result.GetProperty("user").ToString());
    Console.WriteLine(result.GetProperty("provisioningState").ToString());
    Console.WriteLine(result.GetProperty("resourceGroupId").ToString());
    Console.WriteLine(result.GetProperty("catalogName").ToString());
    Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
}

Applies to

GetAllEnvironmentsAsync(String, RequestContext)

Source:
DeploymentEnvironmentsClient.cs

[Protocol Method] Lists the environments for a project.

public virtual Azure.AsyncPageable<BinaryData> GetAllEnvironmentsAsync (string projectName, Azure.RequestContext context);
abstract member GetAllEnvironmentsAsync : string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetAllEnvironmentsAsync : string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetAllEnvironmentsAsync (projectName As String, context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

projectName
String

The DevCenter Project upon which to execute operations.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

projectName is null.

projectName is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetAllEnvironmentsAsync and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential);

await foreach (BinaryData item in client.GetAllEnvironmentsAsync("<projectName>", null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("environmentType").ToString());
    Console.WriteLine(result.GetProperty("catalogName").ToString());
    Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString());
}

This sample shows how to call GetAllEnvironmentsAsync with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential);

await foreach (BinaryData item in client.GetAllEnvironmentsAsync("<projectName>", null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("parameters").GetProperty("<key>").ToString());
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("environmentType").ToString());
    Console.WriteLine(result.GetProperty("user").ToString());
    Console.WriteLine(result.GetProperty("provisioningState").ToString());
    Console.WriteLine(result.GetProperty("resourceGroupId").ToString());
    Console.WriteLine(result.GetProperty("catalogName").ToString());
    Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
    Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
}

Applies to

GetAllEnvironmentsAsync(String, CancellationToken)

Source:
DeploymentEnvironmentsClient.cs

Lists the environments for a project.

public virtual Azure.AsyncPageable<Azure.Developer.DevCenter.Models.DevCenterEnvironment> GetAllEnvironmentsAsync (string projectName, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAllEnvironmentsAsync : string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Developer.DevCenter.Models.DevCenterEnvironment>
override this.GetAllEnvironmentsAsync : string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Developer.DevCenter.Models.DevCenterEnvironment>
Public Overridable Function GetAllEnvironmentsAsync (projectName As String, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of DevCenterEnvironment)

Parameters

projectName
String

The DevCenter Project upon which to execute operations.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

projectName is null.

projectName is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetAllEnvironmentsAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential);

await foreach (DevCenterEnvironment item in client.GetAllEnvironmentsAsync("<projectName>"))
{
}

This sample shows how to call GetAllEnvironmentsAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential);

await foreach (DevCenterEnvironment item in client.GetAllEnvironmentsAsync("<projectName>"))
{
}

Applies to