Skip to content

Commit

Permalink
Merge pull request #468 from sue445/fix_compute_deprecation_warning
Browse files Browse the repository at this point in the history
Rename Compute::AWS to AWS::Compute
  • Loading branch information
geemus authored Sep 17, 2018
2 parents 89fd6ad + 57d5b3d commit 7d88051
Show file tree
Hide file tree
Showing 270 changed files with 935 additions and 925 deletions.
9 changes: 3 additions & 6 deletions lib/fog/aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ module CDN
autoload :AWS, File.expand_path('../aws/cdn', __FILE__)
end

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

module DNS
autoload :AWS, File.expand_path('../aws/dns', __FILE__)
end
Expand All @@ -34,6 +30,7 @@ module AWS
autoload :AutoScaling, File.expand_path('../aws/auto_scaling', __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 :DynamoDB, File.expand_path('../aws/dynamodb', __FILE__)
autoload :ECS, File.expand_path('../aws/ecs', __FILE__)
Expand Down Expand Up @@ -207,15 +204,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
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
6 changes: 3 additions & 3 deletions lib/fog/aws/models/compute/key_pairs.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'fog/aws/models/compute/key_pair'

module Fog
module Compute
class AWS
module AWS
class Compute
class KeyPairs < Fog::Collection
attribute :filters
attribute :key_name

model Fog::Compute::AWS::KeyPair
model Fog::AWS::Compute::KeyPair

# Used to create a key pair. There are 3 arguments and only name is required. You can generate a new key_pair as follows:
# AWS.key_pairs.create(:name => "test", :fingerprint => "123", :private_key => '234234')
Expand Down
8 changes: 4 additions & 4 deletions lib/fog/aws/models/compute/network_acl.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 NetworkAcl < Fog::Model
ICMP = 1
TCP = 6
Expand All @@ -25,7 +25,7 @@ def add_outbound_rule(rule_number, protocol, rule_action, cidr_block, options =

# Add a new rule
#
# network_acl.add_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
# network_acl.add_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
#
# ==== Parameters
# * rule_number<~Integer> - The rule number for the entry, between 100 and 32766
Expand Down Expand Up @@ -91,7 +91,7 @@ def update_outbound_rule(rule_number, protocol, rule_action, cidr_block, options

# Update a specific rule number
#
# network_acl.update_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
# network_acl.update_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
#
# ==== Parameters
# * rule_number<~Integer> - The rule number for the entry, between 100 and 32766
Expand Down
Loading

0 comments on commit 7d88051

Please sign in to comment.