Module: Aliyun::Oss::Api::BucketProperty
- Included in:
- Client
- Defined in:
- lib/aliyun/oss/api/bucket_property.rb
Instance Method Summary collapse
-
#bucket_disable_cors ⇒ Response
Used to disable cors and clear rules for bucket.
-
#bucket_disable_lifecycle ⇒ Object
Used to disable lifecycle for bucket.
-
#bucket_disable_logging ⇒ Response
Used to disable access logging.
-
#bucket_disable_website ⇒ Response
Used to disable website hostted mode.
-
#bucket_enable_cors(rules = []) ⇒ Response
Used to enable CORS and set rules for bucket.
-
#bucket_enable_lifecycle(rules = []) ⇒ Response
Used to enable and set lifecycle for bucket.
-
#bucket_enable_logging(target_bucket, target_prefix = nil) ⇒ Response
Used to enable access logging.
-
#bucket_enable_website(suffix, key = nil) ⇒ Response
Used to enable static website hosted mode.
-
#bucket_get_acl ⇒ Response
Get ACL for bucket.
-
#bucket_get_cors ⇒ Response
Get the CORS rules of bucket.
-
#bucket_get_lifecycle ⇒ Response
Get the lifecycle configuration of bucket.
-
#bucket_get_location ⇒ Response
Get the location information of the Bucket’s data center.
-
#bucket_get_logging ⇒ Response
Get the log configuration of Bucket.
-
#bucket_get_referer ⇒ Response
Get the referer configuration of bucket.
-
#bucket_get_website ⇒ Response
Get the bucket state of static website hosting.
-
#bucket_set_acl(acl) ⇒ Response
Used to modify the bucket access.
-
#bucket_set_referer(referers = [], allowed_empty = false) ⇒ Response
Used to set referer for bucket.
Instance Method Details
#bucket_disable_cors ⇒ Response
Used to disable cors and clear rules for bucket
167 168 169 170 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 167 def bucket_disable_cors query = { 'cors' => false } http.delete('/', query: query, bucket: bucket) end |
#bucket_disable_lifecycle ⇒ Object
Used to disable lifecycle for bucket.
128 129 130 131 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 128 def bucket_disable_lifecycle query = { 'lifecycle' => false } http.delete('/', query: query, bucket: bucket) end |
#bucket_disable_logging ⇒ Response
Used to disable access logging.
45 46 47 48 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 45 def bucket_disable_logging query = { 'logging' => false } http.delete('/', query: query, bucket: bucket) end |
#bucket_disable_website ⇒ Response
Used to disable website hostted mode.
75 76 77 78 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 75 def bucket_disable_website query = { 'website' => false } http.delete('/', query: query, bucket: bucket) end |
#bucket_enable_cors(rules = []) ⇒ Response
Used to enable CORS and set rules for bucket
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 144 def bucket_enable_cors(rules = []) query = { 'cors' => true } rules = Utils.wrap(rules) rules.each do |rule| unless rule.valid? fail Aliyun::Oss::InvalidCorsRuleError, rule.inspect end end body = XmlGenerator.generate_cors_rules(rules) http.put('/', query: query, body: body, bucket: bucket) end |
#bucket_enable_lifecycle(rules = []) ⇒ Response
Used to enable and set lifecycle for bucket
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 109 def bucket_enable_lifecycle(rules = []) query = { 'lifecycle' => true } rules = Utils.wrap(rules) rules.each do |rule| unless rule.valid? fail Aliyun::Oss::InvalidLifeCycleRuleError, rule.inspect end end body = XmlGenerator.generate_lifecycle_rules(rules) http.put('/', query: query, body: body, bucket: bucket) end |
#bucket_enable_logging(target_bucket, target_prefix = nil) ⇒ Response
Used to enable access logging.
29 30 31 32 33 34 35 36 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 29 def bucket_enable_logging(target_bucket, target_prefix = nil) query = { 'logging' => true } body = XmlGenerator.generate_enable_logging_xml(target_bucket, target_prefix) http.put('/', query: query, body: body, bucket: bucket) end |
#bucket_enable_website(suffix, key = nil) ⇒ Response
Used to enable static website hosted mode.
60 61 62 63 64 65 66 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 60 def bucket_enable_website(suffix, key = nil) query = { 'website' => true } body = XmlGenerator.generate_enable_website_xml(suffix, key) http.put('/', query: query, body: body, bucket: bucket) end |
#bucket_get_acl ⇒ Response
Get ACL for bucket
177 178 179 180 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 177 def bucket_get_acl query = { 'acl' => true } http.get('/', query: query, bucket: bucket) end |
#bucket_get_cors ⇒ Response
Get the CORS rules of bucket
239 240 241 242 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 239 def bucket_get_cors query = { 'cors' => true } http.get('/', query: query, bucket: bucket) end |
#bucket_get_lifecycle ⇒ Response
Get the lifecycle configuration of bucket
229 230 231 232 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 229 def bucket_get_lifecycle query = { 'lifecycle' => true } http.get('/', query: query, bucket: bucket) end |
#bucket_get_location ⇒ Response
Get the location information of the Bucket’s data center
187 188 189 190 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 187 def bucket_get_location query = { 'location' => true } http.get('/', query: query, bucket: bucket) end |
#bucket_get_logging ⇒ Response
Get the log configuration of Bucket
199 200 201 202 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 199 def bucket_get_logging query = { 'logging' => true } http.get('/', query: query, bucket: bucket) end |
#bucket_get_referer ⇒ Response
Get the referer configuration of bucket
219 220 221 222 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 219 def bucket_get_referer query = { 'referer' => true } http.get('/', query: query, bucket: bucket) end |
#bucket_get_website ⇒ Response
Get the bucket state of static website hosting.
209 210 211 212 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 209 def bucket_get_website query = { 'website' => true } http.get('/', query: query, bucket: bucket) end |
#bucket_set_acl(acl) ⇒ Response
Used to modify the bucket access.
13 14 15 16 17 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 13 def bucket_set_acl(acl) query = { 'acl' => true } headers = { 'x-oss-acl' => acl } http.put('/', query: query, headers: headers, bucket: bucket) end |
#bucket_set_referer(referers = [], allowed_empty = false) ⇒ Response
Used to set referer for bucket.
90 91 92 93 94 95 96 |
# File 'lib/aliyun/oss/api/bucket_property.rb', line 90 def bucket_set_referer(referers = [], allowed_empty = false) query = { 'referer' => true } body = XmlGenerator.generate_set_referer_xml(referers, allowed_empty) http.put('/', query: query, body: body, bucket: bucket) end |