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
23
24
25
26
27
# 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])
    _resolved_region, arn = ARN.resolve_arn!(
      bucket,
      context.config.region,
      context.config.s3_use_arn_region
    )
    if !arn && bucket.include?('/')
      raise ArgumentError,
            'bucket name must not contain a forward-slash (/)'
    end
  end
  @handler.call(context)
end