Configuration for the Table.GetItem operation
コード例 #1
0
        internal Document GetItemHelper(Key key, GetItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new GetItemOperationConfig();
            var request       = new GetItemRequest
            {
                TableName      = TableName,
                Key            = key,
                ConsistentRead = currentConfig.ConsistentRead
            };

            ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(isAsync ?
                                                                                                new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                                                                                                new RequestEventHandler(UserAgentRequestEventHandlerSync)
                                                                                                );
            if (currentConfig.AttributesToGet != null)
            {
                request.AttributesToGet = currentConfig.AttributesToGet;
            }

            var result       = DDBClient.GetItem(request);
            var attributeMap = result.Item;

            if (attributeMap == null || attributeMap.Count == 0)
            {
                return(null);
            }
            return(Document.FromAttributeMap(attributeMap));
        }
コード例 #2
0
        internal async Task <Document> GetItemHelperAsync(Key key, GetItemOperationConfig config, CancellationToken cancellationToken)
        {
            var currentConfig = config ?? new GetItemOperationConfig();
            var request       = new GetItemRequest
            {
                TableName      = TableName,
                Key            = key,
                ConsistentRead = currentConfig.ConsistentRead
            };

            this.AddRequestHandler(request, isAsync: true);

            if (currentConfig.AttributesToGet != null)
            {
                request.AttributesToGet = currentConfig.AttributesToGet;
            }

            var result = await DDBClient.GetItemAsync(request, cancellationToken).ConfigureAwait(false);

            var attributeMap = result.Item;

            if (attributeMap == null || attributeMap.Count == 0)
            {
                return(null);
            }
            return(this.FromAttributeMap(attributeMap));
        }
コード例 #3
0
        internal Document GetItemHelper(Key key, GetItemOperationConfig config)
        {
            var currentConfig = config ?? new GetItemOperationConfig();
            var request       = new GetItemRequest
            {
                TableName      = TableName,
                Key            = key,
                ConsistentRead = currentConfig.ConsistentRead
            };

            this.AddRequestHandler(request, isAsync: false);

            if (currentConfig.AttributesToGet != null)
            {
                request.AttributesToGet = currentConfig.AttributesToGet;
            }

            var result       = DDBClient.GetItem(request);
            var attributeMap = result.Item;

            if (attributeMap == null || attributeMap.Count == 0)
            {
                return(null);
            }
            return(this.FromAttributeMap(attributeMap));
        }
コード例 #4
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="key">Ley of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param>
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void GetItemAsync(IDictionary <string, DynamoDBEntry> key, GetItemOperationConfig config,
                          AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(GetItemHelper(MakeKey(key), config, true)); },
         asyncOptions,
         callback);
 }
コード例 #5
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param>
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config,
                          AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(GetItemHelper(MakeKey(hashKey, rangeKey), config, true)); },
         asyncOptions,
         callback);
 }
コード例 #6
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="key">Ley of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetItem
 ///         operation.</returns>
 public IAsyncResult BeginGetItem(IDictionary <string, DynamoDBEntry> key, GetItemOperationConfig config, AsyncCallback callback, object state)
 {
     return(DynamoDBAsyncExecutor.BeginOperation(() => GetItemHelper(MakeKey(key), config, true), callback, state));
 }
コード例 #7
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetItem
 ///         operation.</returns>
 public IAsyncResult BeginGetItem(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, AsyncCallback callback, object state)
 {
     return(DynamoDBAsyncExecutor.BeginOperation(() => GetItemHelper(MakeKey(hashKey, rangeKey), config, true), callback, state));
 }
コード例 #8
0
ファイル: Table.Sync.cs プロジェクト: rajdotnet/aws-sdk-net
 /// <summary>
 /// Gets a document from DynamoDB by key, using specified configs.
 /// </summary>
 /// <param name="key">Key of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 public Document GetItem(IDictionary<string, DynamoDBEntry> key, GetItemOperationConfig config = null)
 {
     return GetItemHelper(MakeKey(key), config, false);
 }
コード例 #9
0
ファイル: Table.Sync.cs プロジェクト: rajdotnet/aws-sdk-net
 /// <summary>
 /// Gets a document from DynamoDB by hash-and-range primary key,
 /// using specified configs.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 public Document GetItem(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config = null)
 {
     return GetItemHelper(MakeKey(hashKey, rangeKey), config, false);
 }
コード例 #10
0
ファイル: Table.cs プロジェクト: skilitics/aws-sdk-net
        internal Document GetItemHelper(Key key, GetItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new GetItemOperationConfig();
            var request = new GetItemRequest
            {
                TableName = TableName,
                Key = key,
                ConsistentRead = currentConfig.ConsistentRead
            };
            request.BeforeRequestEvent += isAsync ?
                new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.AttributesToGet != null)
                request.WithAttributesToGet(currentConfig.AttributesToGet);

            var result = DDBClient.GetItem(request);
            var attributeMap = result.GetItemResult.Item;
            if (attributeMap == null)
                return null;
            return Document.FromAttributeMap(attributeMap);
        }
コード例 #11
0
ファイル: Table.Sync.cs プロジェクト: eangelov/aws-sdk-net-1
 /// <summary>
 /// Gets a document from DynamoDB by hash-and-range primary key,
 /// using specified configs.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 public Document GetItem(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config)
 {
     return(GetItemHelper(MakeKey(hashKey, rangeKey), config));
 }
コード例 #12
0
ファイル: Table.Async.cs プロジェクト: philasmar/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="key">Ley of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="cancellationToken">Token which can be used to cancel the task.</param>
 /// <returns>A Task that can be used to poll or wait for results, or both.</returns>
 public Task <Document> GetItemAsync(IDictionary <string, DynamoDBEntry> key, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(GetItemHelperAsync(MakeKey(key), config, cancellationToken));
 }
コード例 #13
0
 /// <summary>
 /// Gets a document from DynamoDB by key, using specified configs.
 /// </summary>
 /// <param name="key">Key of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 internal Document GetItem(IDictionary <string, DynamoDBEntry> key, GetItemOperationConfig config)
 {
     DynamoDBAsyncExecutor.IsMainThread("GetItemAsync");
     return(GetItemHelper(MakeKey(key), config, false));
 }
コード例 #14
0
 /// <summary>
 /// Gets a document from DynamoDB by hash-and-range primary key,
 /// using specified configs.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 internal Document GetItem(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config)
 {
     DynamoDBAsyncExecutor.IsMainThread("GetItemAsync");
     return(GetItemHelper(MakeKey(hashKey, rangeKey), config, false));
 }
コード例 #15
0
ファイル: Table.Sync.cs プロジェクト: anmarht/aws-sdk-bug
 /// <summary>
 /// Gets a document from DynamoDB by hash primary key, using specified configs.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 public Document GetItem(Primitive hashKey, GetItemOperationConfig config)
 {
     return(GetItemHelper(MakeKey(hashKey, null), config, false));
 }
コード例 #16
0
ファイル: Table.cs プロジェクト: skilitics/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="key">Ley of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetItem
 ///         operation.</returns>
 public IAsyncResult BeginGetItem(IDictionary<string, DynamoDBEntry> key, GetItemOperationConfig config, AsyncCallback callback, object state)
 {
     return DynamoDBAsyncExecutor.BeginOperation(() => GetItemHelper(MakeKey(key), config, true), callback, state);
 }
コード例 #17
0
ファイル: Table.cs プロジェクト: skilitics/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetItem
 ///         operation.</returns>
 public IAsyncResult BeginGetItem(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, AsyncCallback callback, object state)
 {
     return DynamoDBAsyncExecutor.BeginOperation(() => GetItemHelper(MakeKey(hashKey, rangeKey), config, true), callback, state);
 }
コード例 #18
0
ファイル: Table.Async.cs プロジェクト: aws/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>        
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> 
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config,
     AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync<Document>(
         () => { return GetItemHelper(MakeKey(hashKey, rangeKey), config, true); },
         asyncOptions,
         callback);
 }
コード例 #19
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// Returns the Document from DynamoDB in callback
 /// </summary>
 /// <param name="key">Ley of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">An AmazonDynamoCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// <returns>void</returns>
 public void GetItemAsync(IDictionary <string, DynamoDBEntry> key, GetItemOperationConfig config, AmazonDynamoCallback <Document> callback, object state)
 {
     DynamoDBAsyncExecutor.AsyncOperation <Document>(() => GetItemHelper(MakeKey(key), config, true), "GetItemAsync", callback, state);
 }
コード例 #20
0
ファイル: Table.Async.cs プロジェクト: aws/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// </summary>
 /// <param name="key">Ley of the document.</param>
 /// <param name="config">Configuration to use.</param>        
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> 
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void GetItemAsync(IDictionary<string, DynamoDBEntry> key, GetItemOperationConfig config,
     AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync<Document>(
         () => { return GetItemHelper(MakeKey(key), config, true); },
         asyncOptions,
         callback);
 }
コード例 #21
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// Returns the Document from DynamoDB in callback
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="callback">An AmazonDynamoCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// <returns>void</returns>
 public void GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, AmazonDynamoCallback <Document> callback, object state)
 {
     DynamoDBAsyncExecutor.AsyncOperation <Document>(() => GetItemHelper(MakeKey(hashKey, rangeKey), config, true), "GetItemAsync", callback, state);
 }
コード例 #22
0
ファイル: Table.Async.cs プロジェクト: philasmar/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="cancellationToken">Token which can be used to cancel the task.</param>
 /// <returns>A Task that can be used to poll or wait for results, or both.</returns>
 public Task <Document> GetItemAsync(Primitive hashKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(GetItemHelperAsync(MakeKey(hashKey, null), config, cancellationToken));
 }
コード例 #23
0
ファイル: Table.Async.cs プロジェクト: rajdotnet/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="cancellationToken">Token which can be used to cancel the task.</param>
 /// <returns>A Task that can be used to poll or wait for results, or both.</returns>
 public Task<Document> GetItemAsync(Primitive hashKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
 {
     return AsyncRunner.Run(() => GetItemHelper(MakeKey(hashKey, null), config, true), cancellationToken);
 }
コード例 #24
0
ファイル: Table.Sync.cs プロジェクト: eangelov/aws-sdk-net-1
 /// <summary>
 /// Gets a document from DynamoDB by key, using specified configs.
 /// </summary>
 /// <param name="key">Key of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 public Document GetItem(IDictionary <string, DynamoDBEntry> key, GetItemOperationConfig config)
 {
     return(GetItemHelper(MakeKey(key), config));
 }
コード例 #25
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="cancellationToken">Token which can be used to cancel the task.</param>
 /// <returns>A Task that can be used to poll or wait for results, or both.</returns>
 public Task <Document> GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(AsyncRunner.Run(() => GetItemHelper(MakeKey(hashKey, rangeKey), config, true), cancellationToken));
 }
コード例 #26
0
 /// <summary>
 /// Gets a document from DynamoDB by hash primary key, using specified configs.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 public Document GetItem(Primitive hashKey, GetItemOperationConfig config = null)
 {
     return(GetItem(hashKey, null, config));
 }
コード例 #27
0
ファイル: Table.Sync.cs プロジェクト: rajdotnet/aws-sdk-net
 /// <summary>
 /// Gets a document from DynamoDB by hash primary key, using specified configs.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <returns>Document from DynamoDB.</returns>
 public Document GetItem(Primitive hashKey, GetItemOperationConfig config = null)
 {
     return GetItem(hashKey, null, config);
 }
コード例 #28
0
ファイル: Table.cs プロジェクト: johnryork/aws-sdk-unity
        internal Document GetItemHelper(Key key, GetItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new GetItemOperationConfig();
            var request = new GetItemRequest
            {
                TableName = TableName,
                Key = key,
                ConsistentRead = currentConfig.ConsistentRead
            };

            ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(isAsync ?
                new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                new RequestEventHandler(UserAgentRequestEventHandlerSync)
                );
            if (currentConfig.AttributesToGet != null)
                request.AttributesToGet = currentConfig.AttributesToGet;

            var result = DDBClient.GetItem(request);
            var attributeMap = result.Item;
            if (attributeMap == null || attributeMap.Count == 0)
                return null;
            return Document.FromAttributeMap(attributeMap);
        }
コード例 #29
0
ファイル: Table.Async.cs プロジェクト: rajdotnet/aws-sdk-net
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Table.GetItem"/>
 /// </summary>
 /// <param name="key">Ley of the document.</param>
 /// <param name="config">Configuration to use.</param>
 /// <param name="cancellationToken">Token which can be used to cancel the task.</param>
 /// <returns>A Task that can be used to poll or wait for results, or both.</returns>
 public Task<Document> GetItemAsync(IDictionary<string, DynamoDBEntry> key, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
 {
     return AsyncRunner.Run(() => GetItemHelper(MakeKey(key), config, true), cancellationToken);
 }