You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::S3::BucketRequestPayment

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb

Defined Under Namespace

Classes: Collection

Actions collapse

Associations collapse

Read-Only Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name, options = {}) ⇒ BucketRequestPayment #initialize(options = {}) ⇒ BucketRequestPayment

Returns a new instance of BucketRequestPayment

Overloads:

  • #initialize(bucket_name, options = {}) ⇒ BucketRequestPayment

    Parameters:

    • bucket_name (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ BucketRequestPayment

    Options Hash (options):

    • :bucket_name (required, String)
    • :client (Client)


19
20
21
22
23
24
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 19

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @bucket_name = extract_bucket_name(args, options)
  @data = options.delete(:data)
  @client = options.delete(:client) || Client.new(options)
end

Instance Method Details

#bucketBucket

Returns:



97
98
99
100
101
102
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 97

def bucket
  Bucket.new(
    name: @bucket_name,
    client: @client
  )
end

#bucket_nameString

Returns:

  • (String)


29
30
31
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 29

def bucket_name
  @bucket_name
end

#clientClient

Returns:



42
43
44
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 42

def client
  @client
end

#dataTypes::GetBucketRequestPaymentOutput

Returns the data for this Aws::S3::BucketRequestPayment. Calls Client#get_bucket_request_payment if #data_loaded? is false.



62
63
64
65
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 62

def data
  load unless @data
  @data
end

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



70
71
72
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 70

def data_loaded?
  !!@data
end

#loadself Also known as: reload

Loads, or reloads #data for the current Aws::S3::BucketRequestPayment. Returns self making it possible to chain methods.

bucket_request_payment.reload.data

Returns:

  • (self)


52
53
54
55
56
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 52

def load
  resp = @client.get_bucket_request_payment(bucket: @bucket_name)
  @data = resp.data
  self
end

#payerString

Specifies who pays for the download and request fees.

Returns:

  • (String)


35
36
37
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 35

def payer
  data.payer
end

#put(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


bucket_request_payment.put({
  content_md5: "ContentMD5",
  request_payment_configuration: { # required
    payer: "Requester", # required, accepts Requester, BucketOwner
  },
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

Returns:

  • (EmptyStructure)


88
89
90
91
92
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_request_payment.rb', line 88

def put(options = {})
  options = options.merge(bucket: @bucket_name)
  resp = @client.put_bucket_request_payment(options)
  resp.data
end