Compartilhar via


SentSharesClient.CreateOrReplaceSentShare Método

Definição

[Método protocol] Criar ou substituir um compartilhamento enviado.

  • Esse método de protocolo permite a criação explícita da solicitação e o processamento da resposta para cenários avançados.
public virtual Azure.Operation<BinaryData> CreateOrReplaceSentShare (Azure.WaitUntil waitUntil, string sentShareId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrReplaceSentShare : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Operation<BinaryData>
override this.CreateOrReplaceSentShare : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Operation<BinaryData>
Public Overridable Function CreateOrReplaceSentShare (waitUntil As WaitUntil, sentShareId As String, content As RequestContent, Optional context As RequestContext = Nothing) As 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 execução prolongada, consulte Exemplos de operação de Long-Running do Azure.Core.

sentShareId
String

Id do compartilhamento enviado.

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

sentShareId ou content é nulo.

sentShareId é uma cadeia de caracteres vazia e esperava-se que não estivesse vazia.

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

Exemplos

Este exemplo mostra como chamar CreateOrReplaceSentShare 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 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 = client.CreateOrReplaceSentShare(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());

Este exemplo mostra como chamar CreateOrReplaceSentShare 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 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 = client.CreateOrReplaceSentShare(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());

Comentários

Criar ou substituir um compartilhamento enviado

Abaixo está o esquema JSON para as cargas de solicitação e resposta.

Corpo da solicitação:

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

Corpo da resposta:

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

Aplica-se a