class Aws::S3::BucketPolicy
def bucket
-
(Bucket)
-
def bucket Bucket.new( name: @bucket_name, client: @client ) end
def bucket_name
-
(String)
-
def bucket_name @bucket_name end
def client
-
(Client)
-
def client @client end
def data
-
(Types::GetBucketPolicyOutput)
-
def data load unless @data @data end
def data_loaded?
-
(Boolean)
-
def data_loaded? !!@data end
def delete(options = {})
-
(EmptyStructure)
-
Options Hash:
(**options)
-
:expected_bucket_owner
(String
) --
Parameters:
-
options
(Hash
) -- ({})
Other tags:
- Example: Request syntax with placeholder values -
def delete(options = {}) options = options.merge(bucket: @bucket_name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.delete_bucket_policy(options) end resp.data end
def extract_bucket_name(args, options)
def extract_bucket_name(args, options) value = args[0] || options.delete(:bucket_name) case value when String then value when nil then raise ArgumentError, "missing required option :bucket_name" else msg = "expected :bucket_name to be a String, got #{value.class}" raise ArgumentError, msg end end
def identifiers
- Api: - private
Deprecated:
def identifiers { bucket_name: @bucket_name } end
def initialize(*args)
(**options)
-
:client
(Client
) -- -
:bucket_name
(required, String
) -- -
:client
(Client
) --
Overloads:
-
def initialize(options = {})
-
def initialize(bucket_name, options = {})
Parameters:
-
bucket_name
(String
) --
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) @waiter_block_warned = false end
def load
-
(self)
-
def load resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.get_bucket_policy(bucket: @bucket_name) end @data = resp.data self end
def policy
-
(IO)
-
def policy data[:policy] end
def put(options = {})
-
(EmptyStructure)
-
Options Hash:
(**options)
-
:expected_bucket_owner
(String
) -- -
:policy
(required, String
) -- -
:confirm_remove_self_bucket_access
(Boolean
) -- -
:checksum_algorithm
(String
) -- -
:content_md5
(String
) --
Parameters:
-
options
(Hash
) -- ({})
Other tags:
- Example: Request syntax with placeholder values -
def put(options = {}) options = options.merge(bucket: @bucket_name) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.put_bucket_policy(options) end resp.data end
def wait_until(options = {}, &block)
-
(Resource)
- if the waiter was successful
Options Hash:
(**options)
-
:before_wait
(Proc
) -- Callback -
:before_attempt
(Proc
) -- Callback -
:delay
(Integer
) -- Delay between each -
:max_attempts
(Integer
) -- Maximum number of
Raises:
-
(NotImplementedError)
- Raised when the resource does not -
(Aws::Waiters::Errors::UnexpectedError)
- Raised when an error is -
(Aws::Waiters::Errors::FailureStateError)
- Raised when the waiter
Other tags:
- Yieldparam: resource - to be used in the waiting condition.
Other tags:
- Note: - The waiting operation is performed on a copy. The original resource
Deprecated:
- Use [Aws::S3::Client] #wait_until instead
def wait_until(options = {}, &block) self_copy = self.dup attempts = 0 options[:max_attempts] = 10 unless options.key?(:max_attempts) options[:delay] ||= 10 options[:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == options[:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new(options).wait({}) end end