fog 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +3 -3
- data/changelog.txt +213 -0
- data/docs/compute/index.markdown +15 -1
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +9 -0
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +2 -0
- data/lib/fog/aws/cloud_watch.rb +2 -0
- data/lib/fog/aws/compute.rb +9 -3
- data/lib/fog/aws/elasticache.rb +8 -1
- data/lib/fog/aws/elb.rb +2 -0
- data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +1 -2
- data/lib/fog/aws/models/compute/security_group.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +3 -1
- data/lib/fog/aws/models/dns/records.rb +3 -3
- data/lib/fog/aws/models/elb/load_balancer.rb +6 -0
- data/lib/fog/aws/models/storage/file.rb +2 -2
- data/lib/fog/aws/models/storage/files.rb +4 -4
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +64 -0
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
- data/lib/fog/aws/parsers/sqs/receive_message.rb +1 -1
- data/lib/fog/aws/parsers/sts/get_session_token.rb +31 -0
- data/lib/fog/aws/rds.rb +36 -1
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
- data/lib/fog/aws/requests/compute/describe_instance_status.rb +36 -0
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
- data/lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb +27 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +64 -1
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +19 -3
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +40 -1
- data/lib/fog/aws/requests/rds/describe_db_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +24 -1
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +17 -1
- data/lib/fog/aws/requests/storage/{hash_to_acl.rb → acl_utils.rb} +8 -0
- data/lib/fog/aws/requests/storage/copy_object.rb +8 -0
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_http_url.rb +4 -3
- data/lib/fog/aws/requests/storage/get_object_https_url.rb +4 -3
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
- data/lib/fog/aws/requests/sts/get_federation_token.rb +20 -0
- data/lib/fog/aws/requests/sts/get_session_token.rb +18 -0
- data/lib/fog/aws/simpledb.rb +5 -1
- data/lib/fog/aws/sns.rb +2 -0
- data/lib/fog/aws/sqs.rb +5 -1
- data/lib/fog/aws/storage.rb +6 -0
- data/lib/fog/aws/sts.rb +137 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/aws.rb +2 -0
- data/lib/fog/bin/clodo.rb +31 -0
- data/lib/fog/brightbox/compute.rb +7 -0
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
- data/lib/fog/brightbox/models/compute/firewall_policies.rb +29 -0
- data/lib/fog/brightbox/models/compute/firewall_policy.rb +65 -0
- data/lib/fog/brightbox/models/compute/firewall_rule.rb +54 -0
- data/lib/fog/brightbox/models/compute/firewall_rules.rb +24 -0
- data/lib/fog/brightbox/models/compute/image.rb +2 -0
- data/lib/fog/brightbox/models/compute/server.rb +41 -6
- data/lib/fog/brightbox/models/compute/server_group.rb +56 -17
- data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +14 -0
- data/lib/fog/clodo.rb +34 -0
- data/lib/fog/clodo/compute.rb +152 -0
- data/lib/fog/clodo/models/compute/image.rb +31 -0
- data/lib/fog/clodo/models/compute/images.rb +28 -0
- data/lib/fog/clodo/models/compute/server.rb +163 -0
- data/lib/fog/clodo/models/compute/servers.rb +36 -0
- data/lib/fog/clodo/requests/compute/add_ip_address.rb +49 -0
- data/lib/fog/clodo/requests/compute/create_server.rb +112 -0
- data/lib/fog/clodo/requests/compute/delete_ip_address.rb +47 -0
- data/lib/fog/clodo/requests/compute/delete_server.rb +44 -0
- data/lib/fog/clodo/requests/compute/get_image_details.rb +20 -0
- data/lib/fog/clodo/requests/compute/get_server_details.rb +49 -0
- data/lib/fog/clodo/requests/compute/list_images.rb +48 -0
- data/lib/fog/clodo/requests/compute/list_images_detail.rb +61 -0
- data/lib/fog/clodo/requests/compute/list_servers.rb +50 -0
- data/lib/fog/clodo/requests/compute/list_servers_detail.rb +51 -0
- data/lib/fog/clodo/requests/compute/move_ip_address.rb +34 -0
- data/lib/fog/clodo/requests/compute/reboot_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/rebuild_server.rb +21 -0
- data/lib/fog/clodo/requests/compute/server_action.rb +25 -0
- data/lib/fog/clodo/requests/compute/start_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/stop_server.rb +19 -0
- data/lib/fog/compute.rb +3 -0
- data/lib/fog/core/credentials.rb +3 -3
- data/lib/fog/core/errors.rb +2 -0
- data/lib/fog/core/wait_for.rb +1 -1
- data/lib/fog/dnsmadeeasy/dns.rb +1 -1
- data/lib/fog/libvirt/compute.rb +2 -0
- data/lib/fog/libvirt/models/compute/nodes.rb +1 -3
- data/lib/fog/libvirt/models/compute/server.rb +8 -1
- data/lib/fog/providers.rb +1 -0
- data/lib/fog/rackspace/dns.rb +10 -2
- data/lib/fog/rackspace/load_balancers.rb +3 -0
- data/lib/fog/rackspace/models/compute/server.rb +2 -2
- data/lib/fog/rackspace/models/dns/callback.rb +3 -1
- data/lib/fog/rackspace/models/dns/record.rb +4 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +18 -8
- data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +1 -2
- data/lib/fog/rackspace/requests/load_balancers/get_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +8 -2
- data/lib/fog/rackspace/requests/load_balancers/remove_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_error_page.rb +21 -0
- data/lib/fog/vcloud/compute.rb +7 -1
- data/lib/fog/vcloud/models/compute/catalogs.rb +4 -5
- data/lib/fog/vcloud/models/compute/helpers/status.rb +37 -0
- data/lib/fog/vcloud/models/compute/network.rb +13 -49
- data/lib/fog/vcloud/models/compute/networks.rb +12 -3
- data/lib/fog/vcloud/models/compute/organization.rb +44 -0
- data/lib/fog/vcloud/models/compute/organizations.rb +29 -0
- data/lib/fog/vcloud/models/compute/server.rb +35 -56
- data/lib/fog/vcloud/models/compute/servers.rb +11 -13
- data/lib/fog/vcloud/models/compute/vapp.rb +41 -0
- data/lib/fog/vcloud/models/compute/vapps.rb +32 -0
- data/lib/fog/vcloud/models/compute/vdc.rb +11 -26
- data/lib/fog/vcloud/models/compute/vdcs.rb +6 -8
- data/lib/fog/vcloud/requests/compute/get_server.rb +10 -0
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/models/compute/server.rb +18 -0
- data/lib/fog/vsphere/models/compute/servers.rb +8 -2
- data/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +132 -91
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
- data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +58 -0
- data/tests/aws/models/elb/model_tests.rb +5 -0
- data/tests/aws/requests/compute/instance_tests.rb +23 -0
- data/tests/aws/requests/compute/security_group_tests.rb +1 -0
- data/tests/aws/requests/elb/listener_tests.rb +4 -0
- data/tests/aws/requests/storage/{hash_to_acl_tests.rb → acl_utils_tests.rb} +38 -2
- data/tests/aws/requests/storage/bucket_tests.rb +0 -3
- data/tests/aws/requests/storage/object_tests.rb +2 -4
- data/tests/aws/requests/sts/get_federation_token_tests.rb +21 -0
- data/tests/aws/requests/sts/session_token_tests.rb +16 -0
- data/tests/brightbox/requests/compute/account_tests.rb +11 -6
- data/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +32 -17
- data/tests/brightbox/requests/compute/helper.rb +29 -3
- data/tests/brightbox/requests/compute/image_tests.rb +17 -14
- data/tests/brightbox/requests/compute/interface_tests.rb +3 -2
- data/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
- data/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
- data/tests/brightbox/requests/compute/server_tests.rb +41 -22
- data/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
- data/tests/brightbox/requests/compute/user_tests.rb +11 -16
- data/tests/brightbox/requests/compute/zone_tests.rb +7 -6
- data/tests/clodo/requests/compute/image_tests.rb +36 -0
- data/tests/clodo/requests/compute/server_tests.rb +152 -0
- data/tests/compute/helper.rb +1 -1
- data/tests/core/credential_tests.rb +2 -2
- data/tests/glesys/requests/compute/helper.rb +91 -66
- data/tests/glesys/requests/compute/ip_tests.rb +1 -1
- data/tests/glesys/requests/compute/server_tests.rb +5 -5
- data/tests/helpers/mock_helper.rb +2 -0
- data/tests/rackspace/models/dns/zone_tests.rb +14 -0
- data/tests/rackspace/models/{access_list_tests.rb → load_balancers/access_list_tests.rb} +0 -0
- data/tests/rackspace/models/{access_lists_tests.rb → load_balancers/access_lists_tests.rb} +0 -0
- data/tests/rackspace/models/{load_balancer_tests.rb → load_balancers/load_balancer_tests.rb} +25 -0
- data/tests/rackspace/models/{load_balancers_tests.rb → load_balancers/load_balancers_tests.rb} +0 -0
- data/tests/rackspace/models/{node_tests.rb → load_balancers/node_tests.rb} +0 -0
- data/tests/rackspace/models/{nodes_tests.rb → load_balancers/nodes_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ip_tests.rb → load_balancers/virtual_ip_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ips_tests.rb → load_balancers/virtual_ips_tests.rb} +0 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +4 -2
- data/tests/rackspace/requests/load_balancers/error_page_tests.rb +31 -0
- data/tests/rackspace/requests/load_balancers/helper.rb +27 -11
- data/tests/rackspace/requests/load_balancers/load_balancer_tests.rb +4 -1
- data/tests/rackspace/requests/load_balancers/node_tests.rb +24 -25
- data/tests/slicehost/requests/compute/slice_tests.rb +2 -2
- data/tests/storm_on_demand/requests/compute/server_tests.rb +3 -3
- data/tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2 +110 -0
- data/tests/vcloud/data/api_+_v1.0_+_login +5 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_1 +44 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_2 +31 -0
- data/tests/vcloud/data/api_+_v1.0_+_org_+_1 +17 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1 +369 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1 +139 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2 +155 -0
- data/tests/vcloud/data/api_+_v1.0_+_vdc_+_1 +61 -0
- data/tests/vcloud/models/compute/conn_helper.rb +20 -0
- data/tests/vcloud/models/compute/network_tests.rb +65 -0
- data/tests/vcloud/models/compute/networks_tests.rb +42 -0
- data/tests/vcloud/models/compute/organization_tests.rb +13 -0
- data/tests/vcloud/models/compute/organizations_tests.rb +14 -0
- data/tests/vcloud/models/compute/server_tests.rb +136 -0
- data/tests/vcloud/models/compute/servers_tests.rb +10 -89
- data/tests/vcloud/models/compute/vapp_tests.rb +27 -0
- data/tests/vcloud/models/compute/vapps_tests.rb +17 -0
- data/tests/vcloud/models/compute/vdc_tests.rb +42 -0
- data/tests/vcloud/models/compute/vdcs_tests.rb +17 -0
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +2 -6
- metadata +151 -55
data/lib/fog/aws/elb.rb
CHANGED
@@ -120,6 +120,8 @@ module Fog
|
|
120
120
|
'elasticloadbalancing.us-west-1.amazonaws.com'
|
121
121
|
when 'us-west-2'
|
122
122
|
'elasticloadbalancing.us-west-2.amazonaws.com'
|
123
|
+
when 'sa-east-1'
|
124
|
+
'elasticloadbalancing.sa-east-1.amazonaws.com'
|
123
125
|
else
|
124
126
|
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
|
125
127
|
end
|
@@ -25,7 +25,6 @@ module Fog
|
|
25
25
|
|
26
26
|
put_opts = {'MetricName' => metric_name, 'Unit' => unit}
|
27
27
|
put_opts.merge!('Dimensions' => dimensions) if dimensions
|
28
|
-
put_opts.merge!('Timestamp' => dimensions) if timestamp
|
29
28
|
if value
|
30
29
|
put_opts.merge!('Value' => value)
|
31
30
|
else
|
@@ -43,4 +42,4 @@ module Fog
|
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
46
|
-
end
|
45
|
+
end
|
@@ -7,8 +7,8 @@ module Fog
|
|
7
7
|
class SecurityGroup < Fog::Model
|
8
8
|
|
9
9
|
identity :name, :aliases => 'groupName'
|
10
|
-
|
11
10
|
attribute :description, :aliases => 'groupDescription'
|
11
|
+
attribute :group_id, :aliases => 'groupId'
|
12
12
|
attribute :ip_permissions, :aliases => 'ipPermissions'
|
13
13
|
attribute :owner_id, :aliases => 'ownerId'
|
14
14
|
|
@@ -34,6 +34,7 @@ module Fog
|
|
34
34
|
attribute :reason
|
35
35
|
attribute :root_device_name, :aliases => 'rootDeviceName'
|
36
36
|
attribute :root_device_type, :aliases => 'rootDeviceType'
|
37
|
+
attribute :security_group_ids, :aliases => 'securityGroupIds'
|
37
38
|
attribute :state, :aliases => 'instanceState', :squash => 'name'
|
38
39
|
attribute :state_reason, :aliases => 'stateReason'
|
39
40
|
attribute :subnet_id, :aliases => 'subnetId'
|
@@ -45,7 +46,7 @@ module Fog
|
|
45
46
|
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
46
47
|
|
47
48
|
def initialize(attributes={})
|
48
|
-
self.groups ||= ["default"] unless attributes[:subnet_id]
|
49
|
+
self.groups ||= ["default"] unless (attributes[:subnet_id] || attributes[:security_group_ids])
|
49
50
|
self.flavor_id ||= 't1.micro'
|
50
51
|
self.image_id ||= begin
|
51
52
|
self.username = 'ubuntu'
|
@@ -152,6 +153,7 @@ module Fog
|
|
152
153
|
'Placement.Tenancy' => tenancy,
|
153
154
|
'RamdiskId' => ramdisk_id,
|
154
155
|
'SecurityGroup' => groups,
|
156
|
+
'SecurityGroupId' => security_group_ids,
|
155
157
|
'SubnetId' => subnet_id,
|
156
158
|
'UserData' => user_data
|
157
159
|
}
|
@@ -20,9 +20,9 @@ module Fog
|
|
20
20
|
|
21
21
|
def all(options = {})
|
22
22
|
requires :zone
|
23
|
-
options['
|
24
|
-
options['
|
25
|
-
options['
|
23
|
+
options['maxitems'] ||= max_items
|
24
|
+
options['name'] ||= name
|
25
|
+
options['type'] ||= type
|
26
26
|
data = connection.list_resource_record_sets(zone.id, options).body
|
27
27
|
merge_attributes(data.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextRecordName', 'NextRecordType'].include?(key)})
|
28
28
|
# leave out the default, read only records
|
@@ -96,6 +96,12 @@ module Fog
|
|
96
96
|
reload
|
97
97
|
end
|
98
98
|
|
99
|
+
def set_listener_ssl_certificate(port, ssl_certificate_id)
|
100
|
+
requires :id
|
101
|
+
connection.set_load_balancer_listener_ssl_certificate(id, port, ssl_certificate_id)
|
102
|
+
reload
|
103
|
+
end
|
104
|
+
|
99
105
|
def unset_listener_policy(port)
|
100
106
|
set_listener_policy(port, [])
|
101
107
|
end
|
@@ -78,14 +78,14 @@ module Fog
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
def get_http_url(key, expires)
|
81
|
+
def get_http_url(key, expires, options = {})
|
82
82
|
requires :directory
|
83
|
-
connection.get_object_http_url(directory.key, key, expires)
|
83
|
+
connection.get_object_http_url(directory.key, key, expires, options)
|
84
84
|
end
|
85
85
|
|
86
|
-
def get_https_url(key, expires)
|
86
|
+
def get_https_url(key, expires, options = {})
|
87
87
|
requires :directory
|
88
|
-
connection.get_object_https_url(directory.key, key, expires)
|
88
|
+
connection.get_object_https_url(directory.key, key, expires, options)
|
89
89
|
end
|
90
90
|
|
91
91
|
def head(key, options = {})
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Compute
|
4
|
+
module AWS
|
5
|
+
class DescribeInstanceStatus < Fog::Parsers::Base
|
6
|
+
|
7
|
+
def new_instance
|
8
|
+
@instance = { 'eventsSet' => [], 'instanceState' => {} }
|
9
|
+
end
|
10
|
+
|
11
|
+
def new_event
|
12
|
+
@event = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def reset
|
16
|
+
@instance_status = {}
|
17
|
+
@response = { 'instanceStatusSet' => [] }
|
18
|
+
@in_events_set = false
|
19
|
+
new_event
|
20
|
+
new_instance
|
21
|
+
end
|
22
|
+
|
23
|
+
def start_element(name, attrs=[])
|
24
|
+
super
|
25
|
+
case name
|
26
|
+
when 'eventsSet'
|
27
|
+
@in_events_set = true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def end_element(name)
|
33
|
+
if @in_events_set
|
34
|
+
case name
|
35
|
+
when 'code', 'description'
|
36
|
+
@event[name] = value
|
37
|
+
when 'notAfter', 'notBefore'
|
38
|
+
@event[name] = Time.parse(value)
|
39
|
+
when 'item'
|
40
|
+
@instance['eventsSet'] << @event
|
41
|
+
new_event
|
42
|
+
when 'eventsSet'
|
43
|
+
@in_events_set = false
|
44
|
+
end
|
45
|
+
else
|
46
|
+
case name
|
47
|
+
when 'instanceId', 'availabilityZone'
|
48
|
+
@instance[name] = value
|
49
|
+
when 'name', 'code'
|
50
|
+
@instance['instanceState'][name] = value
|
51
|
+
when 'item'
|
52
|
+
@response['instanceStatusSet'] << @instance
|
53
|
+
new_instance
|
54
|
+
when 'requestId'
|
55
|
+
@response[name] = value
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -24,7 +24,7 @@ module Fog
|
|
24
24
|
when 'Value'
|
25
25
|
case @current_attribute_name
|
26
26
|
when 'ApproximateFirstReceiveTimestamp', 'SentTimestamp'
|
27
|
-
@message['Attributes'][@current_attribute_name] = Time.at(@value.to_i)
|
27
|
+
@message['Attributes'][@current_attribute_name] = Time.at(@value.to_i / 1000.0)
|
28
28
|
when 'ApproximateReceiveCount'
|
29
29
|
@message['Attributes'][@current_attribute_name] = @value.to_i
|
30
30
|
else
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module STS
|
5
|
+
|
6
|
+
class GetSessionToken < Fog::Parsers::Base
|
7
|
+
# http://docs.amazonwebservices.com/IAM/latest/UserGuide/index.html?CreatingFedTokens.html
|
8
|
+
|
9
|
+
def reset
|
10
|
+
@response = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_element(name)
|
14
|
+
case name
|
15
|
+
when 'SessionToken', 'SecretAccessKey', 'Expiration', 'AccessKeyId'
|
16
|
+
@response[name] = @value.strip
|
17
|
+
when 'Arn', 'FederatedUserId'
|
18
|
+
@response[name] = @value
|
19
|
+
when 'PackedPolicySize'
|
20
|
+
@response[name] = @value
|
21
|
+
when 'RequestId'
|
22
|
+
@response[name] = @value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/fog/aws/rds.rb
CHANGED
@@ -57,9 +57,42 @@ module Fog
|
|
57
57
|
|
58
58
|
class Mock
|
59
59
|
|
60
|
+
def self.data
|
61
|
+
@data ||= Hash.new do |hash, region|
|
62
|
+
owner_id = Fog::AWS::Mock.owner_id
|
63
|
+
hash[region] = Hash.new do |region_hash, key|
|
64
|
+
region_hash[key] = {
|
65
|
+
:servers => {}
|
66
|
+
}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.reset
|
72
|
+
@data = nil
|
73
|
+
end
|
74
|
+
|
60
75
|
def initialize(options={})
|
61
|
-
|
76
|
+
|
77
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
78
|
+
|
79
|
+
@region = options[:region] || 'us-east-1'
|
80
|
+
|
81
|
+
unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
|
82
|
+
raise ArgumentError, "Unknown region: #{@region.inspect}"
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
def data
|
88
|
+
self.class.data[@region][@aws_access_key_id]
|
89
|
+
end
|
90
|
+
|
91
|
+
def reset_data
|
92
|
+
self.class.data[@region].delete(@aws_access_key_id)
|
62
93
|
end
|
94
|
+
|
95
|
+
|
63
96
|
|
64
97
|
end
|
65
98
|
|
@@ -103,6 +136,8 @@ module Fog
|
|
103
136
|
'rds.us-west-1.amazonaws.com'
|
104
137
|
when 'us-west-2'
|
105
138
|
'rds.us-west-2.amazonaws.com'
|
139
|
+
when 'sa-east-1'
|
140
|
+
'rds.sa-east-1.amazonaws.com'
|
106
141
|
else
|
107
142
|
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
|
108
143
|
end
|
@@ -57,6 +57,9 @@ module Fog
|
|
57
57
|
|
58
58
|
{"messageSet" => [], "regionName" => "us-west-2", "zoneName" => "us-west-2a", "zoneState" => "available"},
|
59
59
|
{"messageSet" => [], "regionName" => "us-west-2", "zoneName" => "us-west-2b", "zoneState" => "available"},
|
60
|
+
|
61
|
+
{"messageSet" => [], "regionName" => "sa-east-1", "zoneName" => "sa-east-1a", "zoneState" => "available"},
|
62
|
+
{"messageSet" => [], "regionName" => "sa-east-1", "zoneName" => "sa-east-1b", "zoneState" => "available"},
|
60
63
|
|
61
64
|
{"messageSet" => [], "regionName" => "eu-west-1", "zoneName" => "eu-west-1a", "zoneState" => "available"},
|
62
65
|
{"messageSet" => [], "regionName" => "eu-west-1", "zoneName" => "eu-west-1b", "zoneState" => "available"},
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class AWS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/compute/describe_instance_status'
|
7
|
+
|
8
|
+
def describe_instance_status(filters = {})
|
9
|
+
raise ArgumentError.new("Filters must be a hash, but is a #{filters.class}.") unless filters.is_a?(Hash)
|
10
|
+
|
11
|
+
params = Fog::AWS.indexed_filters(filters)
|
12
|
+
request({
|
13
|
+
'Action' => 'DescribeInstanceStatus',
|
14
|
+
:idempotent => true,
|
15
|
+
:parser => Fog::Parsers::Compute::AWS::DescribeInstanceStatus.new
|
16
|
+
}.merge!(params))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Mock
|
21
|
+
def describe_instance_status(filters = {})
|
22
|
+
response = Excon::Response.new
|
23
|
+
response.status = 200
|
24
|
+
|
25
|
+
response.body = {
|
26
|
+
'instanceStatusSet' => [],
|
27
|
+
'requestId' => Fog::AWS::Mock.request_id
|
28
|
+
}
|
29
|
+
|
30
|
+
response
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -16,6 +16,7 @@ module Fog
|
|
16
16
|
# * 'requestId'<~String> - Id of request
|
17
17
|
# * 'securityGroupInfo'<~Array>:
|
18
18
|
# * 'groupDescription'<~String> - Description of security group
|
19
|
+
# * 'groupId'<~String> - ID of the security group.
|
19
20
|
# * 'groupName'<~String> - Name of security group
|
20
21
|
# * 'ipPermissions'<~Array>:
|
21
22
|
# * 'fromPort'<~Integer> - Start of port range (or -1 for ICMP wildcard)
|
@@ -59,6 +60,7 @@ module Fog
|
|
59
60
|
aliases = {
|
60
61
|
'description' => 'groupDescription',
|
61
62
|
'group-name' => 'groupName',
|
63
|
+
'group-id' => 'groupId',
|
62
64
|
'owner-id' => 'ownerId'
|
63
65
|
}
|
64
66
|
permission_aliases = {
|
@@ -34,6 +34,33 @@ module Fog
|
|
34
34
|
end
|
35
35
|
|
36
36
|
class Mock
|
37
|
+
def set_load_balancer_listener_ssl_certificate(lb_name, load_balancer_port, ssl_certificate_id)
|
38
|
+
raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]
|
39
|
+
|
40
|
+
certificate_ids = Fog::AWS::IAM::Mock.data[@aws_access_key_id][:server_certificates].map {|n, c| c['Arn'] }
|
41
|
+
if !certificate_ids.include? ssl_certificate_id
|
42
|
+
raise Fog::AWS::IAM::NotFound.new('CertificateNotFound')
|
43
|
+
end
|
44
|
+
|
45
|
+
response = Excon::Response.new
|
46
|
+
|
47
|
+
unless listener = load_balancer['ListenerDescriptions'].find { |listener| listener['Listener']['LoadBalancerPort'] == load_balancer_port }
|
48
|
+
response.status = 400
|
49
|
+
response.body = "<?xml version=\"1.0\"?><Response><Errors><Error><Code>ListenerNotFound</Code><Message>LoadBalancer does not have a listnener configured at the given port.</Message></Error></Errors><RequestID>#{Fog::AWS::Mock.request_id}</RequestId></Response>"
|
50
|
+
raise Excon::Errors.status_error({:expects => 200}, response)
|
51
|
+
end
|
52
|
+
|
53
|
+
listener['Listener']['SSLCertificateId'] = ssl_certificate_id
|
54
|
+
|
55
|
+
response.status = 200
|
56
|
+
response.body = {
|
57
|
+
"ResponseMetadata" => {
|
58
|
+
"RequestId" => Fog::AWS::Mock.request_id
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
response
|
63
|
+
end
|
37
64
|
end
|
38
65
|
end
|
39
66
|
end
|
@@ -47,7 +47,70 @@ module Fog
|
|
47
47
|
class Mock
|
48
48
|
|
49
49
|
def create_db_instance(db_name, options={})
|
50
|
-
|
50
|
+
response = Excon::Response.new
|
51
|
+
if self.data[:servers] and self.data[:servers][db_name]
|
52
|
+
# I don't know how to raise an exception that contains the excon data
|
53
|
+
#response.status = 400
|
54
|
+
#response.body = {
|
55
|
+
# 'Code' => 'DBInstanceAlreadyExists',
|
56
|
+
# 'Message' => "DB Instance already exists"
|
57
|
+
#}
|
58
|
+
#return response
|
59
|
+
raise Fog::AWS::RDS::IdentifierTaken.new("DBInstanceAlreadyExists #{response.body.to_s}")
|
60
|
+
end
|
61
|
+
|
62
|
+
# These are the required parameters according to the API
|
63
|
+
required_params = %w{AllocatedStorage DBInstanceClass Engine MasterUserPassword MasterUsername }
|
64
|
+
required_params.each do |key|
|
65
|
+
unless options.has_key?(key) and options[key] and !options[key].to_s.empty?
|
66
|
+
#response.status = 400
|
67
|
+
#response.body = {
|
68
|
+
# 'Code' => 'MissingParameter',
|
69
|
+
# 'Message' => "The request must contain the parameter #{key}"
|
70
|
+
#}
|
71
|
+
#return response
|
72
|
+
raise Fog::AWS::RDS::NotFound.new("The request must contain the parameter #{key}")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
data =
|
77
|
+
{
|
78
|
+
"DBInstanceIdentifier"=> db_name,
|
79
|
+
"DBName" => options["DBName"],
|
80
|
+
"created_at" => nil,
|
81
|
+
"AutoMinorVersionUpgrade"=>true,
|
82
|
+
"Endpoint"=>{},
|
83
|
+
"ReadReplicaDBInstanceIdentifiers"=>[],
|
84
|
+
"PreferredMaintenanceWindow"=>"mon:04:30-mon:05:00",
|
85
|
+
"Engine"=> options["Engine"],
|
86
|
+
"EngineVersion"=> options["EngineVersion"] || "5.1.57",
|
87
|
+
"PendingModifiedValues"=>{"MasterUserPassword"=>"****"}, # This clears when is available
|
88
|
+
"MultiAZ"=>false,
|
89
|
+
"MasterUsername"=> options["MasterUsername"],
|
90
|
+
"DBInstanceClass"=> options["DBInstanceClass"],
|
91
|
+
"DBInstanceStatus"=>"creating",
|
92
|
+
"BackupRetentionPeriod"=> options["BackupRetentionPeriod"] || 1,
|
93
|
+
"AllocatedStorage"=> options["AllocatedStorage"],
|
94
|
+
"DBParameterGroups"=> # I think groups shoul be in the self.data method
|
95
|
+
[{"DBParameterGroupName"=>"default.mysql5.1",
|
96
|
+
"ParameterApplyStatus"=>"in-sync"}],
|
97
|
+
"DBSecurityGroups"=>
|
98
|
+
[{"Status"=>"active",
|
99
|
+
"DBSecurityGroupName"=>"default"}],
|
100
|
+
"LicenseModel"=>"general-public-license",
|
101
|
+
"PreferredBackupWindow"=>"08:00-08:30"
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
self.data[:servers][db_name] = data
|
106
|
+
response.body = {
|
107
|
+
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
|
108
|
+
"CreateDBInstanceResult"=> {"DBInstance"=> data}
|
109
|
+
}
|
110
|
+
response.status = 200
|
111
|
+
# This values aren't showed at creating time but at available time
|
112
|
+
self.data[:servers][db_name]["created_at"] = Time.now
|
113
|
+
response
|
51
114
|
end
|
52
115
|
|
53
116
|
end
|