fog-aws 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fog/aws/auto_scaling.rb +2 -0
- data/lib/fog/aws/models/auto_scaling/group.rb +12 -0
- data/lib/fog/aws/models/dns/zones.rb +2 -2
- data/lib/fog/aws/parsers/dns/get_hosted_zone.rb +12 -1
- data/lib/fog/aws/requests/auto_scaling/attach_load_balancers.rb +58 -0
- data/lib/fog/aws/requests/auto_scaling/detach_load_balancers.rb +62 -0
- data/lib/fog/aws/requests/dns/create_hosted_zone.rb +5 -0
- data/lib/fog/aws/version.rb +1 -1
- data/tests/requests/auto_scaling/auto_scaling_tests.rb +8 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5bfdd4651881d56cd47ad871e5b8b7a993418cd
|
4
|
+
data.tar.gz: 5bd28c47be8f7e7aabf993c499b09bdd79b25cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83234e86990287d8151a86c98cc1d3e72d697397278b73ca48b991fb7d827eb360576012f72031dd0c4b2401027370a5ebcccac4abc29cd81df16f43ee702d86
|
7
|
+
data.tar.gz: be95bfbfe84599f9f53de207fa68bc3ce920c6f53ba27b9846abae103c4b4837b91de8537af5f4b87b2577bef910a0117331fae73fb90c4509219a5d94a49a30
|
data/lib/fog/aws/auto_scaling.rb
CHANGED
@@ -11,6 +11,7 @@ module Fog
|
|
11
11
|
recognizes :host, :path, :port, :scheme, :persistent, :region, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :instrumentor, :instrumentor_name
|
12
12
|
|
13
13
|
request_path 'fog/aws/requests/auto_scaling'
|
14
|
+
request :attach_load_balancers
|
14
15
|
request :create_auto_scaling_group
|
15
16
|
request :create_launch_configuration
|
16
17
|
request :create_or_update_tags
|
@@ -33,6 +34,7 @@ module Fog
|
|
33
34
|
request :describe_scheduled_actions
|
34
35
|
request :describe_tags
|
35
36
|
request :describe_termination_policy_types
|
37
|
+
request :detach_load_balancers
|
36
38
|
request :disable_metrics_collection
|
37
39
|
request :enable_metrics_collection
|
38
40
|
request :execute_policy
|
@@ -44,11 +44,23 @@ module Fog
|
|
44
44
|
activities = Fog::AWS::AutoScaling::Activities.new(:service => service, :filters => {'AutoScalingGroupName' => id})
|
45
45
|
end
|
46
46
|
|
47
|
+
def attach_load_balancers(*load_balancer_names)
|
48
|
+
requires :id
|
49
|
+
service.attach_load_balancers(id, 'LoadBalancerNames' => load_balancer_names)
|
50
|
+
reload
|
51
|
+
end
|
52
|
+
|
47
53
|
def configuration
|
48
54
|
requires :launch_configuration_name
|
49
55
|
service.configurations.get(launch_configuration_name)
|
50
56
|
end
|
51
57
|
|
58
|
+
def detach_load_balancers(*load_balancer_names)
|
59
|
+
requires :id
|
60
|
+
service.detach_load_balancers(id, 'LoadBalancerNames' => load_balancer_names)
|
61
|
+
reload
|
62
|
+
end
|
63
|
+
|
52
64
|
def disable_metrics_collection(metrics = {})
|
53
65
|
requires :id
|
54
66
|
service.disable_metrics_collection(id, 'Metrics' => metrics)
|
@@ -10,8 +10,8 @@ module Fog
|
|
10
10
|
model Fog::DNS::AWS::Zone
|
11
11
|
|
12
12
|
def all(options = {})
|
13
|
-
options[:marker] ||= marker
|
14
|
-
options[:maxitems] ||= max_items
|
13
|
+
options[:marker] ||= marker unless marker.nil?
|
14
|
+
options[:maxitems] ||= max_items unless max_items.nil?
|
15
15
|
data = service.list_hosted_zones(options).body['HostedZones']
|
16
16
|
load(data)
|
17
17
|
end
|
@@ -8,6 +8,8 @@ module Fog
|
|
8
8
|
@name_servers = []
|
9
9
|
@response = {}
|
10
10
|
@section = :hosted_zone
|
11
|
+
@vpcs = []
|
12
|
+
@vpc = {}
|
11
13
|
end
|
12
14
|
|
13
15
|
def end_element(name)
|
@@ -15,7 +17,7 @@ module Fog
|
|
15
17
|
case name
|
16
18
|
when 'Id'
|
17
19
|
@hosted_zone[name]= value.sub('/hostedzone/', '')
|
18
|
-
when 'Name', 'CallerReference', 'Comment'
|
20
|
+
when 'Name', 'CallerReference', 'Comment', 'PrivateZone', 'Config', 'ResourceRecordSetCount'
|
19
21
|
@hosted_zone[name]= value
|
20
22
|
when 'HostedZone'
|
21
23
|
@response['HostedZone'] = @hosted_zone
|
@@ -31,6 +33,15 @@ module Fog
|
|
31
33
|
when 'NameServers'
|
32
34
|
@response['NameServers'] = @name_servers
|
33
35
|
@name_servers = {}
|
36
|
+
when 'VPCId', 'VPCRegion'
|
37
|
+
@vpc[name] = value
|
38
|
+
when 'VPC'
|
39
|
+
@vpcs << @vpc
|
40
|
+
@vpc = {}
|
41
|
+
when 'VPCs'
|
42
|
+
@response['HostedZone']['VPCs'] = @vpcs
|
43
|
+
@vpcs = {}
|
44
|
+
@section = :vpcs
|
34
45
|
end
|
35
46
|
end
|
36
47
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class AutoScaling
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/auto_scaling/basic'
|
6
|
+
|
7
|
+
# Attaches one or more load balancers to the specified Auto Scaling
|
8
|
+
# group.
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * auto_scaling_group_name<~String> - The name of the Auto Scaling
|
12
|
+
# group.
|
13
|
+
# * options<~Hash>:
|
14
|
+
# 'LoadBalancerNames'<~Array> - A list of LoadBalancers to use.
|
15
|
+
#
|
16
|
+
# ==== See Also
|
17
|
+
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_AttachLoadBalancers.html
|
18
|
+
#
|
19
|
+
|
20
|
+
ExpectedOptions[:attach_load_balancers] = %w[LoadBalancerNames]
|
21
|
+
|
22
|
+
def attach_load_balancers(auto_scaling_group_name, options = {})
|
23
|
+
if load_balancer_names = options.delete('LoadBalancerNames')
|
24
|
+
options.merge!(AWS.indexed_param('LoadBalancerNames.member.%d', [*load_balancer_names]))
|
25
|
+
end
|
26
|
+
|
27
|
+
request({
|
28
|
+
'Action' => 'AttachLoadBalancers',
|
29
|
+
'AutoScalingGroupName' => auto_scaling_group_name,
|
30
|
+
:parser => Fog::Parsers::AWS::AutoScaling::Basic.new
|
31
|
+
}.merge!(options))
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
class Mock
|
37
|
+
def attach_load_balancers(auto_scaling_group_name, options = {})
|
38
|
+
unexpected_options = options.keys - ExpectedOptions[:attach_load_balancers]
|
39
|
+
|
40
|
+
unless unexpected_options.empty?
|
41
|
+
raise Fog::AWS::AutoScaling::ValidationError.new("Options #{unexpected_options.join(',')} should not be included in request")
|
42
|
+
end
|
43
|
+
|
44
|
+
unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name)
|
45
|
+
raise Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null')
|
46
|
+
end
|
47
|
+
|
48
|
+
response = Excon::Response.new
|
49
|
+
response.status = 200
|
50
|
+
response.body = {
|
51
|
+
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
52
|
+
}
|
53
|
+
response
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class AutoScaling
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/auto_scaling/basic'
|
6
|
+
|
7
|
+
# Removes one or more load balancers from the specified Auto Scaling
|
8
|
+
# group.
|
9
|
+
#
|
10
|
+
# When you detach a load balancer, it enters the Removing state while
|
11
|
+
# deregistering the instances in the group. When all instances are
|
12
|
+
# deregistered, then you can no longer describe the load balancer using
|
13
|
+
# DescribeLoadBalancers. Note that the instances remain running.
|
14
|
+
#
|
15
|
+
# ==== Parameters
|
16
|
+
# * auto_scaling_group_name<~String> - The name of the Auto Scaling
|
17
|
+
# group.
|
18
|
+
# * options<~Hash>:
|
19
|
+
# 'LoadBalancerNames'<~Array> - A list of LoadBalancers to use.
|
20
|
+
#
|
21
|
+
# ==== See Also
|
22
|
+
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DetachLoadBalancers.html
|
23
|
+
#
|
24
|
+
|
25
|
+
ExpectedOptions[:detach_load_balancers] = %w[LoadBalancerNames]
|
26
|
+
|
27
|
+
def detach_load_balancers(auto_scaling_group_name, options = {})
|
28
|
+
if load_balancer_names = options.delete('LoadBalancerNames')
|
29
|
+
options.merge!(AWS.indexed_param('LoadBalancerNames.member.%d', [*load_balancer_names]))
|
30
|
+
end
|
31
|
+
|
32
|
+
request({
|
33
|
+
'Action' => 'DetachLoadBalancers',
|
34
|
+
'AutoScalingGroupName' => auto_scaling_group_name,
|
35
|
+
:parser => Fog::Parsers::AWS::AutoScaling::Basic.new
|
36
|
+
}.merge!(options))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Mock
|
41
|
+
def detach_load_balancers(auto_scaling_group_name, options = {})
|
42
|
+
unexpected_options = options.keys - ExpectedOptions[:detach_load_balancers]
|
43
|
+
|
44
|
+
unless unexpected_options.empty?
|
45
|
+
raise Fog::AWS::AutoScaling::ValidationError.new("Options #{unexpected_options.join(',')} should not be included in request")
|
46
|
+
end
|
47
|
+
|
48
|
+
unless self.data[:auto_scaling_groups].key?(auto_scaling_group_name)
|
49
|
+
raise Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null')
|
50
|
+
end
|
51
|
+
|
52
|
+
response = Excon::Response.new
|
53
|
+
response.status = 200
|
54
|
+
response.body = {
|
55
|
+
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
56
|
+
}
|
57
|
+
response
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -12,6 +12,8 @@ module Fog
|
|
12
12
|
# * caller_ref<~String> - unique string that identifies the request & allows failed
|
13
13
|
# calls to be retried without the risk of executing the operation twice
|
14
14
|
# * comment<~String> -
|
15
|
+
# * vpc_id<~String> - specify both a VPC's ID and its region to create a private zone for that VPC
|
16
|
+
# * vpc_region<~String> - specify both a VPC's ID and its region to create a private zone for that VPC
|
15
17
|
#
|
16
18
|
# ==== Returns
|
17
19
|
# * response<~Excon::Response>:
|
@@ -40,6 +42,9 @@ module Fog
|
|
40
42
|
if options[:comment]
|
41
43
|
optional_tags += "<HostedZoneConfig><Comment>#{options[:comment]}</Comment></HostedZoneConfig>"
|
42
44
|
end
|
45
|
+
if options[:vpc_id] and options[:vpc_region]
|
46
|
+
optional_tags += "<VPC><VPCId>#{options[:vpc_id]}</VPCId><VPCRegion>#{options[:vpc_region]}</VPCRegion></VPC>"
|
47
|
+
end
|
43
48
|
|
44
49
|
request({
|
45
50
|
:body => %Q{<?xml version="1.0" encoding="UTF-8"?><CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/#{@version}/"><Name>#{name}</Name>#{optional_tags}</CreateHostedZoneRequest>},
|
data/lib/fog/aws/version.rb
CHANGED
@@ -27,6 +27,14 @@ Shindo.tests('AWS::AutoScaling | auto_scaling_tests', ['aws', 'auto_scaling']) d
|
|
27
27
|
Fog::AWS[:auto_scaling].create_auto_scaling_group(@asg_name, zones, @lc_name, max_size, min_size).body
|
28
28
|
end
|
29
29
|
|
30
|
+
tests("#attach_load_balancers").formats(AWS::AutoScaling::Formats::BASIC) do
|
31
|
+
Fog::AWS[:auto_scaling].attach_load_balancers(@asg_name, 'LoadBalancerNames' => 'elb-test-fog').body
|
32
|
+
end
|
33
|
+
|
34
|
+
tests("#detach_load_balancers").formats(AWS::AutoScaling::Formats::BASIC) do
|
35
|
+
Fog::AWS[:auto_scaling].detach_load_balancers(@asg_name, 'LoadBalancerNames' => 'elb-test-fog').body
|
36
|
+
end
|
37
|
+
|
30
38
|
tests("#describe_auto_scaling_groups").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do
|
31
39
|
Fog::AWS[:auto_scaling].describe_auto_scaling_groups().body
|
32
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lane
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -694,6 +694,7 @@ files:
|
|
694
694
|
- lib/fog/aws/rds.rb
|
695
695
|
- lib/fog/aws/redshift.rb
|
696
696
|
- lib/fog/aws/region_methods.rb
|
697
|
+
- lib/fog/aws/requests/auto_scaling/attach_load_balancers.rb
|
697
698
|
- lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb
|
698
699
|
- lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb
|
699
700
|
- lib/fog/aws/requests/auto_scaling/create_or_update_tags.rb
|
@@ -716,6 +717,7 @@ files:
|
|
716
717
|
- lib/fog/aws/requests/auto_scaling/describe_scheduled_actions.rb
|
717
718
|
- lib/fog/aws/requests/auto_scaling/describe_tags.rb
|
718
719
|
- lib/fog/aws/requests/auto_scaling/describe_termination_policy_types.rb
|
720
|
+
- lib/fog/aws/requests/auto_scaling/detach_load_balancers.rb
|
719
721
|
- lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb
|
720
722
|
- lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb
|
721
723
|
- lib/fog/aws/requests/auto_scaling/execute_policy.rb
|