Container for the parameters to the BatchDeleteAttributes operation. Performs multiple DeleteAttributes operations in a single call, which reduces round trips and latencies. This enables Amazon SimpleDB to optimize requests, which generally yields better throughput.

The following limitations are enforced for this operation:

  • 1 MB request size
  • 25 item limit per BatchDeleteAttributes operation

Inheritance: AmazonSimpleDBRequest
		internal BatchDeleteAttributesResponse BatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            var task = BatchDeleteAttributesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// <para> Performs multiple DeleteAttributes operations in a single call, which reduces round trips and latencies. This enables Amazon SimpleDB
        /// to optimize requests, which generally yields better throughput. </para> <para><b>NOTE:</b> If you specify BatchDeleteAttributes without
        /// attributes or values, all the attributes for the item are deleted. BatchDeleteAttributes is an idempotent operation; running it multiple
        /// times on the same item or attribute doesn't result in an error. The BatchDeleteAttributes operation succeeds or fails in its entirety. There
        /// are no partial deletes. You can execute multiple BatchDeleteAttributes operations and other operations in parallel. However, large numbers
        /// of concurrent BatchDeleteAttributes calls can result in Service Unavailable (503) responses. This operation is vulnerable to exceeding the
        /// maximum URL size when making a REST request using the HTTP GET method. This operation does not support conditions using Expected.X.Name,
        /// Expected.X.Value, or Expected.X.Exists. </para> <para> The following limitations are enforced for this operation:
        /// <ul>
        /// <li>1 MB request size</li>
        /// <li>25 item limit per BatchDeleteAttributes operation</li>
        /// 
        /// </ul>
        /// </para>
        /// </summary>
        /// 
        /// <param name="batchDeleteAttributesRequest">Container for the necessary parameters to execute the BatchDeleteAttributes service method on
        /// AmazonSimpleDB.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<BatchDeleteAttributesResponse> BatchDeleteAttributesAsync(BatchDeleteAttributesRequest batchDeleteAttributesRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new BatchDeleteAttributesRequestMarshaller();
            var unmarshaller = BatchDeleteAttributesResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, BatchDeleteAttributesRequest, BatchDeleteAttributesResponse>(batchDeleteAttributesRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
	    IAsyncResult AmazonSimpleDB.BeginBatchDeleteAttributes(BatchDeleteAttributesRequest request, AsyncCallback callback, object state)
	    {
	        throw new NotImplementedException();
	    }
	    BatchDeleteAttributesResponse AmazonSimpleDB.BatchDeleteAttributes(BatchDeleteAttributesRequest request)
	    {
	        throw new NotImplementedException();
	    }
        /// <summary>
        /// Performs multiple DeleteAttributes operations in a single call, which reduces round
        /// trips and latencies. This enables Amazon SimpleDB to optimize requests, which generally
        /// yields better throughput. 
        /// 
        ///  
        /// <para>
        ///  The following limitations are enforced for this operation: <ul> <li>1 MB request
        /// size</li> <li>25 item limit per BatchDeleteAttributes operation</li> </ul> 
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the BatchDeleteAttributes service method.</param>
        /// 
        /// <returns>The response from the BatchDeleteAttributes service method, as returned by SimpleDB.</returns>
        public BatchDeleteAttributesResponse BatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            var marshaller = new BatchDeleteAttributesRequestMarshaller();
            var unmarshaller = BatchDeleteAttributesResponseUnmarshaller.Instance;

            return Invoke<BatchDeleteAttributesRequest,BatchDeleteAttributesResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the BatchDeleteAttributes operation.
        /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the BatchDeleteAttributes operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<BatchDeleteAttributesResponse> BatchDeleteAttributesAsync(BatchDeleteAttributesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new BatchDeleteAttributesRequestMarshaller();
            var unmarshaller = BatchDeleteAttributesResponseUnmarshaller.Instance;

            return InvokeAsync<BatchDeleteAttributesRequest,BatchDeleteAttributesResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        public void ZAttributeTestC_BatchDeleteAttribute()
        {
            bool hasCallbackArrived = false;
            bool actualValue = false;
            bool expectedValue = true;
            SimpleDBResponseEventHandler<object, ResponseEventArgs> handler = null;

            handler = delegate(object sender, ResponseEventArgs args)
            {
                //Unhook from event.
                _client.OnSimpleDBResponse -= handler;
                BatchDeleteAttributesResponse response = args.Response as BatchDeleteAttributesResponse;
                if (null != response)
                {
                    actualValue = true;
                }
                hasCallbackArrived = true;
            };

            //Hook to event
            _client.OnSimpleDBResponse += handler;

            BatchDeleteAttributesRequest deleteRequest = new BatchDeleteAttributesRequest() { DomainName = _domainName_UnitTesting };
            List<DeleteableItem> deleteItem = deleteRequest.Item;

            #region Commented
            //Commented because there was change in the property defination during resolving FxCop warning

            //List<Amazon.SimpleDB.Model.Attribute> itemA = new List<Amazon.SimpleDB.Model.Attribute>();
            //itemA.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Subcategory").WithValue("Private Limited"));

            //List<Amazon.SimpleDB.Model.Attribute> itemB = new List<Amazon.SimpleDB.Model.Attribute>();
            //itemB.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Size").WithValue("Large"));

            //deleteItem.Add(new DeleteableItem() { Attribute = itemA, ItemName = "ItemA" });
            //deleteItem.Add(new DeleteableItem() { Attribute = itemB, ItemName = "ItemB" });
            #endregion

            DeleteableItem item1 = new DeleteableItem { ItemName = "ItemA" };
            item1.Attribute.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Subcategory").WithValue("Private Limited"));
            DeleteableItem item2 = new DeleteableItem { ItemName = "ItemB" };
            item2.Attribute.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Size").WithValue("Large"));
            deleteItem.Add(item1);
            deleteItem.Add(item2);

            _client.BatchDeleteAttributes(deleteRequest);

            EnqueueConditional(() => hasCallbackArrived);
            EnqueueCallback(() => Assert.IsTrue(expectedValue == actualValue));
            EnqueueTestComplete();
        }
        public void ZAttributeTestC_BatchDeleteAttribute_ForException_WithoutItems()
        {
            bool hasCallbackArrived = false;
            string actualValue = string.Empty;
            string expectedValue = "No items specified";
            SimpleDBResponseEventHandler<object, ResponseEventArgs> handler = null;

            handler = delegate(object sender, ResponseEventArgs args)
            {
                //Unhook from event.
                _client.OnSimpleDBResponse -= handler;
                AmazonSimpleDBException response = args.Response as AmazonSimpleDBException;
                if (null != response)
                {
                    actualValue = response.Message.Trim();
                }
                hasCallbackArrived = true;
            };

            //Hook to event
            _client.OnSimpleDBResponse += handler;

            BatchDeleteAttributesRequest deleteRequest = new BatchDeleteAttributesRequest() { DomainName = _domainName_UnitTesting };
            _client.BatchDeleteAttributes(deleteRequest);

            EnqueueConditional(() => hasCallbackArrived);
            EnqueueCallback(() => Assert.IsTrue(expectedValue == actualValue));
            EnqueueTestComplete();
        }
 /// <summary>
 /// Initiates the asynchronous execution of the BatchDeleteAttributes operation.
 /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB.BatchDeleteAttributes"/>
 /// </summary>
 /// 
 /// <param name="batchDeleteAttributesRequest">Container for the necessary parameters to execute the BatchDeleteAttributes operation on
 ///          AmazonSimpleDB.</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>
 public IAsyncResult BeginBatchDeleteAttributes(BatchDeleteAttributesRequest batchDeleteAttributesRequest, AsyncCallback callback, object state)
 {
     return invokeBatchDeleteAttributes(batchDeleteAttributesRequest, callback, state, false);
 }
 IAsyncResult invokeBatchDeleteAttributes(BatchDeleteAttributesRequest batchDeleteAttributesRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new BatchDeleteAttributesRequestMarshaller().Marshall(batchDeleteAttributesRequest);
     var unmarshaller = BatchDeleteAttributesResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// <para> Performs multiple DeleteAttributes operations in a single call, which reduces round trips and latencies. This enables Amazon SimpleDB
 /// to optimize requests, which generally yields better throughput. </para> <para><b>NOTE:</b> If you specify BatchDeleteAttributes without
 /// attributes or values, all the attributes for the item are deleted. BatchDeleteAttributes is an idempotent operation; running it multiple
 /// times on the same item or attribute doesn't result in an error. The BatchDeleteAttributes operation succeeds or fails in its entirety. There
 /// are no partial deletes. You can execute multiple BatchDeleteAttributes operations and other operations in parallel. However, large numbers
 /// of concurrent BatchDeleteAttributes calls can result in Service Unavailable (503) responses. This operation is vulnerable to exceeding the
 /// maximum URL size when making a REST request using the HTTP GET method. This operation does not support conditions using Expected.X.Name,
 /// Expected.X.Value, or Expected.X.Exists. </para> <para> The following limitations are enforced for this operation:
 /// <ul>
 /// <li>1 MB request size</li>
 /// <li>25 item limit per BatchDeleteAttributes operation</li>
 /// 
 /// </ul>
 /// </para>
 /// </summary>
 /// 
 /// <param name="batchDeleteAttributesRequest">Container for the necessary parameters to execute the BatchDeleteAttributes service method on
 ///          AmazonSimpleDB.</param>
 /// 
 public BatchDeleteAttributesResponse BatchDeleteAttributes(BatchDeleteAttributesRequest batchDeleteAttributesRequest)
 {
     IAsyncResult asyncResult = invokeBatchDeleteAttributes(batchDeleteAttributesRequest, null, null, true);
     return EndBatchDeleteAttributes(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the BatchDeleteAttributes operation.
        /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB.BatchDeleteAttributes"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the BatchDeleteAttributes operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public Task<BatchDeleteAttributesResponse> BatchDeleteAttributesAsync(BatchDeleteAttributesRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new BatchDeleteAttributesRequestMarshaller();
            var unmarshaller = BatchDeleteAttributesResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, BatchDeleteAttributesRequest, BatchDeleteAttributesResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
        /// <summary>
        /// <para> Performs multiple DeleteAttributes operations in a single call, which reduces round trips and latencies. This enables Amazon SimpleDB
        /// to optimize requests, which generally yields better throughput. </para> <para><b>NOTE:</b> If you specify BatchDeleteAttributes without
        /// attributes or values, all the attributes for the item are deleted. BatchDeleteAttributes is an idempotent operation; running it multiple
        /// times on the same item or attribute doesn't result in an error. The BatchDeleteAttributes operation succeeds or fails in its entirety. There
        /// are no partial deletes. You can execute multiple BatchDeleteAttributes operations and other operations in parallel. However, large numbers
        /// of concurrent BatchDeleteAttributes calls can result in Service Unavailable (503) responses. This operation is vulnerable to exceeding the
        /// maximum URL size when making a REST request using the HTTP GET method. This operation does not support conditions using Expected.X.Name,
        /// Expected.X.Value, or Expected.X.Exists. </para> <para> The following limitations are enforced for this operation:
        /// <ul>
        /// <li>1 MB request size</li>
        /// <li>25 item limit per BatchDeleteAttributes operation</li>
        /// 
        /// </ul>
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the BatchDeleteAttributes service method on
        /// AmazonSimpleDB.</param>
		public BatchDeleteAttributesResponse BatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            var task = BatchDeleteAttributesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        private void btnBatchDeleteAttributes_Click(object sender, RoutedEventArgs e)
        {
            SimpleDBResponseEventHandler<object, ResponseEventArgs> responseHandler = null;

            responseHandler = delegate(object senderOriginal, ResponseEventArgs args)
            {
                ISimpleDBResponse result = args.Response;
                SimpleDB.Client.OnSimpleDBResponse -= responseHandler;
                this.Dispatcher.BeginInvoke(() =>
                {
                    BatchDeleteAttributesResponse response = result as BatchDeleteAttributesResponse;

                    if (null != response)
                    {
                        this.BatchDeleteMessage = "Batch attributes deleted successfully";
                    }
                    else
                    {
                        AmazonSimpleDBException exception = result as AmazonSimpleDBException;
                        if (null != exception)
                            this.BatchDeleteMessage = "Error: " + exception.Message;
                    }
                });
            };
            this.BatchDeleteMessage = "Please wait...";
            SimpleDB.Client.OnSimpleDBResponse += responseHandler;

            BatchDeleteAttributesRequest deleteRequest = new BatchDeleteAttributesRequest() { DomainName = this.DomainName };
            List<DeleteableItem> deleteItem = deleteRequest.Item;

            //List<Amazon.SimpleDB.Model.Attribute> attributeItem1 = new List<Amazon.SimpleDB.Model.Attribute>();
            //List<Amazon.SimpleDB.Model.Attribute> attributeItem2 = new List<Amazon.SimpleDB.Model.Attribute>();

            List<AttributeAndValue> aAndV1 = GetListAttributeAndValueFromString(this.AttributesAndValuesToPut);
            DeleteableItem item1 = new DeleteableItem { ItemName = "OneAttribute" };
            DeleteableItem item2 = new DeleteableItem { ItemName = "TwoAttribute" };

            int index = 0;
            foreach (var item in aAndV1)
            {
                if (index <= aAndV1.Count / 2)
                    item1.Attribute.Add(new Amazon.SimpleDB.Model.Attribute().WithName(item.Attribute).WithValue(item.Value));
                else
                    item2.Attribute.Add(new Amazon.SimpleDB.Model.Attribute().WithName(item.Attribute).WithValue(item.Value));
                index++;
            }

            //attributeItem1.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Category").WithValue("Clothes"));
            //attributeItem1.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Subcategory").WithValue("Sweater"));

            //attributeItem2.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Size").WithValue("Small"));
            //attributeItem2.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Color").WithValue("Siamese"));

            #region Commented
            //Commented because of changes in the Attribute property definition change during resolving FxCop warnings.
            //deleteItem.Add(new DeleteableItem() { Attribute = attributeItem1, ItemName = "OneAttribute" });
            //deleteItem.Add(new DeleteableItem() { Attribute = attributeItem2, ItemName = "TwoAttribute" });

            #endregion Commented
            deleteItem.Add(item1);
            deleteItem.Add(item2);

            SimpleDB.Client.BatchDeleteAttributes(deleteRequest);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the BatchDeleteAttributes operation.
        /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the BatchDeleteAttributes operation on AmazonSimpleDBClient.</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 EndBatchDeleteAttributes
        ///         operation.</returns>
        public IAsyncResult BeginBatchDeleteAttributes(BatchDeleteAttributesRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new BatchDeleteAttributesRequestMarshaller();
            var unmarshaller = BatchDeleteAttributesResponseUnmarshaller.Instance;

            return BeginInvoke<BatchDeleteAttributesRequest>(request, marshaller, unmarshaller,
                callback, state);
        }