Freigeben über


DeploymentEnvironmentsClient.GetEnvironmentDefinitionAsync Method

Definition

Overloads

GetEnvironmentDefinitionAsync(String, String, String, RequestContext)

[Protocol Method] Get an environment definition from a catalog.

GetEnvironmentDefinitionAsync(String, String, String, CancellationToken)

Get an environment definition from a catalog.

GetEnvironmentDefinitionAsync(String, String, String, RequestContext)

Source:
DeploymentEnvironmentsClient.cs
Source:
DeploymentEnvironmentsClient.cs

[Protocol Method] Get an environment definition from a catalog.

public virtual System.Threading.Tasks.Task<Azure.Response> GetEnvironmentDefinitionAsync (string projectName, string catalogName, string definitionName, Azure.RequestContext context);
abstract member GetEnvironmentDefinitionAsync : string * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetEnvironmentDefinitionAsync : string * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetEnvironmentDefinitionAsync (projectName As String, catalogName As String, definitionName As String, context As RequestContext) As Task(Of Response)

Parameters

projectName
String

Name of the project.

catalogName
String

Name of the catalog.

definitionName
String

Name of the environment definition.

context
RequestContext

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

Returns

The response returned from the service.

Exceptions

projectName, catalogName or definitionName is null.

projectName, catalogName or definitionName 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 GetEnvironmentDefinitionAsync and parse the result.

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

Response response = await client.GetEnvironmentDefinitionAsync("<projectName>", "<catalogName>", "<definitionName>", null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("catalogName").ToString());

This sample shows how to call GetEnvironmentDefinitionAsync 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);

Response response = await client.GetEnvironmentDefinitionAsync("<projectName>", "<catalogName>", "<definitionName>", null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("catalogName").ToString());
Console.WriteLine(result.GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString());
Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString());
Console.WriteLine(result.GetProperty("parametersSchema").ToString());
Console.WriteLine(result.GetProperty("templatePath").ToString());

Applies to

GetEnvironmentDefinitionAsync(String, String, String, CancellationToken)

Source:
DeploymentEnvironmentsClient.cs

Get an environment definition from a catalog.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Developer.DevCenter.Models.EnvironmentDefinition>> GetEnvironmentDefinitionAsync (string projectName, string catalogName, string definitionName, System.Threading.CancellationToken cancellationToken = default);
abstract member GetEnvironmentDefinitionAsync : string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Developer.DevCenter.Models.EnvironmentDefinition>>
override this.GetEnvironmentDefinitionAsync : string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Developer.DevCenter.Models.EnvironmentDefinition>>
Public Overridable Function GetEnvironmentDefinitionAsync (projectName As String, catalogName As String, definitionName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of EnvironmentDefinition))

Parameters

projectName
String

Name of the project.

catalogName
String

Name of the catalog.

definitionName
String

Name of the environment definition.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

projectName, catalogName or definitionName is null.

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

Examples

This sample shows how to call GetEnvironmentDefinitionAsync.

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

Response<EnvironmentDefinition> response = await client.GetEnvironmentDefinitionAsync("<projectName>", "<catalogName>", "<definitionName>");

This sample shows how to call GetEnvironmentDefinitionAsync with all parameters.

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

Response<EnvironmentDefinition> response = await client.GetEnvironmentDefinitionAsync("<projectName>", "<catalogName>", "<definitionName>");

Applies to