Share via


DevBoxesClient.GetDevBox Method

Definition

Overloads

GetDevBox(String, String, String, CancellationToken)

Gets a Dev Box.

GetDevBox(String, String, String, RequestContext)

[Protocol Method] Gets a Dev Box

GetDevBox(String, String, String, CancellationToken)

Source:
DevBoxesClient.cs

Gets a Dev Box.

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

Parameters

projectName
String

Name of the project.

userId
String

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

devBoxName
String

Display name for the Dev Box.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

projectName, userId or devBoxName is null.

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

Examples

This sample shows how to call GetDevBox.

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

Response<DevBox> response = client.GetDevBox("<projectName>", "<userId>", "<devBoxName>");

This sample shows how to call GetDevBox with all parameters.

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

Response<DevBox> response = client.GetDevBox("<projectName>", "<userId>", "<devBoxName>");

Applies to

GetDevBox(String, String, String, RequestContext)

Source:
DevBoxesClient.cs
Source:
DevBoxesClient.cs

[Protocol Method] Gets a Dev Box

public virtual Azure.Response GetDevBox (string projectName, string userId, string devBoxName, Azure.RequestContext context);
abstract member GetDevBox : string * string * string * Azure.RequestContext -> Azure.Response
override this.GetDevBox : string * string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetDevBox (projectName As String, userId As String, devBoxName As String, context As RequestContext) As Response

Parameters

projectName
String

Name of the project.

userId
String

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

devBoxName
String

Display name for the Dev Box.

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

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

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

Response response = client.GetDevBox("<projectName>", "<userId>", "<devBoxName>", null);

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

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

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

Response response = client.GetDevBox("<projectName>", "<userId>", "<devBoxName>", null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("projectName").ToString());
Console.WriteLine(result.GetProperty("poolName").ToString());
Console.WriteLine(result.GetProperty("hibernateSupport").ToString());
Console.WriteLine(result.GetProperty("provisioningState").ToString());
Console.WriteLine(result.GetProperty("actionState").ToString());
Console.WriteLine(result.GetProperty("powerState").ToString());
Console.WriteLine(result.GetProperty("uniqueId").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());
Console.WriteLine(result.GetProperty("location").ToString());
Console.WriteLine(result.GetProperty("osType").ToString());
Console.WriteLine(result.GetProperty("user").ToString());
Console.WriteLine(result.GetProperty("hardwareProfile").GetProperty("skuName").ToString());
Console.WriteLine(result.GetProperty("hardwareProfile").GetProperty("vCPUs").ToString());
Console.WriteLine(result.GetProperty("hardwareProfile").GetProperty("memoryGB").ToString());
Console.WriteLine(result.GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString());
Console.WriteLine(result.GetProperty("imageReference").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("imageReference").GetProperty("version").ToString());
Console.WriteLine(result.GetProperty("imageReference").GetProperty("operatingSystem").ToString());
Console.WriteLine(result.GetProperty("imageReference").GetProperty("osBuildNumber").ToString());
Console.WriteLine(result.GetProperty("imageReference").GetProperty("publishedDate").ToString());
Console.WriteLine(result.GetProperty("createdTime").ToString());
Console.WriteLine(result.GetProperty("localAdministrator").ToString());

Applies to