Skip to content

Commit

Permalink
Merge branch 'master' into fix_cdn_dpr_warn
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus authored Sep 18, 2018
2 parents d8d867e + cafb79c commit c4bb9e5
Show file tree
Hide file tree
Showing 385 changed files with 1,301 additions and 1,271 deletions.
19 changes: 5 additions & 14 deletions lib/fog/aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@
require File.expand_path('../aws/version', __FILE__)

module Fog
module Compute
autoload :AWS, File.expand_path('../aws/compute', __FILE__)
end

module DNS
autoload :AWS, File.expand_path('../aws/dns', __FILE__)
end

module Storage
autoload :AWS, File.expand_path('../aws/storage', __FILE__)
end

module AWS
extend Fog::Provider

Expand All @@ -31,7 +19,9 @@ module AWS
autoload :CDN, File.expand_path('../aws/cdn', __FILE__)
autoload :CloudFormation, File.expand_path('../aws/cloud_formation', __FILE__)
autoload :CloudWatch, File.expand_path('../aws/cloud_watch', __FILE__)
autoload :Compute, File.expand_path('../aws/compute', __FILE__)
autoload :DataPipeline, File.expand_path('../aws/data_pipeline', __FILE__)
autoload :DNS, File.expand_path('../aws/dns', __FILE__)
autoload :DynamoDB, File.expand_path('../aws/dynamodb', __FILE__)
autoload :ECS, File.expand_path('../aws/ecs', __FILE__)
autoload :EFS, File.expand_path('../aws/efs', __FILE__)
Expand All @@ -51,6 +41,7 @@ module AWS
autoload :SNS, File.expand_path('../aws/sns', __FILE__)
autoload :SQS, File.expand_path('../aws/sqs', __FILE__)
autoload :STS, File.expand_path('../aws/sts', __FILE__)
autoload :Storage, File.expand_path('../aws/storage', __FILE__)
autoload :Support, File.expand_path('../aws/support', __FILE__)
autoload :SimpleDB, File.expand_path('../aws/simpledb', __FILE__)

Expand Down Expand Up @@ -204,15 +195,15 @@ def self.parse_security_group_options(group_name, options)
options = group_name
elsif group_name
if options.key?('GroupName')
raise Fog::Compute::AWS::Error, 'Arguments specified both group_name and GroupName in options'
raise Fog::AWS::Compute::Error, 'Arguments specified both group_name and GroupName in options'
end
options = options.clone
options['GroupName'] = group_name
end
name_specified = options.key?('GroupName') && !options['GroupName'].nil?
group_id_specified = options.key?('GroupId') && !options['GroupId'].nil?
unless name_specified || group_id_specified
raise Fog::Compute::AWS::Error, 'Neither GroupName nor GroupId specified'
raise Fog::AWS::Compute::Error, 'Neither GroupName nor GroupId specified'
end
if name_specified && group_id_specified
options.delete('GroupName')
Expand Down
25 changes: 19 additions & 6 deletions lib/fog/aws/compute.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module Compute
class AWS < Fog::Service
module AWS
class Compute < Fog::Service
extend Fog::AWS::CredentialFetcher::ServiceMethods

class RequestLimitExceeded < Fog::Errors::Error; end
Expand Down Expand Up @@ -634,7 +634,7 @@ def _request(body, headers, idempotent, parser, retries = 0)
raise if match.empty?
raise case match[:code]
when 'NotFound', 'Unknown'
Fog::Compute::AWS::NotFound.slurp(error, match[:message])
Fog::AWS::Compute::NotFound.slurp(error, match[:message])
when 'RequestLimitExceeded'
if @retry_request_limit_exceeded && retries < max_retries
jitter = rand * 10 * @retry_jitter_magnitude
Expand All @@ -644,16 +644,29 @@ def _request(body, headers, idempotent, parser, retries = 0)
retries += 1
retry
elsif @retry_request_limit_exceeded
Fog::Compute::AWS::RequestLimitExceeded.slurp(error, "Max retries exceeded (#{max_retries}) #{match[:code]} => #{match[:message]}")
Fog::AWS::Compute::RequestLimitExceeded.slurp(error, "Max retries exceeded (#{max_retries}) #{match[:code]} => #{match[:message]}")
else
Fog::Compute::AWS::RequestLimitExceeded.slurp(error, "#{match[:code]} => #{match[:message]}")
Fog::AWS::Compute::RequestLimitExceeded.slurp(error, "#{match[:code]} => #{match[:message]}")
end
else
Fog::Compute::AWS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
Fog::AWS::Compute::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
end
end
end
end
end
end

# @deprecated
module Compute
# @deprecated
class AWS < Fog::AWS::Compute
# @deprecated
# @overrides Fog::Service.new (from the fog-core gem)
def self.new(*)
Fog::Logger.deprecation 'Fog::Compute::AWS is deprecated, please use Fog::AWS::Compute.'
super
end
end
end
end
2 changes: 1 addition & 1 deletion lib/fog/aws/credential_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module CredentialFetcher
module ServiceMethods
def fetch_credentials(options)
if options[:use_iam_profile] && Fog.mocking?
return Fog::Compute::AWS::Mock.data[:iam_role_based_creds]
return Fog::AWS::Compute::Mock.data[:iam_role_based_creds]
end
if options[:use_iam_profile]
begin
Expand Down
23 changes: 18 additions & 5 deletions lib/fog/aws/dns.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module DNS
class AWS < Fog::Service
module AWS
class DNS < Fog::Service
extend Fog::AWS::CredentialFetcher::ServiceMethods

requires :aws_access_key_id, :aws_secret_access_key
Expand Down Expand Up @@ -77,7 +77,7 @@ class Real
# :aws_secret_access_key in order to create a connection
#
# ==== Examples
# dns = Fog::DNS::AWS.new(
# dns = Fog::AWS::DNS.new(
# :aws_access_key_id => your_aws_access_key_id,
# :aws_secret_access_key => your_aws_secret_access_key
# )
Expand Down Expand Up @@ -147,9 +147,9 @@ def _request(params, &block)
else
raise case match[:code]
when 'NoSuchHostedZone', 'NoSuchChange' then
Fog::DNS::AWS::NotFound.slurp(error, match[:message])
Fog::AWS::DNS::NotFound.slurp(error, match[:message])
else
Fog::DNS::AWS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
Fog::AWS::DNS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
end
end
end
Expand All @@ -162,4 +162,17 @@ def signature(params)
end
end
end

# @deprecated
module DNS
# @deprecated
class AWS < Fog::AWS::DNS
# @deprecated
# @overrides Fog::Service.new (from the fog-core gem)
def self.new(*)
Fog::Logger.deprecation 'Fog::DNS::AWS is deprecated, please use Fog::AWS::DNS.'
super
end
end
end
end
2 changes: 1 addition & 1 deletion lib/fog/aws/efs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def initialize(options={})
end

def mock_compute
@mock_compute ||= Fog::Compute::AWS.new(:aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key, :region => @region)
@mock_compute ||= Fog::AWS::Compute.new(:aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key, :region => @region)
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/models/compute/address.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module Compute
class AWS
module AWS
class Compute
class Address < Fog::Model
identity :public_ip, :aliases => 'publicIp'

Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aws/models/compute/addresses.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'fog/aws/models/compute/address'

module Fog
module Compute
class AWS
module AWS
class Compute
class Addresses < Fog::Collection
attribute :filters
attribute :server

model Fog::Compute::AWS::Address
model Fog::AWS::Compute::Address

# Used to create an IP address
#
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/models/compute/dhcp_option.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module Compute
class AWS
module AWS
class Compute
class DhcpOption < Fog::Model
identity :id, :aliases => 'dhcpOptionsId'
attribute :dhcp_configuration_set, :aliases => 'dhcpConfigurationSet'
Expand Down
14 changes: 7 additions & 7 deletions lib/fog/aws/models/compute/dhcp_options.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'fog/aws/models/compute/dhcp_option'

module Fog
module Compute
class AWS
module AWS
class Compute
class DhcpOptions < Fog::Collection
attribute :filters

model Fog::Compute::AWS::DhcpOption
model Fog::AWS::Compute::DhcpOption

# Creates a new dhcp option
#
Expand All @@ -17,7 +17,7 @@ class DhcpOptions < Fog::Collection
# Returns the details of the new DHCP options
#
#>> AWS.dhcp_options.new
#=> <Fog::Compute::AWS::DhcpOption
#=> <Fog::AWS::Compute::DhcpOption
#id=nil,
#dhcp_configuration_set=nil,
#tag_set=nil
Expand All @@ -38,10 +38,10 @@ def initialize(attributes)
# Returns an array of all DhcpOptions
#
#>> AWS.dhcp_options.all
#<Fog::Compute::AWS::DhcpOptions
#<Fog::AWS::Compute::DhcpOptions
#filters={}
#[
#<Fog::Compute::AWS::DhcpOption
#<Fog::AWS::Compute::DhcpOption
#id="dopt-some-id",
#dhcp_configuration_set={"vpcId"=>"vpc-some-id", "state"=>"available"},
#tag_set={}
Expand All @@ -68,7 +68,7 @@ def all(filters_arg = filters)
# ==== Returns
#
#>> AWS.dhcp_options.get("dopt-12345678")
#=> <Fog::Compute::AWS::DhcpOption
#=> <Fog::AWS::Compute::DhcpOption
#id="dopt-12345678",
#dhcp_configuration_set={"vpcId"=>"vpc-12345678", "state"=>"available"},
#tag_set={}
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/models/compute/flavor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module Compute
class AWS
module AWS
class Compute
class Flavor < Fog::Model
identity :id

Expand Down
12 changes: 6 additions & 6 deletions lib/fog/aws/models/compute/flavors.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'fog/aws/models/compute/flavor'

module Fog
module Compute
class AWS
module AWS
class Compute
FLAVORS = [
{
:id => 't1.micro',
Expand Down Expand Up @@ -907,7 +907,7 @@ class AWS
]

class Flavors < Fog::Collection
model Fog::Compute::AWS::Flavor
model Fog::AWS::Compute::Flavor

# Returns an array of all flavors that have been created
#
Expand Down Expand Up @@ -1031,7 +1031,7 @@ class Flavors < Fog::Collection
# ebs_optimized_available=false,
# instance_store_volumes=0
# >,
# <Fog::Compute::AWS::Flavor
# <Fog::AWS::Compute::Flavor
# id="m3.xlarge",
# bits=64,
# cores=13,
Expand All @@ -1041,7 +1041,7 @@ class Flavors < Fog::Collection
# ebs_optimized_available=true,
# instance_store_volumes=2
# >,
# <Fog::Compute::AWS::Flavor
# <Fog::AWS::Compute::Flavor
# id="m3.2xlarge",
# bits=64,
# cores=26,
Expand Down Expand Up @@ -1076,7 +1076,7 @@ class Flavors < Fog::Collection
#

def all
load(Fog::Compute::AWS::FLAVORS)
load(Fog::AWS::Compute::FLAVORS)
self
end

Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/models/compute/image.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module Compute
class AWS
module AWS
class Compute
class Image < Fog::Model
identity :id, :aliases => 'imageId'

Expand Down
6 changes: 3 additions & 3 deletions lib/fog/aws/models/compute/images.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'fog/aws/models/compute/image'

module Fog
module Compute
class AWS
module AWS
class Compute
class Images < Fog::Collection
attribute :filters

model Fog::Compute::AWS::Image
model Fog::AWS::Compute::Image

# Creates a new Amazon machine image
#
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/models/compute/internet_gateway.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module Compute
class AWS
module AWS
class Compute
class InternetGateway < Fog::Model
identity :id, :aliases => 'internetGatewayId'
attribute :attachment_set, :aliases => 'attachmentSet'
Expand Down
14 changes: 7 additions & 7 deletions lib/fog/aws/models/compute/internet_gateways.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'fog/aws/models/compute/internet_gateway'

module Fog
module Compute
class AWS
module AWS
class Compute
class InternetGateways < Fog::Collection
attribute :filters

model Fog::Compute::AWS::InternetGateway
model Fog::AWS::Compute::InternetGateway

# Creates a new internet gateway
#
Expand All @@ -17,7 +17,7 @@ class InternetGateways < Fog::Collection
# Returns the details of the new InternetGateway
#
#>> AWS.internet_gateways.new
#=> <Fog::Compute::AWS::InternetGateway
#=> <Fog::AWS::Compute::InternetGateway
#id=nil,
#attachment_set=nil,
#tag_set=nil
Expand All @@ -38,10 +38,10 @@ def initialize(attributes)
# Returns an array of all InternetGateways
#
#>> AWS.internet_gateways.all
#<Fog::Compute::AWS::InternetGateways
#<Fog::AWS::Compute::InternetGateways
#filters={}
#[
#<Fog::Compute::AWS::InternetGateway
#<Fog::AWS::Compute::InternetGateway
#id="igw-some-id",
#attachment_set={"vpcId"=>"vpc-some-id", "state"=>"available"},
#tag_set={}
Expand All @@ -68,7 +68,7 @@ def all(filters_arg = filters)
# ==== Returns
#
#>> AWS.internet_gateways.get("igw-12345678")
#=> <Fog::Compute::AWS::InternetGateway
#=> <Fog::AWS::Compute::InternetGateway
#id="igw-12345678",
#attachment_set={"vpcId"=>"vpc-12345678", "state"=>"available"},
#tag_set={}
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/models/compute/key_pair.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Fog
module Compute
class AWS
module AWS
class Compute
class KeyPair < Fog::Model
identity :name, :aliases => 'keyName'

Expand Down
Loading

0 comments on commit c4bb9e5

Please sign in to comment.