Compartir a través de


AssetMappingsClient.Create Método

Definición

Asigna un recurso de origen en el recurso compartido enviado a un recurso de destino en el recurso compartido recibido.

public virtual Azure.Operation<BinaryData> Create (Azure.WaitUntil waitUntil, string receivedShareName, string assetMappingName, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member Create : Azure.WaitUntil * string * string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Operation<BinaryData>
override this.Create : Azure.WaitUntil * string * string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Operation<BinaryData>
Public Overridable Function Create (waitUntil As WaitUntil, receivedShareName As String, assetMappingName As String, content As RequestContent, Optional context As RequestContext = Nothing) As Operation(Of BinaryData)

Parámetros

waitUntil
WaitUntil

Completed si el método debe esperar a que se devuelva hasta que se haya completado la operación de larga duración en el servicio; Started si debe devolverse después de iniciar la operación. Para más información sobre las operaciones de larga duración, consulte Ejemplos de operaciones de azure.Core Long-Running.

receivedShareName
String

Nombre del recurso compartido recibido.

assetMappingName
String

Nombre de la asignación de recursos.

content
RequestContent

Contenido que se va a enviar como el cuerpo de la solicitud. Los detalles del esquema del cuerpo de la solicitud se encuentran en la sección Comentarios a continuación.

context
RequestContext

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

Devoluciones

del Operation<T> servicio que contendrá un BinaryData objeto una vez completada la operación asincrónica en el servicio. Los detalles del esquema del cuerpo para el valor final de la operación se encuentran en la sección Comentarios a continuación.

Excepciones

receivedShareName, assetMappingName o content es un valor null.

receivedShareName o assetMappingName 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 Create con los parámetros necesarios y el contenido de la solicitud, y cómo analizar el resultado.

var credential = new DefaultAzureCredential();
var client = new AssetMappingsClient("<https://my-service.azure.com>", credential);

var data = new {
    kind = "AdlsGen2Account",
    properties = new {
        assetId = "<73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a>",
        containerName = "<AdlsGen2AccountAssetMappingPropertiesContainerName>",
        folder = "<AdlsGen2AccountAssetMappingPropertiesFolder>",
        storageAccountResourceId = "<AdlsGen2AccountAssetMappingPropertiesStorageAccountResourceId>",
    },
};

var operation = client.Create(WaitUntil.Completed, "<receivedShareName>", "<assetMappingName>", RequestContent.Create(data));

BinaryData data = operation.WaitForCompletion();
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.ToString());

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

var credential = new DefaultAzureCredential();
var client = new AssetMappingsClient("<https://my-service.azure.com>", credential);

var data = new {
    kind = "AdlsGen2Account",
    properties = new {
        assetId = "<73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a>",
        containerName = "<AdlsGen2AccountAssetMappingPropertiesContainerName>",
        folder = "<AdlsGen2AccountAssetMappingPropertiesFolder>",
        mountPath = "<AdlsGen2AccountAssetMappingPropertiesMountPath>",
        storageAccountResourceId = "<AdlsGen2AccountAssetMappingPropertiesStorageAccountResourceId>",
    },
};

var operation = client.Create(WaitUntil.Completed, "<receivedShareName>", "<assetMappingName>", RequestContent.Create(data));

BinaryData data = operation.WaitForCompletion();
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("kind").ToString());

Comentarios

Creación de una asignación de recursos en un recurso compartido recibido

A continuación se muestra el esquema JSON para las cargas de solicitud y respuesta.

Cuerpo de la solicitud:

Este método toma uno de los objetos JSON siguientes como una carga útil. Seleccione un objeto JSON para ver el esquema.

AdlsGen2AccountAssetMapping Esquema para AdlsGen2AccountAssetMapping:
{
              kind: AdlsGen2Account, # Required. Types of asset mapping.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                assetId: AdlsGen2AccountAssetMappingPropertiesAssetId, # Required. The id of the sender asset.
                assetMappingStatus: "Ok" | "Broken", # Optional. State of asset mapping
                containerName: string, # Required. Name of the container to received the shared paths.
                folder: string, # Required. Folder under which the shared paths will be reflected.
                location: string, # Optional. Location of the receiver storage account.
                mountPath: string, # Optional. Optional mount path for the shared paths.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                storageAccountResourceId: string, # Required. Resource id of the receiver storage account.
              }, # Required. Properties of the adls gen2 storage account asset mapping.
            }
~+ 1 objetos
JSON más BlobAccountAssetMapping Esquema para BlobAccountAssetMapping:
{
              kind: BlobAccount, # Required. Types of asset mapping.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                assetId: BlobAccountAssetMappingPropertiesAssetId, # Required. The id of the sender asset.
                assetMappingStatus: "Ok" | "Broken", # Optional. State of asset mapping
                containerName: string, # Required. Name of the container to received the shared paths.
                folder: string, # Required. Folder under which the shared paths will be reflected.
                location: string, # Optional. Location of the receiver storage account.
                mountPath: string, # Optional. Optional mount path for the shared paths.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                storageAccountResourceId: string, # Required. Resource id of the receiver storage account.
              }, # Required. Properties of the blob storage account asset mapping.
            }

Cuerpo de la respuesta:

Este método toma uno de los objetos JSON siguientes como una carga útil. Seleccione un objeto JSON para ver el esquema.

AdlsGen2AccountAssetMapping Esquema para AdlsGen2AccountAssetMapping:
{
              kind: AdlsGen2Account, # Required. Types of asset mapping.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                assetId: AdlsGen2AccountAssetMappingPropertiesAssetId, # Required. The id of the sender asset.
                assetMappingStatus: "Ok" | "Broken", # Optional. State of asset mapping
                containerName: string, # Required. Name of the container to received the shared paths.
                folder: string, # Required. Folder under which the shared paths will be reflected.
                location: string, # Optional. Location of the receiver storage account.
                mountPath: string, # Optional. Optional mount path for the shared paths.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                storageAccountResourceId: string, # Required. Resource id of the receiver storage account.
              }, # Required. Properties of the adls gen2 storage account asset mapping.
            }
~+ 1 objetos
JSON más BlobAccountAssetMapping Esquema para BlobAccountAssetMapping:
{
              kind: BlobAccount, # Required. Types of asset mapping.
              id: string, # Optional. The resource id of the resource.
              name: string, # Optional. Name of the resource.
              type: string, # Optional. Type of the resource.
              properties: {
                assetId: BlobAccountAssetMappingPropertiesAssetId, # Required. The id of the sender asset.
                assetMappingStatus: "Ok" | "Broken", # Optional. State of asset mapping
                containerName: string, # Required. Name of the container to received the shared paths.
                folder: string, # Required. Folder under which the shared paths will be reflected.
                location: string, # Optional. Location of the receiver storage account.
                mountPath: string, # Optional. Optional mount path for the shared paths.
                provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
                storageAccountResourceId: string, # Required. Resource id of the receiver storage account.
              }, # Required. Properties of the blob storage account asset mapping.
            }

Se aplica a