# WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing for info on making contributions: # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE module Aws module S3 class BucketLogging extend Aws::Deprecations # @overload def initialize(bucket_name, options = {}) # @param [String] bucket_name # @option options [Client] :client # @overload def initialize(options = {}) # @option options [required, String] :bucket_name # @option options [Client] :client 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 # @!group Read-Only Attributes # @return [String] def bucket_name @bucket_name end # @return [Types::LoggingEnabled] def logging_enabled data.logging_enabled end # @!endgroup # @return [Client] def client @client end # Loads, or reloads {#data} for the current {BucketLogging}. # Returns `self` making it possible to chain methods. # # bucket_logging.reload.data # # @return [self] def load resp = @client.get_bucket_logging(bucket: @bucket_name) @data = resp.data self end alias :reload :load # @return [Types::GetBucketLoggingOutput] # Returns the data for this {BucketLogging}. Calls # {Client#get_bucket_logging} if {#data_loaded?} is `false`. def data load unless @data @data end # @return [Boolean] # Returns `true` if this resource is loaded. Accessing attributes or # {#data} on an unloaded resource will trigger a call to {#load}. def data_loaded? !!@data end # @!group Actions # @example Request syntax with placeholder values # # bucket_logging.put({ # bucket_logging_status: { # required # logging_enabled: { # target_bucket: "TargetBucket", # target_grants: [ # { # grantee: { # display_name: "DisplayName", # email_address: "EmailAddress", # id: "ID", # type: "CanonicalUser", # required, accepts CanonicalUser, AmazonCustomerByEmail, Group # uri: "URI", # }, # permission: "FULL_CONTROL", # accepts FULL_CONTROL, READ, WRITE # }, # ], # target_prefix: "TargetPrefix", # }, # }, # content_md5: "ContentMD5", # }) # @param [Hash] options ({}) # @option options [required, Types::BucketLoggingStatus] :bucket_logging_status # @option options [String] :content_md5 # @return [EmptyStructure] def put(options = {}) options = options.merge(bucket: @bucket_name) resp = @client.put_bucket_logging(options) resp.data end # @!group Associations # @return [Bucket] def bucket Bucket.new( name: @bucket_name, client: @client ) end # @deprecated # @api private def identifiers { bucket_name: @bucket_name } end deprecated(:identifiers) private 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 class Collection < Aws::Resources::Collection; end end end end