public BucketCorsConfigurationResult AddCorsRule(CorsRule corsRule) { Rules.Add(corsRule); return(this); }
public void TestSetBucketCors() { if (init()) { PutBucketCorsRequest putBucketCorsRequest = new PutBucketCorsRequest(); putBucketCorsRequest.BucketName = bucketName; BucketCorsConfigurationResult bucketCorsConfiguration = new BucketCorsConfigurationResult(); IList<CorsRule> corsRule = new List<CorsRule>(); CorsRule rule = new CorsRule(); rule.AllowedMethods.Add(HttpMethod.PUT); rule.AllowedHeaders.Add("*"); rule.AllowedOrigins.Add("http://www.example.com"); rule.AllowedOrigins.Add("http://www.example.a.com"); rule.ExposedHeaders.Add("*"); rule.MaxAgeSeconds = 200; corsRule.Add(rule); bucketCorsConfiguration.Rules = corsRule; putBucketCorsRequest.BucketCorsConfiguration = bucketCorsConfiguration; ks3Client.setBucketCors(putBucketCorsRequest); } }