Udostępnij za pośrednictwem


ReceivedSharesClient.CreateOrReplaceReceivedShare Method

Definition

[Protocol Method] Create or replace a received share.

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

receivedShareId
String

Id of the received 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

receivedShareId or content is null.

receivedShareId 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 CreateOrReplaceReceivedShare 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 ReceivedSharesClient(endpoint, credential);

var data = new {
    properties = new {},
    shareKind = "InPlace",
};

var operation = client.CreateOrReplaceReceivedShare(WaitUntil.Completed, "<receivedShareId>", 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 CreateOrReplaceReceivedShare 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 ReceivedSharesClient(endpoint, credential);

var data = new {
    properties = new {
        assetStoreKind = "AdlsGen2Account",
        displayName = "<displayName>",
        shareStatus = "Detached",
        sink = new {
            properties = new {
                containerName = "<containerName>",
                folder = "<folder>",
                mountPath = "<mountPath>",
            },
            storeKind = "AdlsGen2Account",
            storeReference = new {
                referenceName = "<referenceName>",
                type = "ArmResourceReference",
            },
        },
    },
    shareKind = "InPlace",
};

var operation = client.CreateOrReplaceReceivedShare(WaitUntil.Completed, "<receivedShareId>", 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

Update changes to a received share

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

Request Body:

InPlaceReceivedShareSchema for InPlaceReceivedShare:
{
  properties: {
    assetLocation: string, # Optional. Location of the shared Asset.
    assetStoreKind: "AdlsGen2Account" | "BlobAccount", # Optional. The types of asset.
    createdAt: string (ISO 8601 Format), # Optional. Time at which the received share was created. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    displayName: string, # Optional. Received Share Name
    expirationDate: string (ISO 8601 Format), # Optional. The expiration date of the received share. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    receiverEmail: string, # Optional. Email of the user/receiver who received the sent share invitation
    receiverName: string, # Optional. Name of the user/receiver who received the sent share invitation
    receiverTenantName: string, # Optional. Tenant name of the user/receiver who received the sent share invitation
    senderEmail: string, # Optional. Email of the sender who created the sent share invitation
    senderName: string, # Optional. Name of the sender who created the sent share invitation
    senderTenantName: string, # Optional. Tenant name of the sender who created the sent share invitation
    sentShareDescription: string, # Optional. Share description.
    sharedAt: string (ISO 8601 Format), # Optional. Time at which the sent share was shared. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    shareStatus: "Detached" | "Attached", # Optional. Share status.
    sink: {
      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.
    }, # Optional. Holds details on the destination of the mapped artifact
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
  }, # Required. Properties of in place received 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:

InPlaceReceivedShareSchema for InPlaceReceivedShare:
{
  properties: {
    assetLocation: string, # Optional. Location of the shared Asset.
    assetStoreKind: "AdlsGen2Account" | "BlobAccount", # Optional. The types of asset.
    createdAt: string (ISO 8601 Format), # Optional. Time at which the received share was created. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    displayName: string, # Optional. Received Share Name
    expirationDate: string (ISO 8601 Format), # Optional. The expiration date of the received share. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    receiverEmail: string, # Optional. Email of the user/receiver who received the sent share invitation
    receiverName: string, # Optional. Name of the user/receiver who received the sent share invitation
    receiverTenantName: string, # Optional. Tenant name of the user/receiver who received the sent share invitation
    senderEmail: string, # Optional. Email of the sender who created the sent share invitation
    senderName: string, # Optional. Name of the sender who created the sent share invitation
    senderTenantName: string, # Optional. Tenant name of the sender who created the sent share invitation
    sentShareDescription: string, # Optional. Share description.
    sharedAt: string (ISO 8601 Format), # Optional. Time at which the sent share was shared. Represented in the standard date-time format as defined by [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
    shareStatus: "Detached" | "Attached", # Optional. Share status.
    sink: {
      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.
    }, # Optional. Holds details on the destination of the mapped artifact
    state: "Unknown" | "Succeeded" | "Creating" | "Deleting" | "Moving" | "Failed", # Optional. State of the resource
  }, # Required. Properties of in place received 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