Aliyun.Oss.Bucket.CORS.put
You're seeing just the function
put
, go back to Aliyun.Oss.Bucket.CORS module for more information.
Link to this function
put(bucket, config)
Specs
PutBucketCors接口用于为指定的存储空间(Bucket)设置跨域资源共享CORS(Cross-Origin Resource Sharing)规则。
Examples
iex> config_json = %{
"CORSConfiguration" => %{
"CORSRule" => [
%{
"AllowedHeader" => "Authorization",
"AllowedMethod" => ["PUT", "GET"],
"AllowedOrigin" => "*"
},
%{
"AllowedHeader" => "Authorization",
"AllowedMethod" => "GET",
"AllowedOrigin" => ["http://www.a.com", "http://www.b.com"],
"ExposeHeader" => ["x-oss-test", "x-oss-test1"],
"MaxAgeSeconds" => "100"
}
],
"ResponseVary" => "false"
}
}
iex> Aliyun.Oss.Bucket.CORS.put("some-bucket", config_json)
{:ok, %Aliyun.Oss.Client.Response{
data: "",
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}
iex> config_xml = ~S[
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration>
...
</CORSConfiguration >
]
iex> Aliyun.Oss.Bucket.CORS.put("some-bucket", config_xml)
{:ok, %Aliyun.Oss.Client.Response{
data: "",
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}