DeploymentEnvironmentsClient.GetEnvironments Method

Definition

Overloads

GetEnvironments(String, String, RequestContext)

[Protocol Method] Lists the environments for a project and user.

GetEnvironments(String, String, CancellationToken)

Lists the environments for a project and user.

GetEnvironments(String, String, Nullable<Int32>, RequestContext)

[Protocol Method] Lists the environments for a project and user.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.

GetEnvironments(String, String, RequestContext)

Source:
DeploymentEnvironmentsClient.cs

[Protocol Method] Lists the environments for a project and user.

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

Parameters

projectName
String

The DevCenter Project upon which to execute operations.

userId
String

The AAD object id of the user. If value is 'me', the identity is taken from the authentication context.

context
RequestContext

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

Returns

The Pageable<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 or userId is null.

projectName or userId 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 GetEnvironments and parse the result.

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

foreach (BinaryData item in client.GetEnvironments("<projectName>", "<userId>", 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 GetEnvironments 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);

foreach (BinaryData item in client.GetEnvironments("<projectName>", "<userId>", 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

GetEnvironments(String, String, CancellationToken)

Source:
DeploymentEnvironmentsClient.cs

Lists the environments for a project and user.

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

Parameters

projectName
String

The DevCenter Project upon which to execute operations.

userId
String

The AAD object id of the user. If value is 'me', the identity is taken from the authentication context.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

projectName or userId is null.

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

Examples

This sample shows how to call GetEnvironments.

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

foreach (DevCenterEnvironment item in client.GetEnvironments("<projectName>", "<userId>"))
{
}

This sample shows how to call GetEnvironments with all parameters.

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

foreach (DevCenterEnvironment item in client.GetEnvironments("<projectName>", "<userId>"))
{
}

Applies to

GetEnvironments(String, String, Nullable<Int32>, RequestContext)

Source:
DeploymentEnvironmentsClient.cs

[Protocol Method] Lists the environments for a project and user.

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

Parameters

projectName
String

The DevCenter Project upon which to execute operations.

userId
String

The AAD object id of the user. If value is 'me', the identity is taken from the authentication context.

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 Pageable<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 or userId is null.

projectName or userId 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 GetEnvironments and parse the result.

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

foreach (BinaryData item in client.GetEnvironments("<projectName>", "<userId>", 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 GetEnvironments 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);

foreach (BinaryData item in client.GetEnvironments("<projectName>", "<userId>", 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