Condividi tramite


SentSharesClient.CreateOrReplaceSentShareAsync Method

Definition

[Protocol Method] Create or replace a sent share.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Operation<BinaryData>> CreateOrReplaceSentShareAsync (Azure.WaitUntil waitUntil, string sentShareId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrReplaceSentShareAsync : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
override this.CreateOrReplaceSentShareAsync : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
Public Overridable Function CreateOrReplaceSentShareAsync (waitUntil As WaitUntil, sentShareId 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.

sentShareId
String

Id of the sent share.

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Operation representing an asynchronous operation on the service.

Exceptions

sentShareId or content is null.

sentShareId 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 CreateOrReplaceSentShareAsync with required parameters and request content, and how to parse the result.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new SentSharesClient(endpoint, credential);

var data = new {
    properties = new {
        artifact = new {
            properties = new {
                paths = new[] {
                    new {
                        containerName = "<containerName>",
                    }
                },
            },
            storeKind = "AdlsGen2Account",
            storeReference = new {},
        },
        displayName = "<displayName>",
    },
    shareKind = "InPlace",
};

var operation = await client.CreateOrReplaceSentShareAsync(WaitUntil.Completed, "<sentShareId>", RequestContent.Create(data));

BinaryData responseData = operation.Value;
JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("shareKind").ToString());
Console.WriteLine(result.ToString());

This sample shows how to call CreateOrReplaceSentShareAsync with all parameters and request content, and how to parse the result.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new SentSharesClient(endpoint, credential);

var data = new {
    properties = new {
        artifact = new {
            properties = new {
                paths = new[] {
                    new {
                        containerName = "<containerName>",
                        receiverPath = "<receiverPath>",
                        senderPath = "<senderPath>",
                    }
                },
            },
            storeKind = "AdlsGen2Account",
            storeReference = new {
                referenceName = "<referenceName>",
                type = "ArmResourceReference",
            },
        },
        description = "<description>",
        displayName = "<displayName>",
    },
    shareKind = "InPlace",
};

var operation = await client.CreateOrReplaceSentShareAsync(WaitUntil.Completed, "<sentShareId>", RequestContent.Create(data));

BinaryData responseData = operation.Value;
JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("shareKind").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("type").ToString());

Remarks

Create or replace a sent share

Below is the JSON schema for the request and response payloads.

Request Body:

InPlaceSentShareSchema for InPlaceSentShare:
{
  properties: {
    artifact: {
      storeKind: "AdlsGen2Account" | "BlobAccount", # Required. The types of asset.
      storeReference: {
        referenceName: string, # Optional. Reference name for resource associated with the sink or artifact.
        type: "ArmResourceReference", # Optional. Defines the type of resource being shared
      }, # Required. A Store Reference for an artifact or sink.
    }, # Required. A class for sent share artifact.
    createdAt: string (ISO 8601 Format), # Optional. Time at which the sent share was created. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    dependsOn: [Guid], # Optional. List of shares on which the sent share depends.
    description: string, # Optional. Sent share description.
    displayName: string, # Required. The name of the sent share
    senderEmail: string, # Optional. Email of the sender who created the sent share.
    senderName: string, # Optional. Name of the sender who created the sent share.
    senderTenantName: string, # Optional. Tenant name of the sender who created the sent share.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
  }, # Required. Properties for InPlace sent share.
  shareKind: InPlace, # Required. Defines the supported types for share.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}

Response Body:

InPlaceSentShareSchema for InPlaceSentShare:
{
  properties: {
    artifact: {
      storeKind: "AdlsGen2Account" | "BlobAccount", # Required. The types of asset.
      storeReference: {
        referenceName: string, # Optional. Reference name for resource associated with the sink or artifact.
        type: "ArmResourceReference", # Optional. Defines the type of resource being shared
      }, # Required. A Store Reference for an artifact or sink.
    }, # Required. A class for sent share artifact.
    createdAt: string (ISO 8601 Format), # Optional. Time at which the sent share was created. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    dependsOn: [Guid], # Optional. List of shares on which the sent share depends.
    description: string, # Optional. Sent share description.
    displayName: string, # Required. The name of the sent share
    senderEmail: string, # Optional. Email of the sender who created the sent share.
    senderName: string, # Optional. Name of the sender who created the sent share.
    senderTenantName: string, # Optional. Tenant name of the sender who created the sent share.
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
  }, # Required. Properties for InPlace sent share.
  shareKind: InPlace, # Required. Defines the supported types for share.
  id: string, # Optional. The unique id of the resource.
  type: string, # Optional. Type of the resource.
}

Applies to