Compartilhar via


ReceivedSharesClient.CreateOrReplaceReceivedShareAsync Método

Definição

[Método de protocolo] Criar ou substituir um compartilhamento recebido.

  • Esse método de protocolo permite a criação explícita da solicitação e do processamento da resposta para cenários avançados.
public virtual System.Threading.Tasks.Task<Azure.Operation<BinaryData>> CreateOrReplaceReceivedShareAsync (Azure.WaitUntil waitUntil, string receivedShareId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrReplaceReceivedShareAsync : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
override this.CreateOrReplaceReceivedShareAsync : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
Public Overridable Function CreateOrReplaceReceivedShareAsync (waitUntil As WaitUntil, receivedShareId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Operation(Of BinaryData))

Parâmetros

waitUntil
WaitUntil

Completed se o método deve aguardar para retornar até que a operação de execução prolongada seja concluída no serviço; Started se ele deve retornar depois de iniciar a operação. Para obter mais informações sobre operações de longa execução, consulte Exemplos de operação de Long-Running do Azure.Core.

receivedShareId
String

ID do compartilhamento recebido.

content
RequestContent

O conteúdo a ser enviado como o corpo da solicitação.

context
RequestContext

O contexto de solicitação, que pode substituir os comportamentos padrão do pipeline do cliente por chamada.

Retornos

O Operation que representa uma operação assíncrona no serviço.

Exceções

receivedShareId ou content é nulo.

receivedShareId é uma cadeia de caracteres vazia e era esperado que não estivesse vazio.

O serviço retornou um código de status sem êxito.

Exemplos

Este exemplo mostra como chamar CreateOrReplaceReceivedShareAsync com os parâmetros necessários e o conteúdo da solicitação e como analisar o resultado.

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 = await client.CreateOrReplaceReceivedShareAsync(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());

Este exemplo mostra como chamar CreateOrReplaceReceivedShareAsync com todos os parâmetros e conteúdo da solicitação e como analisar o resultado.

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 = await client.CreateOrReplaceReceivedShareAsync(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());

Comentários

Atualizar alterações em um compartilhamento recebido

Abaixo está o esquema JSON para os conteúdos de solicitação e resposta.

Corpo da solicitação:

InPlaceReceivedShareEsquema para 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.
}

Corpo da resposta:

InPlaceReceivedShareEsquema para 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.
}

Aplica-se a