Task <ClientEncryptionKeyResponse> CreateClientEncryptionKeyAsync(
     ClientEncryptionKeyProperties clientEncryptionKeyProperties,
     RequestOptions requestOptions       = null,
     CancellationToken cancellationToken = default)
 {
     return(this.ClientContext.OperationHelperAsync(
                nameof(CreateClientEncryptionKeyAsync),
                requestOptions,
                (trace) => base.CreateClientEncryptionKeyAsync(trace, clientEncryptionKeyProperties, requestOptions, cancellationToken)));
 }
示例#2
0
 public override Task <ClientEncryptionKeyResponse> ReplaceAsync(
     ClientEncryptionKeyProperties clientEncryptionKeyProperties,
     RequestOptions requestOptions       = null,
     CancellationToken cancellationToken = default)
 {
     return(this.ClientContext.OperationHelperAsync(
                nameof(ReplaceAsync),
                requestOptions,
                (diagnostics, trace) => base.ReplaceAsync(clientEncryptionKeyProperties, requestOptions, cancellationToken)));
 }
示例#3
0
        /// <inheritdoc/>
        public override async Task <ClientEncryptionKeyResponse> ReplaceAsync(
            ClientEncryptionKeyProperties clientEncryptionKeyProperties,
            RequestOptions requestOptions       = null,
            CancellationToken cancellationToken = default)
        {
            ClientEncryptionKeyResponse response = await this.ReplaceInternalAsync(
                clientEncryptionKeyProperties,
                requestOptions,
                diagnosticsContext : null,
                cancellationToken : cancellationToken);

            return(response);
        }
示例#4
0
        /// <inheritdoc/>
        public override async Task <ClientEncryptionKeyResponse> ReplaceAsync(
            ClientEncryptionKeyProperties clientEncryptionKeyProperties,
            RequestOptions requestOptions       = null,
            CancellationToken cancellationToken = default)
        {
            ClientEncryptionKeyResponse response = await this.ReplaceInternalAsync(
                clientEncryptionKeyProperties,
                requestOptions,
                trace : NoOpTrace.Singleton,
                cancellationToken : cancellationToken);

            return(response);
        }
示例#5
0
 public override ClientEncryptionKeyResponse CreateClientEncryptionKeyResponse(
     ClientEncryptionKey clientEncryptionKey,
     ResponseMessage responseMessage)
 {
     return(this.ProcessMessage(responseMessage, (cosmosResponseMessage) =>
     {
         ClientEncryptionKeyProperties cekProperties = this.ToObjectpublic <ClientEncryptionKeyProperties>(cosmosResponseMessage);
         return new ClientEncryptionKeyResponse(
             cosmosResponseMessage.StatusCode,
             cosmosResponseMessage.Headers,
             cekProperties,
             clientEncryptionKey,
             cosmosResponseMessage.Diagnostics);
     }));
 }
示例#6
0
        private async Task <ClientEncryptionKeyResponse> ReplaceInternalAsync(
            ClientEncryptionKeyProperties clientEncryptionKeyProperties,
            RequestOptions requestOptions,
            CosmosDiagnosticsContext diagnosticsContext,
            CancellationToken cancellationToken)
        {
            ResponseMessage responseMessage = await this.ProcessStreamAsync(
                streamPayload : this.ClientContext.SerializerCore.ToStream(clientEncryptionKeyProperties),
                operationType : OperationType.Replace,
                requestOptions : requestOptions,
                diagnosticsContext : diagnosticsContext,
                cancellationToken : cancellationToken);

            ClientEncryptionKeyResponse response = this.ClientContext.ResponseFactory.CreateClientEncryptionKeyResponse(this, responseMessage);

            Debug.Assert(response.Resource != null);

            return(response);
        }
示例#7
0
        async Task <ClientEncryptionKeyResponse> CreateClientEncryptionKeyAsync(
            ITrace trace,
            ClientEncryptionKeyProperties clientEncryptionKeyProperties,
            RequestOptions requestOptions       = null,
            CancellationToken cancellationToken = default)
        {
            Stream          streamPayload   = this.ClientContext.SerializerCore.ToStream(clientEncryptionKeyProperties);
            ResponseMessage responseMessage = await this.CreateClientEncryptionKeyStreamAsync(
                trace : trace,
                streamPayload : streamPayload,
                requestOptions : requestOptions,
                cancellationToken : cancellationToken);

            ClientEncryptionKeyResponse cekResponse = this.ClientContext.ResponseFactory.CreateClientEncryptionKeyResponse(
                this.GetClientEncryptionKey(clientEncryptionKeyProperties.Id),
                responseMessage);

            Debug.Assert(cekResponse.Resource != null);

            return(cekResponse);
        }
示例#8
0
 /// <summary>
 /// Replace a <see cref="ClientEncryptionKeyProperties"/> from the Azure Cosmos service as an asynchronous operation.
 /// This method is not meant to be invoked directly. Please see https://aka.ms/CosmosClientEncryption in order to use client-side encryption.
 /// </summary>
 /// <param name="clientEncryptionKeyProperties">The <see cref="ClientEncryptionKeyProperties"/> object.</param>
 /// <param name="requestOptions">(Optional) The options for the request.</param>
 /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param>
 /// <returns>
 /// A <see cref="Task"/> containing a <see cref="ClientEncryptionKeyResponse"/> which wraps a <see cref="ClientEncryptionKeyProperties"/> containing the replace resource record.
 /// </returns>
 /// <exception>https://aka.ms/cosmosdb-dot-net-exceptions</exception>
 public abstract Task <ClientEncryptionKeyResponse> ReplaceAsync(
     ClientEncryptionKeyProperties clientEncryptionKeyProperties,
     RequestOptions requestOptions       = null,
     CancellationToken cancellationToken = default);