コード例 #1
0
        public IRequest Marshall(DeleteAttributesRequest deleteAttributesRequest)
        {
            IRequest request = new DefaultRequest(deleteAttributesRequest, "AmazonSimpleDB");

            request.Parameters.Add("Action", "DeleteAttributes");
            request.Parameters.Add("Version", "2009-04-15");
            if (deleteAttributesRequest != null && deleteAttributesRequest.IsSetDomainName())
            {
                request.Parameters.Add("DomainName", StringUtils.FromString(deleteAttributesRequest.DomainName));
            }
            if (deleteAttributesRequest != null && deleteAttributesRequest.IsSetItemName())
            {
                request.Parameters.Add("ItemName", StringUtils.FromString(deleteAttributesRequest.ItemName));
            }

            if (deleteAttributesRequest != null)
            {
                List <Attribute> attributesList = deleteAttributesRequest.Attributes;
                int attributesListIndex         = 1;
                foreach (Attribute attributesListValue in attributesList)
                {
                    if (attributesListValue != null && attributesListValue.IsSetName())
                    {
                        request.Parameters.Add("Attribute." + attributesListIndex + ".Name", StringUtils.FromString(attributesListValue.Name));
                    }
                    if (attributesListValue != null && attributesListValue.IsSetAlternateNameEncoding())
                    {
                        request.Parameters.Add("Attribute." + attributesListIndex + ".AlternateNameEncoding", StringUtils.FromString(attributesListValue.AlternateNameEncoding));
                    }
                    if (attributesListValue != null && attributesListValue.IsSetValue())
                    {
                        request.Parameters.Add("Attribute." + attributesListIndex + ".Value", StringUtils.FromString(attributesListValue.Value));
                    }
                    if (attributesListValue != null && attributesListValue.IsSetAlternateValueEncoding())
                    {
                        request.Parameters.Add("Attribute." + attributesListIndex + ".AlternateValueEncoding", StringUtils.FromString(attributesListValue.AlternateValueEncoding));
                    }

                    attributesListIndex++;
                }
            }
            if (deleteAttributesRequest != null)
            {
                UpdateCondition expected = deleteAttributesRequest.Expected;
                if (expected != null && expected.IsSetName())
                {
                    request.Parameters.Add("Expected.Name", StringUtils.FromString(expected.Name));
                }
                if (expected != null && expected.IsSetValue())
                {
                    request.Parameters.Add("Expected.Value", StringUtils.FromString(expected.Value));
                }
                if (expected != null && expected.IsSetExists())
                {
                    request.Parameters.Add("Expected.Exists", StringUtils.FromBool(expected.Exists));
                }
            }

            return(request);
        }
コード例 #2
0
        public IRequest Marshall(PutAttributesRequest putAttributesRequest)
        {
            IRequest request = new DefaultRequest(putAttributesRequest, "AmazonSimpleDB");

            request.Parameters.Add("Action", "PutAttributes");
            request.Parameters.Add("Version", "2009-04-15");
            if (putAttributesRequest != null && putAttributesRequest.IsSetDomainName())
            {
                request.Parameters.Add("DomainName", StringUtils.FromString(putAttributesRequest.DomainName));
            }
            if (putAttributesRequest != null && putAttributesRequest.IsSetItemName())
            {
                request.Parameters.Add("ItemName", StringUtils.FromString(putAttributesRequest.ItemName));
            }

            if (putAttributesRequest != null)
            {
                List <ReplaceableAttribute> attributesList = putAttributesRequest.Attributes;
                int attributesListIndex = 1;
                foreach (ReplaceableAttribute attributesListValue in attributesList)
                {
                    if (attributesListValue != null && attributesListValue.IsSetName())
                    {
                        request.Parameters.Add("Attribute." + attributesListIndex + ".Name", StringUtils.FromString(attributesListValue.Name));
                    }
                    if (attributesListValue != null && attributesListValue.IsSetValue())
                    {
                        request.Parameters.Add("Attribute." + attributesListIndex + ".Value", StringUtils.FromString(attributesListValue.Value));
                    }
                    if (attributesListValue != null && attributesListValue.IsSetReplace())
                    {
                        request.Parameters.Add("Attribute." + attributesListIndex + ".Replace", StringUtils.FromBool(attributesListValue.Replace));
                    }

                    attributesListIndex++;
                }
            }
            if (putAttributesRequest != null)
            {
                UpdateCondition expected = putAttributesRequest.Expected;
                if (expected != null && expected.IsSetName())
                {
                    request.Parameters.Add("Expected.Name", StringUtils.FromString(expected.Name));
                }
                if (expected != null && expected.IsSetValue())
                {
                    request.Parameters.Add("Expected.Value", StringUtils.FromString(expected.Value));
                }
                if (expected != null && expected.IsSetExists())
                {
                    request.Parameters.Add("Expected.Exists", StringUtils.FromBool(expected.Exists));
                }
            }

            return(request);
        }
コード例 #3
0
        /**
         * Convert DeleteAttributesRequest to name value pairs
         */
        private static IDictionary <string, string> ConvertDeleteAttributes(DeleteAttributesRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "DeleteAttributes";
            if (request.IsSetDomainName())
            {
                parameters["DomainName"] = request.DomainName;
            }
            if (request.IsSetItemName())
            {
                parameters["ItemName"] = request.ItemName;
            }
            List <Attribute> deleteAttributesRequestAttributeList = request.Attribute;
            int deleteAttributesRequestAttributeListIndex         = 1;

            foreach (Attribute deleteAttributesRequestAttribute in deleteAttributesRequestAttributeList)
            {
                if (deleteAttributesRequestAttribute.IsSetName())
                {
                    parameters[String.Concat("Attribute", ".", deleteAttributesRequestAttributeListIndex, ".", "Name")] = deleteAttributesRequestAttribute.Name;
                }
                if (deleteAttributesRequestAttribute.IsSetValue())
                {
                    parameters[String.Concat("Attribute", ".", deleteAttributesRequestAttributeListIndex, ".", "Value")] = deleteAttributesRequestAttribute.Value;
                }
                if (deleteAttributesRequestAttribute.IsSetNameEncoding())
                {
                    parameters[String.Concat("Attribute", ".", deleteAttributesRequestAttributeListIndex, ".", "NameEncoding")] = deleteAttributesRequestAttribute.NameEncoding;
                }
                if (deleteAttributesRequestAttribute.IsSetValueEncoding())
                {
                    parameters[String.Concat("Attribute", ".", deleteAttributesRequestAttributeListIndex, ".", "ValueEncoding")] = deleteAttributesRequestAttribute.ValueEncoding;
                }

                deleteAttributesRequestAttributeListIndex++;
            }
            if (request.IsSetExpected())
            {
                UpdateCondition deleteAttributesRequestExpected = request.Expected;
                if (deleteAttributesRequestExpected.IsSetName())
                {
                    parameters[String.Concat("Expected", ".", "Name")] = deleteAttributesRequestExpected.Name;
                }
                if (deleteAttributesRequestExpected.IsSetValue())
                {
                    parameters[String.Concat("Expected", ".", "Value")] = deleteAttributesRequestExpected.Value;
                }
                if (deleteAttributesRequestExpected.IsSetExists())
                {
                    parameters[String.Concat("Expected", ".", "Exists")] = deleteAttributesRequestExpected.Exists.ToString().ToLower(CultureInfo.InvariantCulture);
                }
            }

            return(parameters);
        }
コード例 #4
0
        private static IDictionary <string, string> ConvertDeleteAttributes(DeleteAttributesRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "DeleteAttributes";
            if (request.IsSetDomainName())
            {
                dictionary["DomainName"] = request.DomainName;
            }
            if (request.IsSetItemName())
            {
                dictionary["ItemName"] = request.ItemName;
            }
            List <Amazon.SimpleDB.Model.Attribute> list = request.Attribute;
            int num = 1;

            foreach (Amazon.SimpleDB.Model.Attribute attribute in list)
            {
                if (attribute.IsSetName())
                {
                    dictionary[string.Concat(new object[] { "Attribute", ".", num, ".", "Name" })] = attribute.Name;
                }
                if (attribute.IsSetValue())
                {
                    dictionary[string.Concat(new object[] { "Attribute", ".", num, ".", "Value" })] = attribute.Value;
                }
                if (attribute.IsSetNameEncoding())
                {
                    dictionary[string.Concat(new object[] { "Attribute", ".", num, ".", "NameEncoding" })] = attribute.NameEncoding;
                }
                if (attribute.IsSetValueEncoding())
                {
                    dictionary[string.Concat(new object[] { "Attribute", ".", num, ".", "ValueEncoding" })] = attribute.ValueEncoding;
                }
                num++;
            }
            if (request.IsSetExpected())
            {
                UpdateCondition expected = request.Expected;
                if (expected.IsSetName())
                {
                    dictionary["Expected" + "." + "Name"] = expected.Name;
                }
                if (expected.IsSetValue())
                {
                    dictionary["Expected" + "." + "Value"] = expected.Value;
                }
                if (expected.IsSetExists())
                {
                    dictionary["Expected" + "." + "Exists"] = expected.Exists.ToString().ToLower();
                }
            }
            return(dictionary);
        }
コード例 #5
0
        /**
         * Convert PutAttributesRequest to name value pairs
         */
        private static IDictionary <string, string> ConvertPutAttributes(PutAttributesRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "PutAttributes";
            if (request.IsSetDomainName())
            {
                parameters["DomainName"] = request.DomainName;
            }
            if (request.IsSetItemName())
            {
                parameters["ItemName"] = request.ItemName;
            }
            List <ReplaceableAttribute> putAttributesRequestAttributeList = request.Attribute;
            int putAttributesRequestAttributeListIndex = 1;

            foreach (ReplaceableAttribute putAttributesRequestAttribute in putAttributesRequestAttributeList)
            {
                if (putAttributesRequestAttribute.IsSetName())
                {
                    parameters[String.Concat("Attribute", ".", putAttributesRequestAttributeListIndex, ".", "Name")] = putAttributesRequestAttribute.Name;
                }
                if (putAttributesRequestAttribute.IsSetValue())
                {
                    parameters[String.Concat("Attribute", ".", putAttributesRequestAttributeListIndex, ".", "Value")] = putAttributesRequestAttribute.Value;
                }
                if (putAttributesRequestAttribute.IsSetReplace())
                {
                    parameters[String.Concat("Attribute", ".", putAttributesRequestAttributeListIndex,
                                             ".", "Replace")] = putAttributesRequestAttribute.Replace.ToString().ToLower(CultureInfo.InvariantCulture);
                }

                putAttributesRequestAttributeListIndex++;
            }
            if (request.IsSetExpected())
            {
                UpdateCondition putAttributesRequestExpected = request.Expected;
                if (putAttributesRequestExpected.IsSetName())
                {
                    parameters[String.Concat("Expected", ".", "Name")] = putAttributesRequestExpected.Name;
                }
                if (putAttributesRequestExpected.IsSetValue())
                {
                    parameters[String.Concat("Expected", ".", "Value")] = putAttributesRequestExpected.Value;
                }
                if (putAttributesRequestExpected.IsSetExists())
                {
                    parameters[String.Concat("Expected", ".", "Exists")] = putAttributesRequestExpected.Exists.ToString().ToLower(CultureInfo.InvariantCulture);
                }
            }

            return(parameters);
        }