AssetsClient.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.
Adiciona um novo ativo a um compartilhamento existente.
public virtual Azure.Operation<BinaryData> Create (Azure.WaitUntil waitUntil, string sentShareName, string assetName, 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, sentShareName As String, assetName 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 longa execução, consulte Exemplos de operação de Long-Running do Azure.Core.
- sentShareName
- String
O nome do compartilhamento enviado.
- assetName
- String
O nome do ativo.
- 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
sentShareName
, assetName
ou content
é nulo.
sentShareName
ou assetName
é 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 os parâmetros necessários e solicitar conteúdo e analisar o resultado.
var credential = new DefaultAzureCredential();
var client = new AssetsClient("<https://my-service.azure.com>", credential);
var data = new {
kind = "AdlsGen2Account",
properties = new {
paths = new[] {
new {
containerName = "<StorageAccountPathContainerName>",
receiverPath = "<StorageAccountPathReceiverPath>",
senderPath = "<StorageAccountPathSenderPath>",
}
},
receiverAssetName = "<AdlsGen2AccountAssetPropertiesReceiverAssetName>",
storageAccountResourceId = "<AdlsGen2AccountAssetPropertiesStorageAccountResourceId>",
},
};
var operation = client.Create(WaitUntil.Completed, "<sentShareName>", "<assetName>", 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 ativo em um compartilhamento enviado
Abaixo está o esquema JSON para os conteúdos de solicitação e resposta.
Corpo da solicitação:
Esse método usa um dos objetos JSON abaixo como um conteúdo. Selecione um objeto JSON para exibir o esquema para isso.
AdlsGen2AccountAsset
Esquema paraAdlsGen2AccountAsset
:{
kind: AdlsGen2Account, # Required. The types of asset.
id: string, # Optional. The resource id of the resource.
name: string, # Optional. Name of the resource.
type: string, # Optional. Type of the resource.
properties: {
location: string, # Optional. Location of the adls gen2 storage account.
paths: [
{
containerName: string, # Required. Gets or sets the container name.
receiverPath: string, # Optional. Gets or sets the path on the receiver side where the asset is to be mapped.
senderPath: string, # Optional. Gets or sets the path to file/folder within the container to be shared.
}
], # Required. A list of adls gen2 storage account paths to be shared.
provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
receiverAssetName: string, # Required. Name of the asset for the receiver.
storageAccountResourceId: string, # Required. Resource id of the adls gen2 storage account.
}, # Required. Adls gen 2 account asset properties
}
~+ mais 1 objeto
BlobAccountAsset
Esquema paraBlobAccountAsset
:{
kind: BlobAccount, # Required. The types of asset.
id: string, # Optional. The resource id of the resource.
name: string, # Optional. Name of the resource.
type: string, # Optional. Type of the resource.
properties: {
location: string, # Optional. Location of the blob storage account.
paths: [
{
containerName: string, # Required. Gets or sets the container name.
receiverPath: string, # Optional. Gets or sets the path on the receiver side where the asset is to be mapped.
senderPath: string, # Optional. Gets or sets the path to file/folder within the container to be shared.
}
], # Required. A list of blob storage account paths to be shared.
provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
receiverAssetName: string, # Required. Name of the asset for the receiver.
storageAccountResourceId: string, # Required. Resource id of the blob storage account.
}, # Required. Blob storage account asset properties
}
Corpo da resposta:
Esse método usa um dos objetos JSON abaixo como um conteúdo. Selecione um objeto JSON para exibir o esquema para isso.
AdlsGen2AccountAsset
Esquema paraAdlsGen2AccountAsset
:{
kind: AdlsGen2Account, # Required. The types of asset.
id: string, # Optional. The resource id of the resource.
name: string, # Optional. Name of the resource.
type: string, # Optional. Type of the resource.
properties: {
location: string, # Optional. Location of the adls gen2 storage account.
paths: [
{
containerName: string, # Required. Gets or sets the container name.
receiverPath: string, # Optional. Gets or sets the path on the receiver side where the asset is to be mapped.
senderPath: string, # Optional. Gets or sets the path to file/folder within the container to be shared.
}
], # Required. A list of adls gen2 storage account paths to be shared.
provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
receiverAssetName: string, # Required. Name of the asset for the receiver.
storageAccountResourceId: string, # Required. Resource id of the adls gen2 storage account.
}, # Required. Adls gen 2 account asset properties
}
~+ mais 1 objeto
BlobAccountAsset
Esquema paraBlobAccountAsset
:{
kind: BlobAccount, # Required. The types of asset.
id: string, # Optional. The resource id of the resource.
name: string, # Optional. Name of the resource.
type: string, # Optional. Type of the resource.
properties: {
location: string, # Optional. Location of the blob storage account.
paths: [
{
containerName: string, # Required. Gets or sets the container name.
receiverPath: string, # Optional. Gets or sets the path on the receiver side where the asset is to be mapped.
senderPath: string, # Optional. Gets or sets the path to file/folder within the container to be shared.
}
], # Required. A list of blob storage account paths to be shared.
provisioningState: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed" | "SoftDeleting" | "SoftDeleted" | "SourceMoved" | "SourceDeleted" | "TargetMoved" | "TargetDeleted", # Optional. Provisioning status of the resource
receiverAssetName: string, # Required. Name of the asset for the receiver.
storageAccountResourceId: string, # Required. Resource id of the blob storage account.
}, # Required. Blob storage account asset properties
}
Aplica-se a
Azure SDK for .NET