AssetsClient.CreateAsync メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
既存の共有に新しい資産を追加します。
public virtual System.Threading.Tasks.Task<Azure.Operation<BinaryData>> CreateAsync (Azure.WaitUntil waitUntil, string sentShareName, string assetName, 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, sentShareName As String, assetName As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Operation(Of BinaryData))
パラメーター
- waitUntil
- WaitUntil
Completed メソッドがサービスで実行時間の長い操作が完了するまで戻るのを待機する必要がある場合。 Started 操作を開始した後に が返される場合は 。 実行時間の長い操作の詳細については、「 Azure.Core Long-Running 操作のサンプル」を参照してください。
- sentShareName
- String
送信された共有の名前。
- assetName
- String
資産の名前。
- content
- RequestContent
要求の本文として送信するコンテンツ。 要求本文スキーマの詳細については、以下の「解説」セクションを参照してください。
- context
- RequestContext
要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。
戻り値
Operation<T>サービスに対する非同期操作が完了すると、 BinaryData オブジェクトを格納するサービスの 。 操作の最終値の本文スキーマの詳細については、以下の「解説」セクションを参照してください。
例外
sentShareName
、assetName
、または content
が null です。
sentShareName
または assetName
が空の文字列であり、空でないと想定されていました。
サービスから成功以外の状態コードが返されました。
例
このサンプルでは、必要なパラメーターを使用して CreateAsync を呼び出し、コンテンツを要求し、結果を解析する方法を示します。
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 = await client.CreateAsync(WaitUntil.Completed, "<sentShareName>", "<assetName>", 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 オブジェクトを選択して、このスキーマを表示してください。
AdlsGen2AccountAsset
のAdlsGen2AccountAsset
スキーマ:{
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
}
~+ さらに 1 つの JSON オブジェクト
BlobAccountAsset
のBlobAccountAsset
スキーマ:{
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
}
応答本文:
このメソッドは、以下のいずれかの JSON オブジェクトをペイロードとして受け取ります。 JSON オブジェクトを選択して、このスキーマを表示してください。
AdlsGen2AccountAsset
のAdlsGen2AccountAsset
スキーマ:{
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
}
~+ さらに 1 つの JSON オブジェクト
BlobAccountAsset
のBlobAccountAsset
スキーマ:{
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
}
適用対象
Azure SDK for .NET