Example #1
0
        internal Document DeleteHelper(Key key, DeleteItemOperationConfig config, bool isAsync)
        {
            var currentConfig = config ?? new DeleteItemOperationConfig();

            var req = new DeleteItemRequest
            {
                TableName = TableName,
                Key = key
            };
            req.BeforeRequestEvent += isAsync ?
                new RequestEventHandler(UserAgentRequestEventHandlerAsync) :
                new RequestEventHandler(UserAgentRequestEventHandlerSync);
            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                req.ReturnValues = EnumToStringMapper.Convert(currentConfig.ReturnValues);
            }
            if (currentConfig.Expected != null)
            {
                req.Expected = currentConfig.Expected.ToExpectedAttributeMap();
            }

            var attributes = DDBClient.DeleteItem(req).DeleteItemResult.Attributes;

            Document ret = null;
            if (currentConfig.ReturnValues == ReturnValues.AllOldAttributes)
            {
                ret = Document.FromAttributeMap(attributes);
            }
            return ret;
        }
 IAsyncResult invokeDeleteItem(DeleteItemRequest deleteItemRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DeleteItemRequestMarshaller().Marshall(deleteItemRequest);
     var unmarshaller = DeleteItemResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteItem operation.
 /// <seealso cref="Amazon.DynamoDB.AmazonDynamoDB.DeleteItem"/>
 /// </summary>
 /// 
 /// <param name="deleteItemRequest">Container for the necessary parameters to execute the DeleteItem operation on AmazonDynamoDB.</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 EndDeleteItem
 ///         operation.</returns>
 public IAsyncResult BeginDeleteItem(DeleteItemRequest deleteItemRequest, AsyncCallback callback, object state)
 {
     return invokeDeleteItem(deleteItemRequest, callback, state, false);
 }
 /// <summary>
 /// <para>Deletes a single item in a table by primary key.</para> <para>You can perform a conditional delete operation that deletes the item if
 /// it exists, or if it has an expected attribute value.</para>
 /// </summary>
 /// 
 /// <param name="deleteItemRequest">Container for the necessary parameters to execute the DeleteItem service method on AmazonDynamoDB.</param>
 /// 
 /// <returns>The response from the DeleteItem service method, as returned by AmazonDynamoDB.</returns>
 /// 
 /// <exception cref="ProvisionedThroughputExceededException"/>
 /// <exception cref="ConditionalCheckFailedException"/>
 /// <exception cref="InternalServerErrorException"/>
 /// <exception cref="ResourceNotFoundException"/>
 public DeleteItemResponse DeleteItem(DeleteItemRequest deleteItemRequest)
 {
     IAsyncResult asyncResult = invokeDeleteItem(deleteItemRequest, null, null, true);
     return EndDeleteItem(asyncResult);
 }
 /// <summary>
 /// <para> Deletes a single item in a table by primary key. You can perform a conditional delete operation that deletes the item if it exists,
 /// or if it has an expected attribute value. </para>
 /// </summary>
 /// 
 /// <param name="deleteItemRequest">Container for the necessary parameters to execute the DeleteItem service method on AmazonDynamoDB.</param>
 /// 
 /// <returns>The response from the DeleteItem service method, as returned by AmazonDynamoDB.</returns>
 /// 
 /// <exception cref="ProvisionedThroughputExceededException"/>
 /// <exception cref="ConditionalCheckFailedException"/>
 /// <exception cref="InternalServerErrorException"/>
 /// <exception cref="ResourceNotFoundException"/>
 public DeleteItemResponse DeleteItem(DeleteItemRequest deleteItemRequest)
 {
     IRequest<DeleteItemRequest> request = new DeleteItemRequestMarshaller().Marshall(deleteItemRequest);
     DeleteItemResponse response = Invoke<DeleteItemRequest, DeleteItemResponse> (request, this.signer, DeleteItemResponseUnmarshaller.GetInstance());
     return response;
 }