fog 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +11 -6
- data/changelog.txt +49 -0
- data/fog.gemspec +5 -4
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/cloud_formation.rb +124 -0
- data/lib/fog/aws/elb.rb +4 -1
- data/lib/fog/aws/iam.rb +6 -0
- data/lib/fog/aws/parsers/cloud_formation/basic.rb +12 -0
- data/lib/fog/aws/parsers/cloud_formation/create_stack.rb +19 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stack_events.rb +31 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stack_resources.rb +31 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +72 -0
- data/lib/fog/aws/parsers/cloud_formation/get_template.rb +19 -0
- data/lib/fog/aws/parsers/cloud_formation/validate_template.rb +52 -0
- data/lib/fog/aws/parsers/iam/login_profile.rb +27 -0
- data/lib/fog/aws/parsers/iam/upload_server_certificate.rb +26 -0
- data/lib/fog/aws/parsers/rds/authorize_db_security_group_ingress.rb +38 -0
- data/lib/fog/aws/parsers/rds/create_db_instance.rb +34 -0
- data/lib/fog/aws/parsers/rds/create_db_instance_read_replica.rb +34 -0
- data/lib/fog/aws/parsers/rds/create_db_parameter_group.rb +35 -0
- data/lib/fog/aws/parsers/rds/create_db_security_group.rb +38 -0
- data/lib/fog/aws/parsers/rds/create_db_snapshot.rb +35 -0
- data/lib/fog/aws/parsers/rds/db_parser.rb +123 -0
- data/lib/fog/aws/parsers/rds/delete_db_instance.rb +35 -0
- data/lib/fog/aws/parsers/rds/delete_db_parameter_group.rb +27 -0
- data/lib/fog/aws/parsers/rds/delete_db_security_group.rb +33 -0
- data/lib/fog/aws/parsers/rds/delete_db_snapshot.rb +34 -0
- data/lib/fog/aws/parsers/rds/describe_db_instances.rb +36 -0
- data/lib/fog/aws/parsers/rds/describe_db_parameter_groups.rb +38 -0
- data/lib/fog/aws/parsers/rds/describe_db_parameters.rb +44 -0
- data/lib/fog/aws/parsers/rds/describe_db_security_groups.rb +39 -0
- data/lib/fog/aws/parsers/rds/describe_db_snapshots.rb +39 -0
- data/lib/fog/aws/parsers/rds/modify_db_instance.rb +34 -0
- data/lib/fog/aws/parsers/rds/modify_db_parameter_group.rb +28 -0
- data/lib/fog/aws/parsers/rds/reboot_db_instance.rb +35 -0
- data/lib/fog/aws/parsers/rds/restore_db_instance_from_db_snapshot.rb +34 -0
- data/lib/fog/aws/parsers/rds/restore_db_instance_to_point_in_time.rb +35 -0
- data/lib/fog/aws/parsers/rds/revoke_db_security_group_ingress.rb +39 -0
- data/lib/fog/aws/parsers/rds/security_group_parser.rb +39 -0
- data/lib/fog/aws/parsers/rds/snapshot_parser.rb +40 -0
- data/lib/fog/aws/rds.rb +161 -0
- data/lib/fog/aws/rds/models/parameter.rb +21 -0
- data/lib/fog/aws/rds/models/parameter_group.rb +36 -0
- data/lib/fog/aws/rds/models/parameter_groups.rb +27 -0
- data/lib/fog/aws/rds/models/parameters.rb +37 -0
- data/lib/fog/aws/rds/models/security_group.rb +73 -0
- data/lib/fog/aws/rds/models/security_groups.rb +43 -0
- data/lib/fog/aws/rds/models/server.rb +105 -0
- data/lib/fog/aws/rds/models/servers.rb +27 -0
- data/lib/fog/aws/rds/models/snapshot.rb +49 -0
- data/lib/fog/aws/rds/models/snapshots.rb +45 -0
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +71 -0
- data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +30 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stack_events.rb +44 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb +43 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stacks.rb +42 -0
- data/lib/fog/aws/requests/cloud_formation/get_template.rb +32 -0
- data/lib/fog/aws/requests/cloud_formation/validate_template.rb +34 -0
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +4 -0
- data/lib/fog/aws/requests/iam/create_login_profile.rb +36 -0
- data/lib/fog/aws/requests/iam/delete_login_profile.rb +31 -0
- data/lib/fog/aws/requests/iam/delete_server_certificate.rb +32 -0
- data/lib/fog/aws/requests/iam/get_login_profile.rb +35 -0
- data/lib/fog/aws/requests/iam/update_login_profile.rb +33 -0
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +45 -0
- data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +43 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +56 -0
- data/lib/fog/aws/requests/rds/create_db_instance_read_replica.rb +42 -0
- data/lib/fog/aws/requests/rds/create_db_parameter_group.rb +41 -0
- data/lib/fog/aws/requests/rds/create_db_security_group.rb +37 -0
- data/lib/fog/aws/requests/rds/create_db_snapshot.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +40 -0
- data/lib/fog/aws/requests/rds/delete_db_parameter_group.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_security_group.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_snapshot.rb +36 -0
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +42 -0
- data/lib/fog/aws/requests/rds/describe_db_parameter_groups.rb +45 -0
- data/lib/fog/aws/requests/rds/describe_db_parameters.rb +46 -0
- data/lib/fog/aws/requests/rds/describe_db_security_groups.rb +39 -0
- data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +42 -0
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +54 -0
- data/lib/fog/aws/requests/rds/modify_db_parameter_group.rb +55 -0
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +34 -0
- data/lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb +34 -0
- data/lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb +35 -0
- data/lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb +44 -0
- data/lib/fog/aws/simpledb.rb +21 -7
- data/lib/fog/bin.rb +2 -1
- data/lib/fog/bin/aws.rb +8 -0
- data/lib/fog/bin/virtual_box.rb +52 -0
- data/lib/fog/cdn/aws.rb +9 -8
- data/lib/fog/cdn/rackspace.rb +6 -6
- data/lib/fog/cdn/requests/rackspace/post_container.rb +30 -0
- data/lib/fog/cdn/requests/rackspace/put_container.rb +1 -1
- data/lib/fog/compute.rb +6 -3
- data/lib/fog/compute/aws.rb +11 -7
- data/lib/fog/compute/bluebox.rb +5 -6
- data/lib/fog/compute/brightbox.rb +3 -0
- data/lib/fog/compute/go_grid.rb +5 -6
- data/lib/fog/compute/linode.rb +5 -6
- data/lib/fog/compute/models/aws/flavors.rb +19 -18
- data/lib/fog/compute/models/aws/server.rb +23 -0
- data/lib/fog/compute/models/aws/tag.rb +1 -1
- data/lib/fog/compute/models/brightbox/server.rb +7 -1
- data/lib/fog/compute/models/virtual_box/medium.rb +87 -0
- data/lib/fog/compute/models/virtual_box/medium_format.rb +34 -0
- data/lib/fog/compute/models/virtual_box/mediums.rb +32 -0
- data/lib/fog/compute/models/virtual_box/nat_engine.rb +65 -0
- data/lib/fog/compute/models/virtual_box/nat_redirect.rb +91 -0
- data/lib/fog/compute/models/virtual_box/nat_redirects.rb +41 -0
- data/lib/fog/compute/models/virtual_box/network_adapter.rb +82 -0
- data/lib/fog/compute/models/virtual_box/network_adapters.rb +42 -0
- data/lib/fog/compute/models/virtual_box/server.rb +241 -0
- data/lib/fog/compute/models/virtual_box/servers.rb +41 -0
- data/lib/fog/compute/models/virtual_box/storage_controller.rb +83 -0
- data/lib/fog/compute/models/virtual_box/storage_controllers.rb +38 -0
- data/lib/fog/compute/models/voxel/servers.rb +7 -6
- data/lib/fog/compute/new_servers.rb +5 -6
- data/lib/fog/compute/parsers/aws/monitor_unmonitor_instances.rb +35 -0
- data/lib/fog/compute/rackspace.rb +7 -7
- data/lib/fog/compute/requests/aws/delete_tags.rb +12 -9
- data/lib/fog/compute/requests/aws/monitor_instances.rb +52 -0
- data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +24 -8
- data/lib/fog/compute/requests/aws/unmonitor_instances.rb +53 -0
- data/lib/fog/compute/requests/brightbox/activate_console_server.rb +20 -0
- data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +20 -0
- data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +20 -0
- data/lib/fog/compute/slicehost.rb +5 -6
- data/lib/fog/compute/virtual_box.rb +48 -0
- data/lib/fog/compute/voxel.rb +30 -27
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/attributes.rb +3 -1
- data/lib/fog/core/collection.rb +2 -2
- data/lib/fog/core/credentials.rb +13 -3
- data/lib/fog/core/scp.rb +0 -4
- data/lib/fog/core/service.rb +0 -8
- data/lib/fog/core/ssh.rb +0 -4
- data/lib/fog/dns.rb +3 -3
- data/lib/fog/dns/aws.rb +8 -8
- data/lib/fog/dns/bluebox.rb +5 -7
- data/lib/fog/dns/dnsimple.rb +7 -7
- data/lib/fog/dns/linode.rb +5 -6
- data/lib/fog/dns/models/dnsimple/record.rb +11 -1
- data/lib/fog/dns/models/dnsimple/records.rb +7 -7
- data/lib/fog/dns/models/dnsimple/zones.rb +2 -1
- data/lib/fog/dns/requests/dnsimple/get_record.rb +34 -0
- data/lib/fog/dns/slicehost.rb +5 -6
- data/lib/fog/dns/zerigo.rb +5 -7
- data/lib/fog/providers.rb +2 -1
- data/lib/fog/providers/aws.rb +10 -8
- data/lib/fog/providers/virtual_box.rb +11 -0
- data/lib/fog/storage.rb +21 -0
- data/lib/fog/storage/aws.rb +16 -32
- data/lib/fog/storage/google.rb +6 -27
- data/lib/fog/storage/local.rb +7 -7
- data/lib/fog/storage/models/rackspace/directory.rb +1 -1
- data/lib/fog/storage/models/rackspace/file.rb +1 -0
- data/lib/fog/storage/rackspace.rb +5 -27
- data/lib/fog/storage/requests/aws/put_object.rb +2 -2
- data/lib/fog/storage/requests/aws/upload_part.rb +1 -1
- data/lib/fog/storage/requests/google/put_object.rb +2 -2
- data/lib/fog/storage/requests/rackspace/put_object.rb +1 -1
- data/tests/aws/requests/cloud_formation/stack_tests.rb +130 -0
- data/tests/aws/requests/iam/login_profile_tests.rb +64 -0
- data/tests/aws/requests/rds/helper.rb +169 -0
- data/tests/aws/requests/rds/instance_tests.rb +129 -0
- data/tests/aws/requests/rds/model_tests.rb +98 -0
- data/tests/aws/requests/rds/parameter_group_tests.rb +68 -0
- data/tests/aws/requests/rds/parameter_request_tests.rb +35 -0
- data/tests/compute/models/aws/server_monitor_tests.rb +47 -0
- data/tests/compute/models/server_tests.rb +7 -23
- data/tests/compute/parsers/aws/monitor_unmonitor_instances_tests.rb +49 -0
- data/tests/compute/requests/aws/security_group_tests.rb +69 -52
- data/tests/compute/requests/aws/tag_tests.rb +5 -5
- data/tests/compute/requests/brightbox/helper.rb +7 -6
- data/tests/compute/requests/brightbox/server_tests.rb +5 -0
- data/tests/compute/requests/voxel/server_tests.rb +2 -3
- data/tests/storage/requests/aws/bucket_tests.rb +10 -0
- metadata +148 -12
@@ -0,0 +1,35 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module RDS
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/rds/db_parser'
|
7
|
+
|
8
|
+
class RestoreDBInstanceToPointInTime < Fog::Parsers::AWS::RDS::DbParser
|
9
|
+
|
10
|
+
def reset
|
11
|
+
@response = { 'RestoreDBInstanceToPointInTime' => {}, 'ResponseMetadata' => {} }
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def start_element(name, attrs = [])
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def end_element(name)
|
20
|
+
case name
|
21
|
+
when 'DBInstance'
|
22
|
+
@response['RestoreDBInstanceToPointInTime']['DBInstance'] = @db_instance
|
23
|
+
@db_instance = fresh_instance
|
24
|
+
when 'RequestId'
|
25
|
+
@response['ResponseMetadata'][name] = @value
|
26
|
+
else
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module RDS
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/rds/security_group_parser'
|
7
|
+
|
8
|
+
class RevokeDBSecurityGroupIngress < Fog::Parsers::AWS::RDS::SecurityGroupParser
|
9
|
+
|
10
|
+
def reset
|
11
|
+
@response = { 'RevokeDBSecurityGroupIngressResult' => {}, 'ResponseMetadata' => {} }
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def start_element(name, attrs = [])
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def end_element(name)
|
20
|
+
case name
|
21
|
+
when 'DBSecurityGroup' then
|
22
|
+
@response['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup'] = @security_group
|
23
|
+
@security_group = fresh_security_group
|
24
|
+
when 'RequestId'
|
25
|
+
@response['ResponseMetadata'][name] = @value
|
26
|
+
else
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module RDS
|
5
|
+
|
6
|
+
class SecurityGroupParser < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@security_group = fresh_security_group
|
10
|
+
end
|
11
|
+
|
12
|
+
def fresh_security_group
|
13
|
+
{'EC2SecurityGroups' => [], 'IPRanges' => []}
|
14
|
+
end
|
15
|
+
|
16
|
+
def start_element(name, attrs = [])
|
17
|
+
super
|
18
|
+
case name
|
19
|
+
when 'EC2SecurityGroup', 'IPRange'; then @ingress = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def end_element(name)
|
25
|
+
case name
|
26
|
+
when 'DBSecurityGroupDescription' then @security_group['DBSecurityGroupDescription'] = @value
|
27
|
+
when 'DBSecurityGroupName' then @security_group['DBSecurityGroupName'] = @value
|
28
|
+
when 'OwnerId' then @security_group['OwnerId'] = @value
|
29
|
+
when 'EC2SecurityGroup', 'IPRange'
|
30
|
+
@security_group["#{name}s"] << @ingress unless @ingress.empty?
|
31
|
+
when 'EC2SecurityGroupName', 'EC2SecurityGroupOwnerId', 'CIDRIP', 'Status'
|
32
|
+
@ingress[name] = @value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module RDS
|
5
|
+
|
6
|
+
class SnapshotParser < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@db_snapshot = fresh_snapshot
|
10
|
+
end
|
11
|
+
|
12
|
+
def fresh_snapshot
|
13
|
+
{}
|
14
|
+
end
|
15
|
+
|
16
|
+
def start_element(name, attrs = [])
|
17
|
+
super
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def end_element(name)
|
22
|
+
case name
|
23
|
+
when 'AllocatedStorage' then @db_snapshot['AllocatedStorage'] = @value.to_i
|
24
|
+
when 'AvailabilityZone' then @db_snapshot['AvailabilityZone'] = @value
|
25
|
+
when 'DBInstanceIdentifier' then @db_snapshot['DBInstanceIdentifier'] = @value
|
26
|
+
when 'DBSnapshotIdentifier' then @db_snapshot['DBSnapshotIdentifier'] = @value
|
27
|
+
when 'Engine' then @db_snapshot['Engine'] = @value
|
28
|
+
when 'EngineVersion' then @db_snapshot['EngineVersion'] = @value
|
29
|
+
when 'InstanceCreateTime' then @db_snapshot['InstanceCreateTime'] = Time.parse @value
|
30
|
+
when 'MasterUsername' then @db_snapshot['MasterUsername'] = @value
|
31
|
+
when 'Port' then @db_snapshot['Port'] = @value.to_i
|
32
|
+
when 'SnapshotCreateTime' then @db_snapshot['SnapshotCreateTime'] = Time.parse @value
|
33
|
+
when 'Status' then @db_snapshot['Status'] = @value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/fog/aws/rds.rb
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class RDS < Fog::Service
|
4
|
+
|
5
|
+
class NotFound < Fog::Errors::Error; end
|
6
|
+
class IdentifierTaken < Fog::Errors::Error; end
|
7
|
+
|
8
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
9
|
+
recognizes :region, :host, :path, :port, :scheme, :persistent
|
10
|
+
|
11
|
+
request_path 'fog/aws/requests/rds'
|
12
|
+
|
13
|
+
request :create_db_instance
|
14
|
+
request :modify_db_instance
|
15
|
+
request :describe_db_instances
|
16
|
+
request :delete_db_instance
|
17
|
+
request :reboot_db_instance
|
18
|
+
request :create_db_instance_read_replica
|
19
|
+
|
20
|
+
request :describe_db_snapshots
|
21
|
+
request :create_db_snapshot
|
22
|
+
request :delete_db_snapshot
|
23
|
+
|
24
|
+
|
25
|
+
request :create_db_parameter_group
|
26
|
+
request :delete_db_parameter_group
|
27
|
+
request :modify_db_parameter_group
|
28
|
+
request :describe_db_parameter_groups
|
29
|
+
|
30
|
+
request :describe_db_security_groups
|
31
|
+
request :create_db_security_group
|
32
|
+
request :delete_db_security_group
|
33
|
+
request :authorize_db_security_group_ingress
|
34
|
+
request :revoke_db_security_group_ingress
|
35
|
+
|
36
|
+
request :describe_db_parameters
|
37
|
+
|
38
|
+
request :restore_db_instance_from_db_snapshot
|
39
|
+
request :restore_db_instance_to_point_in_time
|
40
|
+
|
41
|
+
model_path 'fog/aws/rds/models'
|
42
|
+
model :server
|
43
|
+
collection :servers
|
44
|
+
model :snapshot
|
45
|
+
collection :snapshots
|
46
|
+
model :parameter_group
|
47
|
+
collection :parameter_groups
|
48
|
+
|
49
|
+
model :parameter
|
50
|
+
collection :parameters
|
51
|
+
|
52
|
+
model :security_group
|
53
|
+
collection :security_groups
|
54
|
+
|
55
|
+
class Mock
|
56
|
+
|
57
|
+
def initialize(options={})
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
class Real
|
63
|
+
|
64
|
+
# Initialize connection to ELB
|
65
|
+
#
|
66
|
+
# ==== Notes
|
67
|
+
# options parameter must include values for :aws_access_key_id and
|
68
|
+
# :aws_secret_access_key in order to create a connection
|
69
|
+
#
|
70
|
+
# ==== Examples
|
71
|
+
# elb = ELB.new(
|
72
|
+
# :aws_access_key_id => your_aws_access_key_id,
|
73
|
+
# :aws_secret_access_key => your_aws_secret_access_key
|
74
|
+
# )
|
75
|
+
#
|
76
|
+
# ==== Parameters
|
77
|
+
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
78
|
+
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1'i, 'ap-southeast-1']
|
79
|
+
#
|
80
|
+
# ==== Returns
|
81
|
+
# * ELB object with connection to AWS.
|
82
|
+
def initialize(options={})
|
83
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
84
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
85
|
+
@hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
|
86
|
+
|
87
|
+
options[:region] ||= 'us-east-1'
|
88
|
+
@host = options[:host] || case options[:region]
|
89
|
+
when 'ap-northeast-1'
|
90
|
+
'rds.ap-northeast-1.amazonaws.com'
|
91
|
+
when 'ap-southeast-1'
|
92
|
+
'rds.ap-southeast-1.amazonaws.com'
|
93
|
+
when 'eu-west-1'
|
94
|
+
'rds.eu-west-1.amazonaws.com'
|
95
|
+
when 'us-east-1'
|
96
|
+
'rds.us-east-1.amazonaws.com'
|
97
|
+
when 'us-west-1'
|
98
|
+
'rds.us-west-1.amazonaws.com'
|
99
|
+
else
|
100
|
+
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
|
101
|
+
end
|
102
|
+
@path = options[:path] || '/'
|
103
|
+
@port = options[:port] || 443
|
104
|
+
@scheme = options[:scheme] || 'https'
|
105
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent])
|
106
|
+
end
|
107
|
+
|
108
|
+
def reload
|
109
|
+
@connection.reset
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
def request(params)
|
115
|
+
idempotent = params.delete(:idempotent)
|
116
|
+
parser = params.delete(:parser)
|
117
|
+
|
118
|
+
body = AWS.signed_params(
|
119
|
+
params,
|
120
|
+
{
|
121
|
+
:aws_access_key_id => @aws_access_key_id,
|
122
|
+
:hmac => @hmac,
|
123
|
+
:host => @host,
|
124
|
+
:path => @path,
|
125
|
+
:port => @port,
|
126
|
+
:version => '2010-07-28'
|
127
|
+
}
|
128
|
+
)
|
129
|
+
|
130
|
+
begin
|
131
|
+
response = @connection.request({
|
132
|
+
:body => body,
|
133
|
+
:expects => 200,
|
134
|
+
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
135
|
+
:idempotent => idempotent,
|
136
|
+
:host => @host,
|
137
|
+
:method => 'POST',
|
138
|
+
:parser => parser
|
139
|
+
})
|
140
|
+
rescue Excon::Errors::HTTPStatusError => error
|
141
|
+
if match = error.message.match(/<Code>(.*)<\/Code>[\s\\\w]+<Message>(.*)<\/Message>/m)
|
142
|
+
case match[1].split('.').last
|
143
|
+
when 'DBInstanceNotFound', 'DBParameterGroupNotFound', 'DBSnapshotNotFound'
|
144
|
+
raise Fog::AWS::RDS::NotFound.slurp(error, match[2])
|
145
|
+
when 'DBParameterGroupAlreadyExists'
|
146
|
+
raise Fog::AWS::RDS::IdentifierTaken.slurp(error, match[2])
|
147
|
+
else
|
148
|
+
raise
|
149
|
+
end
|
150
|
+
else
|
151
|
+
raise
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
response
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class RDS
|
6
|
+
|
7
|
+
class Parameter < Fog::Model
|
8
|
+
|
9
|
+
attribute :name, :aliases => ['ParameterName']
|
10
|
+
attribute :data_type, :aliases => 'DataType'
|
11
|
+
attribute :description, :aliases => 'Description'
|
12
|
+
attribute :allowed_values, :aliases => 'AllowedValues'
|
13
|
+
attribute :source, :aliases => 'Source'
|
14
|
+
attribute :modifiable, :aliases => 'IsModifiable'
|
15
|
+
attribute :apply_type, :aliases => 'ApplyType'
|
16
|
+
attribute :value, :aliases => 'ParameterValue'
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class RDS
|
6
|
+
|
7
|
+
class ParameterGroup < Fog::Model
|
8
|
+
|
9
|
+
identity :id, :aliases => ['DBParameterGroupName', :name]
|
10
|
+
attribute :family, :aliases => 'DBParameterGroupFamily'
|
11
|
+
attribute :description, :aliases => 'Description'
|
12
|
+
|
13
|
+
def save
|
14
|
+
requires :family
|
15
|
+
requires :description
|
16
|
+
requires :id
|
17
|
+
connection.create_db_parameter_group(id, family, description)
|
18
|
+
end
|
19
|
+
|
20
|
+
def modify(changes)
|
21
|
+
connection.modify_db_parameter_group id, changes.collect {|c| {'ParameterName' => c[:name], 'ParameterValue' => c[:value], 'ApplyMethod' => c[:apply_method]}}
|
22
|
+
end
|
23
|
+
|
24
|
+
def destroy
|
25
|
+
requires :id
|
26
|
+
connection.delete_db_parameter_group(id)
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
def parameters(filters={})
|
31
|
+
connection.parameters({:group => self}.merge(filters))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/aws/rds/models/parameter_group'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module AWS
|
6
|
+
class RDS
|
7
|
+
|
8
|
+
class ParameterGroups < Fog::Collection
|
9
|
+
|
10
|
+
model Fog::AWS::RDS::ParameterGroup
|
11
|
+
|
12
|
+
def all
|
13
|
+
data = connection.describe_db_parameter_groups.body['DescribeDBParameterGroupsResult']['DBParameterGroups']
|
14
|
+
load(data) # data is an array of attribute hashes
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(identity)
|
18
|
+
data = connection.describe_db_parameter_groups(identity).body['DescribeDBParameterGroupsResult']['DBParameterGroups'].first
|
19
|
+
new(data) # data is an attribute hash
|
20
|
+
rescue Fog::AWS::RDS::NotFound
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/aws/rds/models/parameter'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module AWS
|
6
|
+
class RDS
|
7
|
+
|
8
|
+
class Parameters < Fog::Collection
|
9
|
+
attribute :group
|
10
|
+
attribute :filters
|
11
|
+
model Fog::AWS::RDS::Parameter
|
12
|
+
|
13
|
+
def initialize(attributes)
|
14
|
+
self.filters ||= {}
|
15
|
+
if attributes[:source]
|
16
|
+
filters[:source] = attributes[:source]
|
17
|
+
end
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def all(filters = filters)
|
22
|
+
self.filters = filters
|
23
|
+
result = []
|
24
|
+
marker = nil
|
25
|
+
finished = false
|
26
|
+
while !finished
|
27
|
+
data = connection.describe_db_parameters(group.id, filters.merge(:marker => marker)).body
|
28
|
+
result.concat(data['DescribeDBParametersResult']['Parameters'])
|
29
|
+
marker = data['DescribeDBParametersResult']['Marker']
|
30
|
+
finished = marker.nil?
|
31
|
+
end
|
32
|
+
load(result) # data is an array of attribute hashes
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class RDS
|
6
|
+
|
7
|
+
class SecurityGroup < Fog::Model
|
8
|
+
|
9
|
+
identity :id, :aliases => ['DBSecurityGroupName']
|
10
|
+
attribute :description, :aliases => 'DBSecurityGroupDescription'
|
11
|
+
attribute :ec2_security_groups, :aliases => 'EC2SecurityGroups', :type => :array
|
12
|
+
attribute :ip_ranges, :aliases => 'IPRanges', :type => :array
|
13
|
+
attribute :owner_id, :aliases => 'OwnerId'
|
14
|
+
|
15
|
+
def ready?
|
16
|
+
(ec2_security_groups + ip_ranges).all?{|ingress| ingress['Status'] == 'authorized'}
|
17
|
+
end
|
18
|
+
|
19
|
+
def destroy
|
20
|
+
requires :id
|
21
|
+
connection.delete_db_security_group(id)
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
def save
|
26
|
+
requires :id
|
27
|
+
requires :description
|
28
|
+
|
29
|
+
data = connection.create_db_security_group(id, description).body['CreateDBSecurityGroupResult']['DBSecurityGroup']
|
30
|
+
merge_attributes(data)
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
# group_owner_id defaults to the current owner_id
|
35
|
+
def authorize_ec2_security_group(group_name, group_owner_id=owner_id)
|
36
|
+
authorize_ingress({
|
37
|
+
'EC2SecurityGroupName' => group_name,
|
38
|
+
'EC2SecurityGroupOwnerId' => group_owner_id
|
39
|
+
})
|
40
|
+
end
|
41
|
+
|
42
|
+
def authorize_cidrip(cidrip)
|
43
|
+
authorize_ingress({'CIDRIP' => cidrip})
|
44
|
+
end
|
45
|
+
|
46
|
+
def authorize_ingress(opts)
|
47
|
+
data = connection.authorize_db_security_group_ingress(id, opts).body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']
|
48
|
+
merge_attributes(data)
|
49
|
+
end
|
50
|
+
|
51
|
+
# group_owner_id defaults to the current owner_id
|
52
|
+
def revoke_ec2_security_group(group_name, group_owner_id=owner_id)
|
53
|
+
revoke_ingress({
|
54
|
+
'EC2SecurityGroupName' => group_name,
|
55
|
+
'EC2SecurityGroupOwnerId' => group_owner_id
|
56
|
+
})
|
57
|
+
end
|
58
|
+
|
59
|
+
def revoke_cidrip(cidrip)
|
60
|
+
revoke_ingress({'CIDRIP' => cidrip})
|
61
|
+
end
|
62
|
+
|
63
|
+
def revoke_ingress(opts)
|
64
|
+
data = connection.revoke_db_security_group_ingress(id, opts).body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup']
|
65
|
+
merge_attributes(data)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|