Exemple #1
0
        /// <inheritdoc/>
        public override async Task <ClientEncryptionKeyResponse> ReadAsync(
            RequestOptions requestOptions       = null,
            CancellationToken cancellationToken = default)
        {
            ClientEncryptionKeyResponse response = await this.ReadInternalAsync(
                requestOptions,
                diagnosticsContext : null,
                cancellationToken : cancellationToken);

            return(response);
        }
Exemple #2
0
        /// <inheritdoc/>
        public override async Task <ClientEncryptionKeyResponse> ReadAsync(
            RequestOptions requestOptions       = null,
            CancellationToken cancellationToken = default)
        {
            ClientEncryptionKeyResponse response = await this.ReadInternalAsync(
                requestOptions,
                trace : NoOpTrace.Singleton,
                cancellationToken : cancellationToken);

            return(response);
        }
Exemple #3
0
        private async Task <ClientEncryptionKeyResponse> ReadInternalAsync(
            RequestOptions requestOptions,
            CosmosDiagnosticsContext diagnosticsContext,
            CancellationToken cancellationToken)
        {
            ResponseMessage responseMessage = await this.ProcessStreamAsync(
                streamPayload : null,
                operationType : OperationType.Read,
                requestOptions : requestOptions,
                diagnosticsContext : diagnosticsContext,
                cancellationToken : cancellationToken);

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

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

            return(response);
        }
Exemple #4
0
        private async Task <ClientEncryptionKeyResponse> ReplaceInternalAsync(
            ClientEncryptionKeyProperties clientEncryptionKeyProperties,
            RequestOptions requestOptions,
            ITrace trace,
            CancellationToken cancellationToken)
        {
            ResponseMessage responseMessage = await this.ProcessStreamAsync(
                streamPayload : this.ClientContext.SerializerCore.ToStream(clientEncryptionKeyProperties),
                operationType : OperationType.Replace,
                requestOptions : requestOptions,
                trace : trace,
                cancellationToken : cancellationToken);

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

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

            return(response);
        }
Exemple #5
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);
        }