次の方法で共有


AssetMappingsClient.CreateAsync メソッド

定義

送信された共有内のソース 資産を、受信した共有の宛先資産にマップします。

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))

パラメーター

waitUntil
WaitUntil

Completed メソッドが、サービスで実行時間の長い操作が完了するまで戻るまで待機する必要がある場合。 Started 操作を開始した後に が返される場合は 。 実行時間の長い操作の詳細については、「 Azure.Core Long-Running 操作のサンプル」を参照してください。

receivedShareName
String

受信した共有の名前。

assetMappingName
String

資産マッピングの名前。

content
RequestContent

要求の本文として送信するコンテンツ。 要求本文スキーマの詳細については、以下の「解説」セクションを参照してください。

context
RequestContext

要求コンテキスト。これは、クライアント パイプラインの既定の動作を呼び出しごとにオーバーライドできます。

戻り値

Operation<T>サービスに対する非同期操作が完了した後に オブジェクトを格納BinaryDataするサービスの 。 操作の最終値の本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

receivedShareNameassetMappingName、または content が null です。

receivedShareName または assetMappingName が空の文字列であり、空でないと想定されていました。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターと要求コンテンツを使用して CreateAsync を呼び出す方法と、結果を解析する方法を示します。

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());

このサンプルでは、すべてのパラメーターと要求コンテンツを使用して CreateAsync を呼び出す方法と、結果を解析する方法を示します。

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());

注釈

受信した共有に資産マッピングを作成する

要求と応答のペイロードの JSON スキーマを次に示します。

要求本文:

このメソッドは、以下のいずれかの JSON オブジェクトをペイロードとして受け取ります。 このスキーマを表示するには、JSON オブジェクトを選択してください。

AdlsGen2AccountAssetMappingAdlsGen2AccountAssetMappingスキーマ:
{
              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 つ以上の JSON オブジェクト
BlobAccountAssetMappingBlobAccountAssetMappingスキーマ:
{
              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.
            }

応答本文:

このメソッドは、以下のいずれかの JSON オブジェクトをペイロードとして受け取ります。 このスキーマを表示するには、JSON オブジェクトを選択してください。

AdlsGen2AccountAssetMappingAdlsGen2AccountAssetMappingスキーマ:
{
              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 つ以上の JSON オブジェクト
BlobAccountAssetMappingBlobAccountAssetMappingスキーマ:
{
              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.
            }

適用対象