FeedIterator <DataEncryptionKeyProperties> GetDataEncryptionKeyIterator(
            string startId                     = null,
            string endId                       = null,
            bool isDescending                  = false,
            string continuationToken           = null,
            QueryRequestOptions requestOptions = null)
        {
            if (!(this.GetDataEncryptionKeyStreamIterator(
                      startId,
                      endId,
                      isDescending,
                      continuationToken,
                      requestOptions) is FeedIteratorInternal dekStreamIterator))
            {
                throw new InvalidOperationException($"Expected FeedIteratorInternal.");
            }

            return(new FeedIteratorCore <DataEncryptionKeyProperties>(
                       dekStreamIterator,
                       (responseMessage) =>
            {
                FeedResponse <DataEncryptionKeyProperties> results = this.ClientContext.ResponseFactory.CreateQueryFeedResponse <DataEncryptionKeyProperties>(responseMessage, ResourceType.ClientEncryptionKey);
                foreach (DataEncryptionKeyProperties result in results)
                {
                    Uri dekUri = DataEncryptionKeyCore.CreateLinkUri(this.ClientContext, this, result.Id);
                    this.ClientContext.DekCache.Set(this.Id, dekUri, result);
                }

                return results;
            }));
        }
Exemple #2
0
        internal DataEncryptionKeyCore(
            CosmosClientContext clientContext,
            DatabaseCore database,
            string keyId)
        {
            this.Id            = keyId;
            this.ClientContext = clientContext;
            this.LinkUri       = DataEncryptionKeyCore.CreateLinkUri(clientContext, database, keyId);

            this.Database = database;
        }