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

Permission.ReplaceAsync Method

Definition

Replace a PermissionProperties from the Azure Cosmos service as an asynchronous operation. This will not revoke existing ResourceTokens.

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.PermissionResponse> ReplaceAsync(Microsoft.Azure.Cosmos.PermissionProperties permissionProperties, int? tokenExpiryInSeconds = default, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReplaceAsync : Microsoft.Azure.Cosmos.PermissionProperties * Nullable<int> * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.PermissionResponse>
Public MustOverride Function ReplaceAsync (permissionProperties As PermissionProperties, Optional tokenExpiryInSeconds As Nullable(Of Integer) = Nothing, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of PermissionResponse)

Parameters

permissionProperties
PermissionProperties

The PermissionProperties object.

tokenExpiryInSeconds
Nullable<Int32>

(Optional) The expiry time for resource token in seconds. This value can range from 10 seconds, to 24 hours (or 86,400 seconds). The default value for this is 1 hour (or 3,600 seconds). This does not change the default value for future tokens.

requestOptions
RequestOptions

(Optional) The options for the user request.

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

A Task containing a PermissionResponse which wraps a PermissionProperties containing the replace resource record.

Examples

PermissionProperties permissionProperties = permissionReadResponse;
permissionProperties.Id = "newuser";
PermissionResponse response = await permission.ReplaceAsync(permissionProperties, tokenExpiryInSeconds: 9000);
PermissionProperties replacedProperties = response;

Applies to