AssetMappingsClient.CreateAsync Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Mappe une ressource source dans le partage envoyé à une ressource de destination dans le partage reçu.
public virtual System.Threading.Tasks.Task<Azure.Operation<BinaryData>> CreateAsync (Azure.WaitUntil waitUntil, string receivedShareName, string assetMappingName, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateAsync : Azure.WaitUntil * string * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
override this.CreateAsync : Azure.WaitUntil * string * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
Public Overridable Function CreateAsync (waitUntil As WaitUntil, receivedShareName As String, assetMappingName As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Operation(Of BinaryData))
Paramètres
- waitUntil
- WaitUntil
Completed si la méthode doit attendre pour retourner jusqu’à ce que l’opération de longue durée soit terminée sur le service ; Started si elle doit être retournée après le démarrage de l’opération. Pour plus d’informations sur les opérations de longue durée, consultez Exemples d’opérations de Long-Running Azure.Core.
- receivedShareName
- String
Nom du partage reçu.
- assetMappingName
- String
Nom du mappage de ressources.
- content
- RequestContent
Contenu à envoyer en tant que corps de la demande. Les détails du schéma du corps de la demande se trouvent dans la section Remarques ci-dessous.
- context
- RequestContext
Contexte de la demande, qui peut remplacer les comportements par défaut du pipeline client par appel.
Retours
du Operation<T> service qui contiendra un BinaryData objet une fois l’opération asynchrone sur le service terminée. Les détails du schéma du corps pour la valeur finale de l’opération se trouvent dans la section Remarques ci-dessous.
Exceptions
receivedShareName
, assetMappingName
ou content
a la valeur Null.
receivedShareName
ou assetMappingName
est une chaîne vide, et était censé être non vide.
Le service a retourné un code de status non réussi.
Exemples
Cet exemple montre comment appeler CreateAsync avec les paramètres requis et demander le contenu, et comment analyser le résultat.
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 = await client.CreateAsync(WaitUntil.Completed, "<receivedShareName>", "<assetMappingName>", RequestContent.Create(data));
BinaryData data = await operation.WaitForCompletionAsync();
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.ToString());
Cet exemple montre comment appeler CreateAsync avec tous les paramètres et le contenu de la demande, et comment analyser le résultat.
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 = await client.CreateAsync(WaitUntil.Completed, "<receivedShareName>", "<assetMappingName>", RequestContent.Create(data));
BinaryData data = await operation.WaitForCompletionAsync();
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());
Remarques
Créer un mappage de ressources sur un partage reçu
Vous trouverez ci-dessous le schéma JSON pour les charges utiles de requête et de réponse.
Corps de la demande :
Cette méthode prend l’un des objets JSON ci-dessous en tant que charge utile. Sélectionnez un objet JSON pour afficher le schéma correspondant.
AdlsGen2AccountAssetMapping
Schéma pourAdlsGen2AccountAssetMapping
:{
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 autres objets
BlobAccountAssetMapping
Schéma pourBlobAccountAssetMapping
:{
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.
}
Corps de réponse :
Cette méthode prend l’un des objets JSON ci-dessous en tant que charge utile. Sélectionnez un objet JSON pour afficher le schéma correspondant.
AdlsGen2AccountAssetMapping
Schéma pourAdlsGen2AccountAssetMapping
:{
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 autres objets
BlobAccountAssetMapping
Schéma pourBlobAccountAssetMapping
:{
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.
}
S’applique à
Azure SDK for .NET