你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ReceivedSharesClient.CreateOrReplaceReceivedShare 方法

定义

[协议方法]创建或替换收到的共享。

  • 协议方法 允许显式创建请求并处理高级方案的响应。
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)

参数

waitUntil
WaitUntil

Completed 如果方法应等待返回,直到服务上长时间运行的操作完成; Started 如果它应在启动操作后返回,则为 。 有关长时间运行的操作的详细信息,请参阅 Azure.Core Long-Running 操作示例

receivedShareId
String

收到的共享的 ID。

content
RequestContent

要作为请求正文发送的内容。

context
RequestContext

请求上下文,可以基于每个调用替代客户端管道的默认行为。

返回

表示 Operation 服务上的异步操作的 。

例外

receivedShareIdcontent 为 null。

receivedShareId 是一个空字符串,预期为非空。

服务返回了非成功状态代码。

示例

此示例演示如何使用所需的参数和请求内容调用 CreateOrReplaceReceivedShare,以及如何分析结果。

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

此示例演示如何使用所有参数和请求内容调用 CreateOrReplaceReceivedShare,以及如何分析结果。

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

注解

更新对收到的共享的更改

下面是请求和响应有效负载的 JSON 架构。

请求正文:

InPlaceReceivedShareInPlaceReceivedShare架构:
{
  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.
}

响应正文:

InPlaceReceivedShareInPlaceReceivedShare架构:
{
  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.
}

适用于