Freigeben über


SentSharesClient.CreateOrReplaceSentShare Methode

Definition

[Protokollmethode] Erstellen oder ersetzen Sie eine gesendete Freigabe.

  • Diese Protokollmethode ermöglicht die explizite Erstellung der Anforderung und Verarbeitung der Antwort für erweiterte Szenarien.
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)

Parameter

waitUntil
WaitUntil

Completed , wenn die Methode auf die Rückgabe warten soll, bis der lange ausgeführte Vorgang für den Dienst abgeschlossen ist; Started , wenn es nach dem Starten des Vorgangs zurückgegeben werden soll. Weitere Informationen zu Vorgängen mit langer Ausführung finden Sie unter Beispiele für Azure.Core-Long-Running-Vorgänge.

sentShareId
String

ID der gesendeten Freigabe.

content
RequestContent

Der Inhalt, der als Textkörper der Anforderung gesendet werden soll.

context
RequestContext

Der Anforderungskontext, der das Standardverhalten der Clientpipeline pro Aufruf außer Kraft setzen kann.

Gibt zurück

Stellt Operation einen asynchronen Vorgang für den Dienst dar.

Ausnahmen

sentShareId oder content ist NULL.

sentShareId ist eine leere Zeichenfolge und wurde erwartet, dass sie nicht leer ist.

Der Dienst hat einen nicht erfolgreichen status Code zurückgegeben.

Beispiele

In diesem Beispiel wird gezeigt, wie CreateOrReplaceSentShare mit den erforderlichen Parametern und Anforderungsinhalten aufgerufen und das Ergebnis analysiert wird.

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

In diesem Beispiel wird gezeigt, wie CreateOrReplaceSentShare mit allen Parametern und Anforderungsinhalten aufgerufen und das Ergebnis analysiert wird.

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

Hinweise

Erstellen oder Ersetzen einer gesendeten Freigabe

Im Folgenden finden Sie das JSON-Schema für die Anforderungs- und Antwortnutzlasten.

Anforderungstext:

InPlaceSentShareSchema für 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.
}

Antworttext:

InPlaceSentShareSchema für 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.
}

Gilt für: