AssetMappingsClient.Create Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Mapeia um ativo de origem no compartilhamento enviado para um ativo de destino no compartilhamento recebido.
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 se o método deve aguardar para retornar até que a operação de execução prolongada seja concluída no serviço; Started se ele deve retornar depois de iniciar a operação. Para obter mais informações sobre operações de execução prolongada, consulte Exemplos de operação de Long-Running do Azure.Core.
- receivedShareName
- String
O nome do compartilhamento recebido.
- assetMappingName
- String
O nome do mapeamento de ativos.
- content
- RequestContent
O conteúdo a ser enviado como o corpo da solicitação. Os detalhes do esquema do corpo da solicitação estão na seção Comentários abaixo.
- context
- RequestContext
O contexto de solicitação, que pode substituir os comportamentos padrão do pipeline do cliente por chamada.
Retornos
O Operation<T> do serviço que conterá um BinaryData objeto depois que a operação assíncrona no serviço for concluída. Os detalhes do esquema do corpo do valor final da operação estão na seção Comentários abaixo.
Exceções
receivedShareName
, assetMappingName
ou content
é nulo.
receivedShareName
ou assetMappingName
é uma cadeia de caracteres vazia e esperava-se que não estivesse vazia.
O serviço retornou um código de status sem êxito.
Exemplos
Este exemplo mostra como chamar Criar com parâmetros necessários e solicitar conteúdo e como analisar o 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());
Este exemplo mostra como chamar Criar com todos os parâmetros e solicitar conteúdo e como analisar o 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());
Comentários
Criar um mapeamento de ativos em um compartilhamento recebido
Abaixo está o esquema JSON para as cargas de solicitação e resposta.
Corpo da solicitação:
Esse método usa um dos objetos JSON abaixo como uma carga. Selecione um objeto JSON para exibir o esquema para isso.
AdlsGen2AccountAssetMapping
Esquema paraAdlsGen2AccountAssetMapping
:{
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.
}
~+ Mais 1 objeto
BlobAccountAssetMapping
Esquema paraBlobAccountAssetMapping
:{
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.
}
Corpo da resposta:
Esse método usa um dos objetos JSON abaixo como uma carga. Selecione um objeto JSON para exibir o esquema para isso.
AdlsGen2AccountAssetMapping
Esquema paraAdlsGen2AccountAssetMapping
:{
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.
}
~+ Mais 1 objeto
BlobAccountAssetMapping
Esquema paraBlobAccountAssetMapping
:{
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.
}
Aplica-se a
Azure SDK for .NET