DevCenterClient.GetProjectAsync Method

Definition

Overloads

GetProjectAsync(String, CancellationToken)

Gets a project.

GetProjectAsync(String, RequestContext)

[Protocol Method] Gets a project.

GetProjectAsync(String, CancellationToken)

Source:
DevCenterClient.cs

Gets a project.

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

Parameters

projectName
String

Name of the project.

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 GetProjectAsync.

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

Response<DevCenterProject> response = await client.GetProjectAsync("<projectName>");

This sample shows how to call GetProjectAsync with all parameters.

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

Response<DevCenterProject> response = await client.GetProjectAsync("<projectName>");

Applies to

GetProjectAsync(String, RequestContext)

Source:
DevCenterClient.cs
Source:
DevCenterClient.cs

[Protocol Method] Gets a project.

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

Parameters

projectName
String

Name of the project.

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 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 GetProjectAsync and parse the result.

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

Response response = await client.GetProjectAsync("<projectName>", null);

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

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

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

Response response = await client.GetProjectAsync("<projectName>", null);

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

Remarks

Below is the JSON schema for the response payload.

Response Body:

Schema for Project:

{
  name: string, # Optional. Name of the project
  description: string, # Optional. Description of the project.
}

Applies to