コード例 #1
0
        /// <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 virtual BatchDeleteAttributesResponse BatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            var marshaller   = BatchDeleteAttributesRequestMarshaller.Instance;
            var unmarshaller = BatchDeleteAttributesResponseUnmarshaller.Instance;

            return(Invoke <BatchDeleteAttributesRequest, BatchDeleteAttributesResponse>(request, marshaller, unmarshaller));
        }
コード例 #2
0
        /// <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));
        }
コード例 #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the BatchDeleteAttributes operation.
        /// <seealso cref="M:Amazon.SimpleDB.AmazonSimpleDB.BatchDeleteAttributes"/>
        /// </summary>
        /// <param name="request">The BatchDeleteAttributesRequest that defines the parameters of
        /// the operation.</param>
        public void BeginBatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            IDictionary <string, string> parameters = ConvertBatchDeleteAttributes(request);
            SDBAsyncResult result = new SDBAsyncResult(parameters, null);

            invoke <BatchDeleteAttributesResponse>(result);
        }
コード例 #4
0
        /// <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));
        }
コード例 #5
0
        internal virtual BatchDeleteAttributesResponse BatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = BatchDeleteAttributesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = BatchDeleteAttributesResponseUnmarshaller.Instance;

            return(Invoke <BatchDeleteAttributesResponse>(request, options));
        }
コード例 #6
0
		internal BatchDeleteAttributesResponse BatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            var task = BatchDeleteAttributesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
コード例 #7
0
 /// <summary>
 /// Deletes multiple items based on their ids
 /// </summary>
 public async Task BatchDeleteItemsAsync(string[] ids)
 {
     try
     {
         //if the list attributes is set to null it is going to delete all the attributes(the entire item),
         //otherwise it is going to delete only the specified attributes in the items and not the entire item
         var deletableItems = ids.Select(id => new DeletableItem(id, null)).ToList();
         var request        = new BatchDeleteAttributesRequest(_simpleDbDomain, deletableItems);
         await _client.BatchDeleteAttributesAsync(request);
     }
     catch (AmazonSimpleDBException e)
     {
         Console.WriteLine(e.StackTrace);
         throw;
     }
 }
コード例 #8
0
        private static IDictionary <string, string> ConvertBatchDeleteAttributes(BatchDeleteAttributesRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "BatchDeleteAttributes";
            if (request.IsSetDomainName())
            {
                parameters["DomainName"] = request.DomainName;
            }
            List <DeleteableItem> batchDeleteAttributesRequestItemList = request.Item;
            int batchDeleteAttributesRequestItemListIndex = 1;

            foreach (DeleteableItem batchDeleteAttributesRequestItem in batchDeleteAttributesRequestItemList)
            {
                if (batchDeleteAttributesRequestItem.IsSetItemName())
                {
                    parameters[String.Concat("Item", ".", batchDeleteAttributesRequestItemListIndex, ".", "ItemName")] = batchDeleteAttributesRequestItem.ItemName;
                }
                List <Attribute> itemAttributeList = batchDeleteAttributesRequestItem.Attribute;
                int itemAttributeListIndex         = 1;
                foreach (Attribute itemAttribute in itemAttributeList)
                {
                    if (itemAttribute.IsSetName())
                    {
                        parameters[String.Concat("Item", ".", batchDeleteAttributesRequestItemListIndex, ".", "Attribute", ".", itemAttributeListIndex, ".", "Name")] = itemAttribute.Name;
                    }
                    if (itemAttribute.IsSetValue())
                    {
                        parameters[String.Concat("Item", ".", batchDeleteAttributesRequestItemListIndex, ".", "Attribute", ".", itemAttributeListIndex, ".", "Value")] = itemAttribute.Value;
                    }

                    itemAttributeListIndex++;
                }

                batchDeleteAttributesRequestItemListIndex++;
            }

            return(parameters);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        /// <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>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the BatchDeleteAttributes service method, as returned by SimpleDB.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/sdb-2009-04-15/BatchDeleteAttributes">REST API Reference for BatchDeleteAttributes Operation</seealso>
        public virtual Task <BatchDeleteAttributesResponse> BatchDeleteAttributesAsync(BatchDeleteAttributesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = BatchDeleteAttributesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = BatchDeleteAttributesResponseUnmarshaller.Instance;

            return(InvokeAsync <BatchDeleteAttributesResponse>(request, options, cancellationToken));
        }
コード例 #11
0
 /// <summary>
 /// Batch Delete Attributes.
 /// <seealso cref="M:Amazon.SimpleDB.AmazonSimpleDB.BatchDeleteAttributes"/>
 /// </summary>
 /// <param name="request">The BatchDeleteAttributesRequest that defines the parameters of
 /// the operation.</param>
 public void BatchDeleteAttributes(BatchDeleteAttributesRequest request)
 {
     BeginBatchDeleteAttributes(request);
 }
コード例 #12
0
ファイル: CloudAccount.cs プロジェクト: waffle-iron/nequeo
 /// <summary>
 /// Batch delete data from domain (table) and row (item).
 /// </summary>
 /// <param name="batchAttributes">Batch delete attributes request.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>The async task.</returns>
 public async Task <BatchDeleteAttributesResponse> BatchDeleteAttributesAsync(BatchDeleteAttributesRequest batchAttributes, CancellationToken cancellationToken)
 {
     return(await _client.BatchDeleteAttributesAsync(batchAttributes, cancellationToken));
 }
コード例 #13
0
ファイル: CloudAccount.cs プロジェクト: waffle-iron/nequeo
 /// <summary>
 /// Batch delete data from domain (table) and row (item).
 /// </summary>
 /// <param name="batchAttributes">Batch delete attributes request.</param>
 /// <returns>The async task.</returns>
 public async Task <BatchDeleteAttributesResponse> BatchDeleteAttributesAsync(BatchDeleteAttributesRequest batchAttributes)
 {
     return(await _client.BatchDeleteAttributesAsync(batchAttributes));
 }