Class: Aws::S3::Plugins::BucketNameRestrictions::Handler Private

Inherits:
Seahorse::Client::Handler
  • Object
show all
Defined in:
lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#call(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Useful because Aws::S3::Errors::SignatureDoesNotMatch is thrown when passed a bucket with a forward slash. Instead provide a more helpful error. Ideally should not be a plugin?



13
14
15
16
17
18
19
20
21
22
# File 'lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb', line 13

def call(context)
  bucket_member = _bucket_member(context.operation.input.shape)
  if bucket_member && (bucket = context.params[bucket_member])
    if !Aws::ARNParser.arn?(bucket) && bucket.include?('/')
      raise ArgumentError,
            'bucket name must not contain a forward-slash (/)'
    end
  end
  @handler.call(context)
end