Compartir a través de


DevBoxesClient.GetDevBoxesAsync Método

Definición

[Método Protocol] Enumera los cuadros de desarrollo del proyecto para un usuario determinado.

  • Este método de protocolo permite la creación explícita de la solicitud y el procesamiento de la respuesta para escenarios avanzados.
public virtual Azure.AsyncPageable<BinaryData> GetDevBoxesAsync (string projectName, string userId, string filter, int? maxCount, Azure.RequestContext context);
abstract member GetDevBoxesAsync : string * string * string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetDevBoxesAsync : string * string * string * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetDevBoxesAsync (projectName As String, userId As String, filter As String, maxCount As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)

Parámetros

projectName
String

Proyecto de DevCenter en el que se van a ejecutar las operaciones.

userId
String

Identificador de objeto de AAD del usuario. Si value es "me", la identidad se toma del contexto de autenticación.

filter
String

Una cláusula de filtro de OData que se va a aplicar a la operación.

maxCount
Nullable<Int32>

Número máximo de recursos que se van a devolver de la operación. Ejemplo: 'top=10'.

context
RequestContext

Contexto de solicitud, que puede invalidar los comportamientos predeterminados de la canalización de cliente por llamada.

Devoluciones

del AsyncPageable<T> servicio que contiene una lista de BinaryData objetos. Los detalles del esquema del cuerpo de cada elemento de la colección se encuentran en la sección Comentarios a continuación.

Excepciones

projectName o userId es null.

projectName o userId es una cadena vacía y se espera que no esté vacía.

El servicio devolvió un código de estado no correcto.

Ejemplos

En este ejemplo se muestra cómo llamar a GetDevBoxesAsync y analizar el resultado.

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

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

En este ejemplo se muestra cómo llamar a GetDevBoxesAsync con todos los parámetros y analizar el resultado.

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

await foreach (BinaryData item in client.GetDevBoxesAsync("<projectName>", "<userId>", "<filter>", 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).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());
}

Se aplica a