Class: S3::BucketCreateRequest
- Defined in:
- lib/s3/bucket_create_request.rb
Constant Summary
Constants inherited from Request
Request::AWS_ALGORITHM, Request::AWS_REQUEST, Request::SERVICE, Request::UNSIGNED_PAYLOAD
Instance Method Summary collapse
Methods inherited from Request
Constructor Details
This class inherits a constructor from S3::Request
Instance Method Details
#submit(options = nil, bucket:, **kwargs) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/s3/bucket_create_request.rb', line 3 def submit( = nil, bucket:, **kwargs ) = ( , kwargs, BucketCreateOptions ) headers = {} headers[ 'x-amz-acl' ] = [ :acl ] if [ :acl ] body = nil location = [ :region ] || @region if location && location != 'us-east-1' body = <<~XML <?xml version="1.0" encoding="UTF-8"?> <CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <LocationConstraint>#{ location }</LocationConstraint> </CreateBucketConfiguration> XML end response = put( "/#{ bucket }", body: body, headers: headers ) build_result( response, TrueClass ) do true end end |