AssetMappingsClient.CreateAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Maps a source asset in the sent share to a destination asset in the received share.
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))
Parameters
- waitUntil
- WaitUntil
Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
- receivedShareName
- String
The name of the received share.
- assetMappingName
- String
The name of the asset mapping.
- content
- RequestContent
The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The Operation<T> from the service that will contain a BinaryData object once the asynchronous operation on the service has completed. Details of the body schema for the operation's final value are in the Remarks section below.
Exceptions
receivedShareName
, assetMappingName
or content
is null.
receivedShareName
or assetMappingName
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call CreateAsync with required parameters and request content, and how to parse the result.
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());
This sample shows how to call CreateAsync with all parameters and request content, and how to parse the result.
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());
Remarks
Create an asset mapping on a received share
Below is the JSON schema for the request and response payloads.
Request Body:
This method takes one of the JSON objects below as a payload. Please select a JSON object to view the schema for this.
AdlsGen2AccountAssetMapping
Schema forAdlsGen2AccountAssetMapping
:
{
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 more JSON objects
BlobAccountAssetMapping
Schema forBlobAccountAssetMapping
:
{
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.
}
Response Body:
This method takes one of the JSON objects below as a payload. Please select a JSON object to view the schema for this.
AdlsGen2AccountAssetMapping
Schema forAdlsGen2AccountAssetMapping
:
{
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 more JSON objects
BlobAccountAssetMapping
Schema forBlobAccountAssetMapping
:
{
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.
}
Applies to
Azure SDK for .NET