Esempio n. 1
0
        public static void testCORSConfig()
        {
            CORSConfiguration corsConfig = new CORSConfiguration();

            corsConfig.corsRules = new System.Collections.Generic.List <CORSConfiguration.CORSRule>();
            for (int i = 0; i < 3; i++)
            {
                CORSConfiguration.CORSRule corsRule = new CORSConfiguration.CORSRule();
                corsRule.id             = String.Format("the {0}th", i + 1);
                corsRule.maxAgeSeconds  = 5000;
                corsRule.allowedMethods = new System.Collections.Generic.List <string>();
                corsRule.allowedMethods.Add("PUT");
                corsRule.allowedMethods.Add("DELETE");

                corsRule.allowedHeaders = new System.Collections.Generic.List <string>();
                corsRule.allowedHeaders.Add("Host");
                corsRule.allowedHeaders.Add("Authorization");

                corsRule.exposeHeaders = new System.Collections.Generic.List <string>();
                corsRule.exposeHeaders.Add("X-COS-Meta1");
                corsRule.exposeHeaders.Add("X-COS-Meta2");

                corsConfig.corsRules.Add(corsRule);
            }
            Console.WriteLine(corsConfig.GetInfo());
        }
Esempio n. 2
0
        public static void testCORSCOnfig()
        {
            CORSConfiguration corsConfig = new CORSConfiguration();

            corsConfig.corsRules = new List <CORSConfiguration.CORSRule>();
            for (int i = 0; i < 3; i++)
            {
                CORSConfiguration.CORSRule corsRule = new CORSConfiguration.CORSRule();
                corsRule.id            = (i + 1).ToString();
                corsRule.allowedOrigin = "http://www.cloud.tencent.com";
                corsRule.maxAgeSeconds = 5000;

                corsRule.allowedMethods = new List <string>();
                corsRule.allowedMethods.Add("PUT");
                corsRule.allowedMethods.Add("GET");
                corsRule.allowedMethods.Add("DELETE");

                corsRule.allowedHeaders = new List <string>();
                corsRule.allowedHeaders.Add("Host");
                corsRule.allowedHeaders.Add("Authorizition");
                corsRule.allowedHeaders.Add("Content-Length");

                corsRule.exposeHeaders = new List <string>();
                corsRule.exposeHeaders.Add("X-COS-Meta1");
                corsRule.exposeHeaders.Add("X-COS-Meta2");
                corsRule.exposeHeaders.Add("X-COS-Meta2");
                corsConfig.corsRules.Add(corsRule);
            }
            Console.WriteLine(XmlBuilder.BuildCORSConfigXML(corsConfig));
        }
Esempio n. 3
0
        /// <summary>
        /// Set CORS for specific bucket
        /// </summary>
        /// <returns></returns>
        private static async Task CreateCORSConfig()
        {
            try
            {
                // Create a new configuration request and add two rules
                CORSConfiguration configuration = new CORSConfiguration
                {
                    Rules = new List <CORSRule>
                    {
                        new CORSRule
                        {
                            Id             = "S3CORS_Rule",
                            AllowedMethods = new List <string> {
                                "PUT", "POST", "DELETE"
                            },
                            AllowedOrigins = new List <string> {
                                "https://aws-hosted-parser-app.vercel.app"
                            }
                            //    MaxAgeSeconds = 3000,
                            //    ExposeHeaders = new List<string> {"x-amz-server-side-encryption"}
                        },
                    }
                };

                // Add the configuration to the bucket.
                await PutCORSConfigurationAsync(configuration);

                // Retrieve an existing configuration.
                //configuration = await RetrieveCORSConfigurationAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        /// 获取存储桶跨域规则
        public void GetBucketCors()
        {
            //.cssg-snippet-body-start:[get-bucket-cors]
            try
            {
                string bucket = "examplebucket-1250000000"; //格式:BucketName-APPID
                GetBucketCORSRequest request = new GetBucketCORSRequest(bucket);
                //执行请求
                GetBucketCORSResult result = cosXml.GetBucketCORS(request);
                //存储桶的 CORS 配置信息
                CORSConfiguration conf = result.corsConfiguration;
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                //请求失败
                Console.WriteLine("CosClientException: " + clientEx);
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                //请求失败
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
            }

            //.cssg-snippet-body-end
        }
Esempio n. 5
0
        public static string BuildCORSConfigXML(CORSConfiguration corsConfiguration)
        {
            StringWriter      stringWriter     = new StringWriter();
            XmlWriterSettings xmlWriterSetting = new XmlWriterSettings();

            xmlWriterSetting.Indent = true;

            XmlWriter xmlWriter = XmlWriter.Create(stringWriter, xmlWriterSetting);

            xmlWriter.WriteStartDocument();

            //start to write element
            xmlWriter.WriteStartElement("CORSConfiguration");
            if (corsConfiguration.corsRules != null)
            {
                foreach (CORSConfiguration.CORSRule corsRule in corsConfiguration.corsRules)
                {
                    if (corsRule == null)
                    {
                        continue;
                    }

                    xmlWriter.WriteStartElement("CORSRule");

                    xmlWriter.WriteElementString("ID", corsRule.id);
                    xmlWriter.WriteElementString("AllowedOrigin", corsRule.allowedOrigin);
                    if (corsRule.allowedMethods != null)
                    {
                        foreach (string method in corsRule.allowedMethods)
                        {
                            xmlWriter.WriteElementString("AllowedMethod", method);
                        }
                    }
                    if (corsRule.allowedHeaders != null)
                    {
                        foreach (string header in corsRule.allowedHeaders)
                        {
                            xmlWriter.WriteElementString("AllowedHeader", header);
                        }
                    }
                    if (corsRule.exposeHeaders != null)
                    {
                        foreach (string exposeHeader in corsRule.exposeHeaders)
                        {
                            xmlWriter.WriteElementString("ExposeHeader", exposeHeader);
                        }
                    }
                    xmlWriter.WriteElementString("MaxAgeSeconds", corsRule.maxAgeSeconds.ToString());

                    xmlWriter.WriteEndElement();
                }
            }

            // end to element
            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            return(RemoveXMLHeader(stringWriter.ToString()));
        }
Esempio n. 6
0
 public PutBucketCORSRequest(string bucket)
     : base(bucket)
 {
     this.method = CosRequestMethod.PUT;
     this.queryParameters.Add("cors", null);
     corsConfiguration           = new CORSConfiguration();
     corsConfiguration.corsRules = new List <CORSConfiguration.CORSRule>();
 }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        private static async Task PutCORSConfigurationAsync(AmazonS3Client client, CORSConfiguration configuration)
        {
            PutCORSConfigurationRequest request = new ()
            {
                BucketName    = BucketName,
                Configuration = configuration,
            };

            _ = await client.PutCORSConfigurationAsync(request);
        }
Esempio n. 8
0
        public static void PutCORSConfiguration(CORSConfiguration configuration)
        {
            PutCORSConfigurationRequest request = new PutCORSConfigurationRequest
            {
                BucketName    = bucketName,
                Configuration = configuration
            };

            var response = client.PutCORSConfiguration(request);
        }
Esempio n. 9
0
        public void BuildCORSConfigXMLTest()
        {
            CORSConfiguration corsConfiguration = null;         // TODO: Initialize to an appropriate value
            string            expected          = string.Empty; // TODO: Initialize to an appropriate value
            string            actual;

            actual = XmlBuilder.BuildCORSConfigXML(corsConfiguration);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Esempio n. 10
0
        public void GetInfoTest()
        {
            CORSConfiguration target   = new CORSConfiguration(); // TODO: Initialize to an appropriate value
            string            expected = string.Empty;            // TODO: Initialize to an appropriate value
            string            actual;

            actual = target.GetInfo();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Esempio n. 11
0
        static async Task PutCORSConfigurationAsync(CORSConfiguration configuration)
        {
            PutCORSConfigurationRequest request = new PutCORSConfigurationRequest
            {
                BucketName    = bucketName,
                Configuration = configuration
            };

            var response = await s3Client.PutCORSConfigurationAsync(request);
        }
Esempio n. 12
0
 public static void ConfigureCors(this IServiceCollection services, CORSConfiguration config)
 {
     services.AddCors(options =>
     {
         options.AddPolicy("AllowCors",
                           builder =>
         {
             builder.WithOrigins(config.WithOrigin);
             builder.WithMethods(config.WithMethod);
         });
     });
 }
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration config = new HttpConfiguration();

            OAuthServerConfigurations.Register(app);

            RouteConfiguration.Register(config);

            JSONMediaTypeConfiguration.Register(config);

            CORSConfiguration.Register(app);

            app.UseWebApi(config);
        }
Esempio n. 14
0
        public void getBucketCors()
        {
            //.cssg-snippet-body-start:[get-bucket-cors]
            CosXmlConfig config = new CosXmlConfig.Builder()
                                  .SetConnectionTimeoutMs(60000) //设置连接超时时间,单位毫秒,默认45000ms
                                  .SetReadWriteTimeoutMs(40000)  //设置读写超时时间,单位毫秒,默认45000ms
                                  .IsHttps(true)                 //设置默认 HTTPS 请求
                                  .SetAppid("1253653367")        //设置腾讯云账户的账户标识 APPID
                                  .SetRegion("ap-guangzhou")     //设置一个默认的存储桶地域
                                  .Build();

            string secretId       = Environment.GetEnvironmentVariable("COS_KEY");    //云 API 密钥 SecretId
            string secretKey      = Environment.GetEnvironmentVariable("COS_SECRET"); //云 API 密钥 SecretKey
            long   durationSecond = 600;                                              //每次请求签名有效时长,单位为秒
            QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId,
                                                                                                    secretKey, durationSecond);

            CosXml cosXml = new CosXmlServer(config, qCloudCredentialProvider);

            try
            {
                string bucket = "bucket-cssg-test-dotnet-1253653367"; //格式:BucketName-APPID
                GetBucketCORSRequest request = new GetBucketCORSRequest(bucket);
                //设置签名有效时长
                request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600);
                //执行请求
                GetBucketCORSResult result = cosXml.GetBucketCORS(request);
                //存储桶的 CORS 配置信息
                CORSConfiguration conf = result.corsConfiguration;
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                //请求失败
                Console.WriteLine("CosClientException: " + clientEx);
                Assert.Null(clientEx);
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                //请求失败
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
                Assert.Null(serverEx);
            }
            //.cssg-snippet-body-end
        }
Esempio n. 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="configuration"></param>
        private static void PrintCORSRules(CORSConfiguration configuration)
        {
            Console.WriteLine();

            if (configuration is null)
            {
                Console.WriteLine("\nConfiguration is null");
                return;
            }

            Console.WriteLine($"Configuration has {configuration.Rules.Count} rules:");
            foreach (CORSRule rule in configuration.Rules)
            {
                Console.WriteLine($"Rule ID: {rule.Id}");
                Console.WriteLine($"MaxAgeSeconds: {rule.MaxAgeSeconds}");
                Console.WriteLine($"AllowedMethod: {string.Join(", ", rule.AllowedMethods.ToArray())}");
                Console.WriteLine($"AllowedOrigins: {string.Join(", ", rule.AllowedOrigins.ToArray())}");
                Console.WriteLine($"AllowedHeaders: {string.Join(", ", rule.AllowedHeaders.ToArray())}");
                Console.WriteLine($"ExposeHeader: {string.Join(", ", rule.ExposeHeaders.ToArray())}");
            }
        }
Esempio n. 16
0
        static void PrintCORSRules(CORSConfiguration configuration)
        {
            Console.WriteLine();

            if (configuration == null)
            {
                Console.WriteLine("\nConfiguration is null");
                return;
            }

            Console.WriteLine("Configuration has {0} rules:", configuration.Rules.Count);
            foreach (CORSRule rule in configuration.Rules)
            {
                Console.WriteLine("Rule ID: {0}", rule.Id);
                Console.WriteLine("MaxAgeSeconds: {0}", rule.MaxAgeSeconds);
                Console.WriteLine("AllowedMethod: {0}", string.Join(", ", rule.AllowedMethods.ToArray()));
                Console.WriteLine("AllowedOrigins: {0}", string.Join(", ", rule.AllowedOrigins.ToArray()));
                Console.WriteLine("AllowedHeaders: {0}", string.Join(", ", rule.AllowedHeaders.ToArray()));
                Console.WriteLine("ExposeHeader: {0}", string.Join(", ", rule.ExposeHeaders.ToArray()));
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Ativa regra de CORS no Bucket para permitir acesso externo via javascript.
        /// </summary>
        /// <param name="bucketName">Nome do Bucket para adicionar a regra de CORS</param>
        /// <param name="allowedOrigin">Origigem a ser ativada.</param>
        /// <returns></returns>
        public override async Task SetCorsToBucketAsync(string bucketName, string allowedOrigin)
        {
            ValidateInstance();

            // Remove configuração CORS
            var requestDelete = new DeleteCORSConfigurationRequest
            {
                BucketName = bucketName
            };
            await _client.DeleteCORSConfigurationAsync(requestDelete);

            // Cria nova configuração CORS
            var configuration = new CORSConfiguration
            {
                Rules = new List <CORSRule>
                {
                    new CORSRule
                    {
                        Id             = "enContactPutByJavascriptRule",
                        AllowedMethods = new List <string> {
                            "PUT"
                        },
                        AllowedHeaders = new List <string> {
                            "*"
                        },
                        AllowedOrigins = new List <string> {
                            allowedOrigin ?? "*"
                        }
                    },
                }
            };
            var requestCreate = new PutCORSConfigurationRequest
            {
                BucketName    = bucketName,
                Configuration = configuration
            };
            await _client.PutCORSConfigurationAsync(requestCreate).ConfigureAwait(false);
        }
Esempio n. 18
0
        private static async Task CORSConfigTestAsync()
        {
            try
            {
                // Create a new configuration request and add two rules
                CORSConfiguration configuration = new CORSConfiguration
                {
                    Rules = new System.Collections.Generic.List <CORSRule>
                    {
                        new CORSRule
                        {
                            Id             = "CORSRule1",
                            AllowedMethods = new List <string> {
                                "PUT", "POST", "DELETE"
                            },
                            AllowedOrigins = new List <string> {
                                "http://*.example.com"
                            }
                        },
                        new CORSRule
                        {
                            Id             = "CORSRule2",
                            AllowedMethods = new List <string> {
                                "GET"
                            },
                            AllowedOrigins = new List <string> {
                                "*"
                            },
                            MaxAgeSeconds = 3000,
                            ExposeHeaders = new List <string> {
                                "x-amz-server-side-encryption"
                            }
                        }
                    }
                };

                // Add the configuration to the bucket.
                await PutCORSConfigurationAsync(configuration);

                // Retrieve an existing configuration.
                configuration = await RetrieveCORSConfigurationAsync();

                // Add a new rule.
                configuration.Rules.Add(new CORSRule
                {
                    Id             = "CORSRule3",
                    AllowedMethods = new List <string> {
                        "HEAD"
                    },
                    AllowedOrigins = new List <string> {
                        "http://www.example.com"
                    }
                });

                // Add the configuration to the bucket.
                await PutCORSConfigurationAsync(configuration);

                // Verify that there are now three rules.
                configuration = await RetrieveCORSConfigurationAsync();

                Console.WriteLine();
                Console.WriteLine("Expected # of rulest=3; found:{0}", configuration.Rules.Count);
                Console.WriteLine();
                Console.WriteLine("Pause before configuration delete. To continue, click Enter...");
                Console.ReadKey();

                // Delete the configuration.
                await DeleteCORSConfigurationAsync();

                // Retrieve a nonexistent configuration.
                configuration = await RetrieveCORSConfigurationAsync();
            }
            catch (AmazonS3Exception e)
            {
                Console.WriteLine("Error encountered on server. Message:'{0}' when writing an object", e.Message);
            }
            catch (Exception e)
            {
                Console.WriteLine("Unknown encountered on server. Message:'{0}' when writing an object", e.Message);
            }
        }
 internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
 {
     corsConfiguration = new CORSConfiguration();
     XmlParse.ParseCORSConfiguration(inputStream, corsConfiguration);
 }
Esempio n. 20
0
        public void demo()
        {
            try
            {
                var sharedFile = new SharedCredentialsFile();
                if (sharedFile.TryGetProfile("basic_profile", out basicProfile) &&
                    AWSCredentialsFactory.TryGetAWSCredentials(basicProfile, sharedFile, out awsCredentials))
                {
                    using (client = new AmazonS3Client(awsCredentials, basicProfile.Region))
                    {
                        // Create a new configuration request and add two rules
                        CORSConfiguration configuration = new CORSConfiguration
                        {
                            Rules = new System.Collections.Generic.List <CORSRule>
                            {
                                new CORSRule
                                {
                                    Id             = "CORSRule1",
                                    AllowedMethods = new List <string> {
                                        "PUT", "POST", "DELETE"
                                    },
                                    AllowedOrigins = new List <string> {
                                        "http://*.example.com"
                                    }
                                },
                                new CORSRule
                                {
                                    Id             = "CORSRule2",
                                    AllowedMethods = new List <string> {
                                        "GET"
                                    },
                                    AllowedOrigins = new List <string> {
                                        "*"
                                    },
                                    MaxAgeSeconds = 3000,
                                    ExposeHeaders = new List <string> {
                                        "x-amz-server-side-encryption"
                                    }
                                }
                            }
                        };

                        // Add the configuration to the bucket
                        PutCORSConfiguration(configuration);

                        // Retrieve an existing configuration
                        configuration = GetCORSConfiguration();

                        // Add a new rule.
                        configuration.Rules.Add(new CORSRule
                        {
                            Id             = "CORSRule3",
                            AllowedMethods = new List <string> {
                                "HEAD"
                            },
                            AllowedOrigins = new List <string> {
                                "http://www.example.com"
                            }
                        });

                        // Add the configuration to the bucket
                        PutCORSConfiguration(configuration);

                        // Verify that there are now three rules
                        configuration = GetCORSConfiguration();
                        Console.WriteLine();
                        Console.WriteLine("Expected # of rulest=3; found:{0}", configuration.Rules.Count);
                        Console.WriteLine();
                        Console.WriteLine("Pause before configuration delete. To continue, click Enter...");
                        Console.ReadKey();

                        // Delete the configuration
                        DeleteCORSConfiguration();

                        // Retrieve a nonexistent configuration
                        configuration = GetCORSConfiguration();
                        Debug.Assert(configuration == null);
                    }

                    Console.WriteLine("Example complete.");
                }
            }
            catch (AmazonS3Exception amazonS3Exception)
            {
                Console.WriteLine("S3 error occurred. Exception: " + amazonS3Exception.ToString());
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.ToString());
                Console.ReadKey();
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Esempio n. 21
0
        public void CORSConfigurationConstructorTest()
        {
            CORSConfiguration target = new CORSConfiguration();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Esempio n. 22
0
 public void PutCORSConfigurationAsync(string bucketName, CORSConfiguration configuration, AmazonServiceCallback <PutCORSConfigurationRequest, PutCORSConfigurationResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }
 public Task <PutCORSConfigurationResponse> PutCORSConfigurationAsync(string bucketName, CORSConfiguration configuration, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
        public IRequest Marshall(PutCORSConfigurationRequest putCORSConfigurationRequest)
        {
            //IL_0006: Unknown result type (might be due to invalid IL or missing references)
            //IL_000c: Expected O, but got Unknown
            //IL_0339: Unknown result type (might be due to invalid IL or missing references)
            IRequest val = new DefaultRequest(putCORSConfigurationRequest, "AmazonS3");

            val.set_HttpMethod("PUT");
            val.set_ResourcePath("/" + S3Transforms.ToStringValue(putCORSConfigurationRequest.BucketName));
            val.AddSubResource("cors");
            StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture);

            using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter, new XmlWriterSettings
            {
                Encoding = Encoding.UTF8,
                OmitXmlDeclaration = true
            }))
            {
                CORSConfiguration configuration = putCORSConfigurationRequest.Configuration;
                if (configuration != null)
                {
                    xmlWriter.WriteStartElement("CORSConfiguration", "");
                    if (configuration != null)
                    {
                        List <CORSRule> rules = configuration.Rules;
                        if (rules != null && rules.Count > 0)
                        {
                            foreach (CORSRule item in rules)
                            {
                                xmlWriter.WriteStartElement("CORSRule", "");
                                if (item != null)
                                {
                                    List <string> allowedMethods = item.AllowedMethods;
                                    if (allowedMethods != null && allowedMethods.Count > 0)
                                    {
                                        foreach (string item2 in allowedMethods)
                                        {
                                            xmlWriter.WriteStartElement("AllowedMethod", "");
                                            xmlWriter.WriteValue(item2);
                                            xmlWriter.WriteEndElement();
                                        }
                                    }
                                }
                                if (item != null)
                                {
                                    List <string> allowedOrigins = item.AllowedOrigins;
                                    if (allowedOrigins != null && allowedOrigins.Count > 0)
                                    {
                                        foreach (string item3 in allowedOrigins)
                                        {
                                            xmlWriter.WriteStartElement("AllowedOrigin", "");
                                            xmlWriter.WriteValue(item3);
                                            xmlWriter.WriteEndElement();
                                        }
                                    }
                                }
                                if (item != null)
                                {
                                    List <string> exposeHeaders = item.ExposeHeaders;
                                    if (exposeHeaders != null && exposeHeaders.Count > 0)
                                    {
                                        foreach (string item4 in exposeHeaders)
                                        {
                                            xmlWriter.WriteStartElement("ExposeHeader", "");
                                            xmlWriter.WriteValue(item4);
                                            xmlWriter.WriteEndElement();
                                        }
                                    }
                                }
                                if (item != null)
                                {
                                    List <string> allowedHeaders = item.AllowedHeaders;
                                    if (allowedHeaders != null && allowedHeaders.Count > 0)
                                    {
                                        foreach (string item5 in allowedHeaders)
                                        {
                                            xmlWriter.WriteStartElement("AllowedHeader", "");
                                            xmlWriter.WriteValue(item5);
                                            xmlWriter.WriteEndElement();
                                        }
                                    }
                                }
                                if (item.IsSetMaxAgeSeconds())
                                {
                                    xmlWriter.WriteElementString("MaxAgeSeconds", "", S3Transforms.ToXmlStringValue(item.MaxAgeSeconds));
                                }
                                if (item.IsSetId())
                                {
                                    xmlWriter.WriteElementString("ID", "", S3Transforms.ToXmlStringValue(item.Id));
                                }
                                xmlWriter.WriteEndElement();
                            }
                        }
                    }
                    xmlWriter.WriteEndElement();
                }
            }
            try
            {
                string text = stringWriter.ToString();
                val.set_Content(Encoding.UTF8.GetBytes(text));
                val.get_Headers()["Content-Type"] = "application/xml";
                string value = AmazonS3Util.GenerateChecksumForContent(text, fBase64Encode: true);
                val.get_Headers()["Content-MD5"] = value;
                return(val);
            }
            catch (EncoderFallbackException ex)
            {
                throw new AmazonServiceException("Unable to marshall request to XML", (Exception)ex);
            }
        }