Partager via


SentSharesClient.CreateOrReplaceSentShareAsync Méthode

Définition

[Méthode de protocole] Créer ou remplacer un partage envoyé.

  • Cette méthode de protocole permet la création explicite de la demande et le traitement de la réponse pour les scénarios avancés.
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))

Paramètres

waitUntil
WaitUntil

Completed si la méthode doit attendre pour retourner jusqu’à ce que l’opération de longue durée soit terminée sur le service ; Started si elle doit être retournée après le démarrage de l’opération. Pour plus d’informations sur les opérations de longue durée, consultez Exemples d’opérations de Long-Running Azure.Core.

sentShareId
String

ID du partage envoyé.

content
RequestContent

Contenu à envoyer en tant que corps de la demande.

context
RequestContext

Contexte de la demande, qui peut remplacer les comportements par défaut du pipeline client par appel.

Retours

Operation représentant une opération asynchrone sur le service.

Exceptions

sentShareId ou content est null.

sentShareId est une chaîne vide et devait être non vide.

Le service a retourné un code de status non réussi.

Exemples

Cet exemple montre comment appeler CreateOrReplaceSentShareAsync avec les paramètres requis et le contenu de la demande, et comment analyser le résultat.

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());

Cet exemple montre comment appeler CreateOrReplaceSentShareAsync avec tous les paramètres et le contenu de la demande, et comment analyser le résultat.

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());

Remarques

Créer ou remplacer un partage envoyé

Vous trouverez ci-dessous le schéma JSON pour les charges utiles de requête et de réponse.

Corps de la demande :

InPlaceSentShareSchéma pour 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.
}

Corps de réponse :

InPlaceSentShareSchéma pour 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.
}

S’applique à