Class: Aws::S3::Plugins::BucketDns

Inherits:
Seahorse::Client::Plugin show all
Defined in:
gems/aws-sdk-s3/lib/aws-sdk-s3/plugins/bucket_dns.rb

Overview

Amazon S3 requires DNS style addressing for buckets outside of the classic region when possible.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Plugin

#add_options, #after_initialize, after_initialize, #before_initialize, before_initialize, option

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Class Method Details

.dns_compatible?(bucket_name, ssl) ⇒ Boolean

Parameters:

  • bucket_name (String)
  • ssl (Boolean)

Returns:

  • (Boolean)


68
69
70
71
72
73
74
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/plugins/bucket_dns.rb', line 68

def dns_compatible?(bucket_name, ssl)
  if valid_subdomain?(bucket_name)
    bucket_name.match(/\./) && ssl ? false : true
  else
    false
  end
end

.valid_subdomain?(bucket_name) ⇒ Boolean

Parameters:

  • bucket_name (String)

Returns:

  • (Boolean)


78
79
80
81
82
83
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/plugins/bucket_dns.rb', line 78

def valid_subdomain?(bucket_name)
  bucket_name.size < 64 &&
  bucket_name =~ /^[a-z0-9][a-z0-9.-]+[a-z0-9]$/ &&
  bucket_name !~ /(\d+\.){3}\d+/ &&
  bucket_name !~ /[.-]{2}/
end

Instance Method Details

#add_handlers(handlers, config) ⇒ Object



26
27
28
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/plugins/bucket_dns.rb', line 26

def add_handlers(handlers, config)
  handlers.add(Handler) unless config.force_path_style
end