fog 1.0.0 → 1.1.0
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.
- data/README.rdoc +2 -9
- data/Rakefile +3 -2
- data/docs/_layouts/default.html +13 -13
- data/docs/about/contributing.markdown +1 -1
- data/docs/about/getting_started.markdown +28 -3
- data/docs/dns/index.markdown +4 -4
- data/docs/index.markdown +2 -10
- data/docs/public/css/fog.css +14 -1
- data/docs/storage/index.markdown +2 -2
- data/fog.gemspec +6 -5
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +26 -1
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +3 -0
- data/lib/fog/aws/cloud_watch.rb +17 -1
- data/lib/fog/aws/compute.rb +50 -18
- data/lib/fog/aws/elb.rb +4 -2
- data/lib/fog/aws/emr.rb +133 -0
- data/lib/fog/aws/models/cloud_watch/alarm.rb +12 -0
- data/lib/fog/aws/models/cloud_watch/alarm_data.rb +39 -0
- data/lib/fog/aws/models/cloud_watch/alarm_datum.rb +66 -0
- data/lib/fog/aws/models/cloud_watch/alarm_histories.rb +18 -0
- data/lib/fog/aws/models/cloud_watch/alarm_history.rb +16 -0
- data/lib/fog/aws/models/cloud_watch/alarms.rb +30 -0
- data/lib/fog/aws/models/compute/addresses.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +1 -1
- data/lib/fog/aws/models/compute/security_groups.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +4 -2
- data/lib/fog/aws/models/compute/servers.rb +1 -1
- data/lib/fog/aws/models/compute/snapshots.rb +1 -1
- data/lib/fog/aws/models/compute/spot_request.rb +21 -4
- data/lib/fog/aws/models/compute/spot_requests.rb +45 -1
- data/lib/fog/aws/models/compute/volumes.rb +1 -1
- data/lib/fog/aws/models/elb/load_balancer.rb +2 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
- data/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
- data/lib/fog/aws/parsers/cloud_watch/delete_alarms.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb +40 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +73 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +71 -0
- data/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/get_metric_statistics.rb +1 -0
- data/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb +26 -0
- data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -2
- data/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
- data/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
- data/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
- data/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
- data/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
- data/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
- data/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
- data/lib/fog/aws/rds.rb +3 -1
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
- data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarm_history.rb +33 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +38 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb +39 -0
- data/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +84 -0
- data/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb +31 -0
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
- data/lib/fog/aws/requests/compute/create_snapshot.rb +2 -3
- data/lib/fog/aws/requests/compute/create_tags.rb +5 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +0 -1
- data/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
- data/lib/fog/aws/requests/compute/delete_tags.rb +3 -4
- data/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
- data/lib/fog/aws/requests/compute/describe_images.rb +6 -9
- data/lib/fog/aws/requests/compute/describe_instances.rb +17 -8
- data/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +7 -5
- data/lib/fog/aws/requests/compute/describe_volumes.rb +5 -4
- data/lib/fog/aws/requests/compute/modify_image_attribute.rb +32 -0
- data/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
- data/lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb +1 -1
- data/lib/fog/aws/requests/compute/register_image.rb +0 -1
- data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
- data/lib/fog/aws/requests/compute/run_instances.rb +1 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/create_load_balancer_listeners.rb +1 -1
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +2 -2
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
- data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +2 -2
- data/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
- data/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
- data/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
- data/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
- data/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
- data/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
- data/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
- data/lib/fog/aws/requests/iam/get_server_certificate.rb +5 -7
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/select.rb +1 -1
- data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
- data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/hash_to_acl.rb +35 -25
- data/lib/fog/aws/ses.rb +1 -1
- data/lib/fog/aws/simpledb.rb +2 -0
- data/lib/fog/aws/sns.rb +3 -1
- data/lib/fog/aws/sqs.rb +4 -2
- data/lib/fog/aws/storage.rb +12 -3
- data/lib/fog/bin.rb +1 -1
- data/lib/fog/bin/aws.rb +8 -4
- data/lib/fog/bin/bluebox.rb +2 -2
- data/lib/fog/bin/brightbox.rb +1 -1
- data/lib/fog/bin/dnsimple.rb +1 -1
- data/lib/fog/bin/dnsmadeeasy.rb +1 -1
- data/lib/fog/bin/ecloud.rb +1 -1
- data/lib/fog/bin/glesys.rb +1 -1
- data/lib/fog/bin/go_grid.rb +1 -1
- data/lib/fog/bin/google.rb +1 -1
- data/lib/fog/bin/libvirt.rb +1 -1
- data/lib/fog/bin/linode.rb +2 -2
- data/lib/fog/bin/local.rb +1 -1
- data/lib/fog/bin/new_servers.rb +1 -1
- data/lib/fog/bin/ninefold.rb +2 -2
- data/lib/fog/bin/openstack.rb +1 -1
- data/lib/fog/bin/rackspace.rb +3 -3
- data/lib/fog/bin/slicehost.rb +1 -1
- data/lib/fog/bin/stormondemand.rb +1 -1
- data/lib/fog/bin/virtual_box.rb +1 -1
- data/lib/fog/bin/vmfusion.rb +1 -1
- data/lib/fog/bin/voxel.rb +1 -1
- data/lib/fog/bin/zerigo.rb +1 -1
- data/lib/fog/brightbox/models/compute/account.rb +1 -1
- data/lib/fog/compute/models/server.rb +1 -2
- data/lib/fog/core/attributes.rb +5 -5
- data/lib/fog/core/connection.rb +1 -1
- data/lib/fog/core/deprecation.rb +2 -2
- data/lib/fog/core/logger.rb +8 -3
- data/lib/fog/core/mock.rb +4 -0
- data/lib/fog/core/provider.rb +7 -2
- data/lib/fog/core/service.rb +8 -2
- data/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
- data/lib/fog/dynect/dns.rb +25 -3
- data/lib/fog/ecloud/compute.rb +2 -6
- data/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +1 -1
- data/lib/fog/google/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/libvirt/models/compute/uri.rb +7 -3
- data/lib/fog/linode/models/compute/server.rb +10 -0
- data/lib/fog/ninefold/models/storage/file.rb +8 -6
- data/lib/fog/ninefold/models/storage/files.rb +3 -2
- data/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
- data/lib/fog/ninefold/storage.rb +4 -2
- data/lib/fog/openstack.rb +4 -3
- data/lib/fog/openstack/compute.rb +8 -5
- data/lib/fog/openstack/models/compute/server.rb +10 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +6 -8
- data/lib/fog/rackspace/load_balancers.rb +1 -0
- data/lib/fog/rackspace/models/dns/callback.rb +1 -1
- data/lib/fog/rackspace/models/dns/record.rb +1 -1
- data/lib/fog/rackspace/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/dns.rb +1 -0
- data/lib/fog/slicehost/models/dns/record.rb +7 -3
- data/lib/fog/slicehost/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
- data/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
- data/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
- data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
- data/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
- data/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
- data/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
- data/lib/fog/terremark/vcloud.rb +1 -1
- data/lib/fog/vsphere/compute.rb +40 -23
- data/lib/fog/vsphere/models/compute/server.rb +1 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +36 -4
- data/lib/fog/zerigo/dns.rb +14 -3
- data/lib/fog/zerigo/models/dns/record.rb +1 -1
- data/lib/fog/zerigo/models/dns/records.rb +5 -0
- data/lib/fog/zerigo/models/dns/zones.rb +2 -2
- data/lib/fog/zerigo/requests/dns/count_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/count_zones.rb +12 -1
- data/lib/fog/zerigo/requests/dns/create_host.rb +67 -1
- data/lib/fog/zerigo/requests/dns/create_zone.rb +44 -1
- data/lib/fog/zerigo/requests/dns/delete_host.rb +19 -0
- data/lib/fog/zerigo/requests/dns/delete_zone.rb +17 -0
- data/lib/fog/zerigo/requests/dns/find_hosts.rb +22 -1
- data/lib/fog/zerigo/requests/dns/get_host.rb +18 -1
- data/lib/fog/zerigo/requests/dns/get_zone.rb +19 -2
- data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +23 -0
- data/lib/fog/zerigo/requests/dns/list_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/list_zones.rb +15 -0
- data/lib/fog/zerigo/requests/dns/update_host.rb +20 -1
- data/lib/fog/zerigo/requests/dns/update_zone.rb +20 -1
- data/tests/aws/models/cloud_watch/alarm_data_tests.rb +42 -0
- data/tests/aws/models/cloud_watch/alarm_history_tests.rb +22 -0
- data/tests/aws/models/compute/security_group_tests.rb +15 -10
- data/tests/aws/models/elb/model_tests.rb +4 -4
- data/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
- data/tests/aws/requests/cloud_watch/list_metrics_test.rb +5 -5
- data/tests/aws/requests/compute/image_tests.rb +33 -2
- data/tests/aws/requests/compute/instance_tests.rb +16 -1
- data/tests/aws/requests/compute/security_group_tests.rb +251 -32
- data/tests/aws/requests/compute/tag_tests.rb +42 -2
- data/tests/aws/requests/emr/helper.rb +172 -0
- data/tests/aws/requests/emr/instance_group_tests.rb +106 -0
- data/tests/aws/requests/emr/job_flow_tests.rb +88 -0
- data/tests/aws/requests/iam/server_certificate_tests.rb +20 -7
- data/tests/aws/requests/storage/bucket_tests.rb +82 -54
- data/tests/aws/requests/storage/hash_to_acl_tests.rb +173 -0
- data/tests/aws/requests/storage/object_tests.rb +44 -24
- data/tests/brightbox/requests/compute/helper.rb +15 -6
- data/tests/core/attribute_tests.rb +29 -0
- data/tests/core/mocking_tests.rb +60 -0
- data/tests/dns/models/record_tests.rb +4 -2
- data/tests/dns/models/records_tests.rb +4 -2
- data/tests/dns/models/zone_tests.rb +3 -1
- data/tests/dns/models/zones_tests.rb +4 -2
- data/tests/helper.rb +4 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +16 -12
- data/tests/rackspace/requests/dns/records_tests.rb +13 -11
- data/tests/slicehost/requests/dns/dns_tests.rb +58 -11
- data/tests/vsphere/compute_tests.rb +18 -10
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +1 -1
- metadata +214 -221
data/lib/fog/aws/elb.rb
CHANGED
|
@@ -64,7 +64,7 @@ module Fog
|
|
|
64
64
|
|
|
65
65
|
@region = options[:region] || 'us-east-1'
|
|
66
66
|
|
|
67
|
-
unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1'].include?(@region)
|
|
67
|
+
unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
|
|
68
68
|
raise ArgumentError, "Unknown region: #{@region.inspect}"
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -94,7 +94,7 @@ module Fog
|
|
|
94
94
|
#
|
|
95
95
|
# ==== Parameters
|
|
96
96
|
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
|
97
|
-
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'ap-northeast-1', 'ap-southeast-1']
|
|
97
|
+
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-southeast-1']
|
|
98
98
|
#
|
|
99
99
|
# ==== Returns
|
|
100
100
|
# * ELB object with connection to AWS.
|
|
@@ -118,6 +118,8 @@ module Fog
|
|
|
118
118
|
'elasticloadbalancing.us-east-1.amazonaws.com'
|
|
119
119
|
when 'us-west-1'
|
|
120
120
|
'elasticloadbalancing.us-west-1.amazonaws.com'
|
|
121
|
+
when 'us-west-2'
|
|
122
|
+
'elasticloadbalancing.us-west-2.amazonaws.com'
|
|
121
123
|
else
|
|
122
124
|
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
|
|
123
125
|
end
|
data/lib/fog/aws/emr.rb
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'aws'))
|
|
2
|
+
|
|
3
|
+
module Fog
|
|
4
|
+
module AWS
|
|
5
|
+
class EMR < Fog::Service
|
|
6
|
+
|
|
7
|
+
class IdentifierTaken < Fog::Errors::Error; end
|
|
8
|
+
|
|
9
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
|
10
|
+
recognizes :region, :host, :path, :port, :scheme, :persistent
|
|
11
|
+
|
|
12
|
+
request_path 'fog/aws/requests/emr'
|
|
13
|
+
|
|
14
|
+
request :add_instance_groups
|
|
15
|
+
request :add_job_flow_steps
|
|
16
|
+
request :describe_job_flows
|
|
17
|
+
request :modify_instance_groups
|
|
18
|
+
request :run_job_flow
|
|
19
|
+
request :set_termination_protection
|
|
20
|
+
request :terminate_job_flows
|
|
21
|
+
|
|
22
|
+
# model_path 'fog/aws/models/rds'
|
|
23
|
+
# model :server
|
|
24
|
+
# collection :servers
|
|
25
|
+
# model :snapshot
|
|
26
|
+
# collection :snapshots
|
|
27
|
+
# model :parameter_group
|
|
28
|
+
# collection :parameter_groups
|
|
29
|
+
#
|
|
30
|
+
# model :parameter
|
|
31
|
+
# collection :parameters
|
|
32
|
+
#
|
|
33
|
+
# model :security_group
|
|
34
|
+
# collection :security_groups
|
|
35
|
+
|
|
36
|
+
class Mock
|
|
37
|
+
|
|
38
|
+
def initialize(options={})
|
|
39
|
+
Fog::Mock.not_implemented
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class Real
|
|
45
|
+
|
|
46
|
+
# Initialize connection to EMR
|
|
47
|
+
#
|
|
48
|
+
# ==== Notes
|
|
49
|
+
# options parameter must include values for :aws_access_key_id and
|
|
50
|
+
# :aws_secret_access_key in order to create a connection
|
|
51
|
+
#
|
|
52
|
+
# ==== Examples
|
|
53
|
+
# emr = EMR.new(
|
|
54
|
+
# :aws_access_key_id => your_aws_access_key_id,
|
|
55
|
+
# :aws_secret_access_key => your_aws_secret_access_key
|
|
56
|
+
# )
|
|
57
|
+
#
|
|
58
|
+
# ==== Parameters
|
|
59
|
+
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
|
60
|
+
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'ap-southeast-1']
|
|
61
|
+
#
|
|
62
|
+
# ==== Returns
|
|
63
|
+
# * EMR object with connection to AWS.
|
|
64
|
+
def initialize(options={})
|
|
65
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
|
66
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
|
67
|
+
@connection_options = options[:connection_options] || {}
|
|
68
|
+
@hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
|
|
69
|
+
|
|
70
|
+
options[:region] ||= 'us-east-1'
|
|
71
|
+
@host = options[:host] || 'elasticmapreduce.amazonaws.com'
|
|
72
|
+
@path = options[:path] || '/'
|
|
73
|
+
@persistent = options[:persistent] || false
|
|
74
|
+
@port = options[:port] || 443
|
|
75
|
+
@scheme = options[:scheme] || 'https'
|
|
76
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def reload
|
|
80
|
+
@connection.reset
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
def request(params)
|
|
86
|
+
idempotent = params.delete(:idempotent)
|
|
87
|
+
parser = params.delete(:parser)
|
|
88
|
+
|
|
89
|
+
body = Fog::AWS.signed_params(
|
|
90
|
+
params,
|
|
91
|
+
{
|
|
92
|
+
:aws_access_key_id => @aws_access_key_id,
|
|
93
|
+
:hmac => @hmac,
|
|
94
|
+
:host => @host,
|
|
95
|
+
:path => @path,
|
|
96
|
+
:port => @port,
|
|
97
|
+
:version => '2009-03-31' #'2010-07-28'
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
begin
|
|
102
|
+
response = @connection.request({
|
|
103
|
+
:body => body,
|
|
104
|
+
:expects => 200,
|
|
105
|
+
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
|
106
|
+
:idempotent => idempotent,
|
|
107
|
+
:host => @host,
|
|
108
|
+
:method => 'POST',
|
|
109
|
+
:parser => parser
|
|
110
|
+
})
|
|
111
|
+
rescue Excon::Errors::HTTPStatusError => error
|
|
112
|
+
if match = error.message.match(/<Code>(.*)<\/Code>[\s\\\w]+<Message>(.*)<\/Message>/m)
|
|
113
|
+
# case match[1].split('.').last
|
|
114
|
+
# when 'DBInstanceNotFound', 'DBParameterGroupNotFound', 'DBSnapshotNotFound', 'DBSecurityGroupNotFound'
|
|
115
|
+
# raise Fog::AWS::RDS::NotFound.slurp(error, match[2])
|
|
116
|
+
# when 'DBParameterGroupAlreadyExists'
|
|
117
|
+
# raise Fog::AWS::RDS::IdentifierTaken.slurp(error, match[2])
|
|
118
|
+
# else
|
|
119
|
+
# raise
|
|
120
|
+
# end
|
|
121
|
+
raise
|
|
122
|
+
else
|
|
123
|
+
raise
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
response
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'fog/core/collection'
|
|
2
|
+
require 'fog/aws/models/cloud_watch/alarm_datum'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module AWS
|
|
6
|
+
class CloudWatch
|
|
7
|
+
class AlarmData < Fog::Collection
|
|
8
|
+
model Fog::AWS::CloudWatch::AlarmDatum
|
|
9
|
+
|
|
10
|
+
def all(conditions={})
|
|
11
|
+
data = connection.describe_alarms(conditions).body['DescribeAlarmsResult']['MetricAlarms']
|
|
12
|
+
load(data) # data is an array of attribute hashes
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def get(namespace, metric_name, dimensions=nil, period=nil, statistic=nil, unit=nil)
|
|
16
|
+
list_opts = {'Namespace' => namespace, 'MetricName' => metric_name}
|
|
17
|
+
if dimensions
|
|
18
|
+
dimensions_array = dimensions.collect do |name, value|
|
|
19
|
+
{'Name' => name, 'Value' => value}
|
|
20
|
+
end
|
|
21
|
+
list_opts.merge!('Dimensions' => dimensions_array)
|
|
22
|
+
end
|
|
23
|
+
if period
|
|
24
|
+
list_opts.merge!('Period' => period)
|
|
25
|
+
end
|
|
26
|
+
if statistic
|
|
27
|
+
list_opts.merge!('Statistic' => statistic)
|
|
28
|
+
end
|
|
29
|
+
if unit
|
|
30
|
+
list_opts.merge!('Unit' => unit)
|
|
31
|
+
end
|
|
32
|
+
data = connection.describe_alarms_for_metric(list_opts).body['DescribeAlarmsForMetricResult']['MetricAlarms']
|
|
33
|
+
load(data)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'fog/core/model'
|
|
2
|
+
|
|
3
|
+
module Fog
|
|
4
|
+
module AWS
|
|
5
|
+
class CloudWatch
|
|
6
|
+
|
|
7
|
+
class AlarmDatum < Fog::Model
|
|
8
|
+
attribute :alarm_name, :aliases => 'AlarmName'
|
|
9
|
+
attribute :metric_name, :aliases => 'MetricName'
|
|
10
|
+
attribute :namespace, :aliases => 'Namespace'
|
|
11
|
+
attribute :dimensions, :aliases => 'Dimensions'
|
|
12
|
+
attribute :alarm_description, :aliases => 'AlarmDescription'
|
|
13
|
+
attribute :alarm_arn, :aliases => 'AlarmArn'
|
|
14
|
+
attribute :state_value, :aliases => 'StateValue'
|
|
15
|
+
attribute :statistic, :aliases => 'Statistic'
|
|
16
|
+
attribute :comparison_operator, :aliases => 'ComparisonOperator'
|
|
17
|
+
attribute :state_reason, :aliases => 'StateReason'
|
|
18
|
+
attribute :action_enabled, :aliases => 'ActionsEnabled'
|
|
19
|
+
attribute :period, :aliases => 'Period'
|
|
20
|
+
attribute :evaluation_periods, :aliases => 'EvaluationPeriods'
|
|
21
|
+
attribute :threshold, :aliases => 'Threshold'
|
|
22
|
+
attribute :alarm_actions, :aliases => 'AlarmActions'
|
|
23
|
+
attribute :ok_actions, :aliases => 'OKActions'
|
|
24
|
+
attribute :insufficient_actions, :aliases => 'InsufficientDataActions'
|
|
25
|
+
attribute :unit, :aliases => 'Unit'
|
|
26
|
+
attribute :state_updated_timestamp, :aliases => 'StateUpdatedTimestamp'
|
|
27
|
+
attribute :alarm_configuration_updated_timestamp, :aliases => 'AlarmConfigurationUpdatedTimestamp'
|
|
28
|
+
|
|
29
|
+
def save
|
|
30
|
+
requires :alarm_name
|
|
31
|
+
requires :comparison_operator
|
|
32
|
+
requires :evaluation_periods
|
|
33
|
+
requires :metric_name
|
|
34
|
+
requires :namespace
|
|
35
|
+
requires :period
|
|
36
|
+
requires :statistic
|
|
37
|
+
requires :threshold
|
|
38
|
+
|
|
39
|
+
alarm_definition = {
|
|
40
|
+
'AlarmName' => alarm_name,
|
|
41
|
+
'ComparisonOperator' => comparison_operator,
|
|
42
|
+
'EvaluationPeriods' => evaluation_periods,
|
|
43
|
+
'MetricName' => metric_name,
|
|
44
|
+
'Namespace' => namespace,
|
|
45
|
+
'Period' => period,
|
|
46
|
+
'Statistic' => statistic,
|
|
47
|
+
'Threshold' => threshold
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
alarm_definition.merge!('ActionsEnabled' => action_enabled) if action_enabled
|
|
51
|
+
alarm_definition.merge!('AlarmActions' => alarm_actions) if alarm_actions
|
|
52
|
+
alarm_definition.merge!('AlarmDescription' => alarm_description) if alarm_description
|
|
53
|
+
|
|
54
|
+
#dimension is an array of Name/Value pairs, ex. [{'Name'=>'host', 'Value'=>'localhost'},{'Name'=>'version', 'Value'=>'0.11.0'}]
|
|
55
|
+
alarm_definition.merge!('Dimensions' => dimensions) if dimensions
|
|
56
|
+
alarm_definition.merge!('InsufficientDataActions' => insufficient_actions) if insufficient_actions
|
|
57
|
+
alarm_definition.merge!('OKActions' => ok_actions) if ok_actions
|
|
58
|
+
alarm_definition.merge!('Unit' => unit) if unit
|
|
59
|
+
|
|
60
|
+
connection.put_metric_alarm(alarm_definition)
|
|
61
|
+
true
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'fog/core/collection'
|
|
2
|
+
require 'fog/aws/models/cloud_watch/alarm_history'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module AWS
|
|
6
|
+
class CloudWatch
|
|
7
|
+
class AlarmHistories < Fog::Collection
|
|
8
|
+
model Fog::AWS::CloudWatch::AlarmHistory
|
|
9
|
+
|
|
10
|
+
def all(conditions={})
|
|
11
|
+
data = connection.describe_alarm_history(conditions).body['DescribeAlarmHistoryResult']['AlarmHistoryItems']
|
|
12
|
+
load(data) # data is an array of attribute hashes
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'fog/core/model'
|
|
2
|
+
|
|
3
|
+
module Fog
|
|
4
|
+
module AWS
|
|
5
|
+
class CloudWatch
|
|
6
|
+
|
|
7
|
+
class AlarmHistory < Fog::Model
|
|
8
|
+
attribute :alarm_name, :aliases => 'AlarmName'
|
|
9
|
+
attribute :end_date, :aliases => 'EndDate'
|
|
10
|
+
attribute :history_item_type, :aliases => 'HistoryItemType'
|
|
11
|
+
attribute :max_records, :aliases => 'MaxRecords'
|
|
12
|
+
attribute :start_date, :aliases => 'StartDate'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fog/core/collection'
|
|
2
|
+
require 'fog/aws/models/cloud_watch/alarm'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module AWS
|
|
6
|
+
class CloudWatch
|
|
7
|
+
|
|
8
|
+
class Alarms < Fog::Collection
|
|
9
|
+
model Fog::AWS::CloudWatch::Alarm
|
|
10
|
+
|
|
11
|
+
#alarm_names is an array of alarm names
|
|
12
|
+
def delete(alarm_names)
|
|
13
|
+
connection.delete_alarms(alarm_names)
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def disable(alarm_names)
|
|
18
|
+
connection.disable_alarm_actions(alarm_names)
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def enable(alarm_names)
|
|
23
|
+
connection.enable_alarm_actions(alarm_names)
|
|
24
|
+
true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -56,7 +56,7 @@ module Fog
|
|
|
56
56
|
|
|
57
57
|
def all(filters = filters)
|
|
58
58
|
unless filters.is_a?(Hash)
|
|
59
|
-
Fog::Logger.
|
|
59
|
+
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('public-ip' => []) instead [light_black](#{caller.first})[/]")
|
|
60
60
|
filters = {'public-ip' => [*filters]}
|
|
61
61
|
end
|
|
62
62
|
self.filters = filters
|
|
@@ -51,7 +51,7 @@ module Fog
|
|
|
51
51
|
|
|
52
52
|
def all(filters = filters)
|
|
53
53
|
unless filters.is_a?(Hash)
|
|
54
|
-
Fog::Logger.
|
|
54
|
+
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('key-name' => []) instead [light_black](#{caller.first})[/]")
|
|
55
55
|
filters = {'key-name' => [*filters]}
|
|
56
56
|
end
|
|
57
57
|
self.filters = filters
|
|
@@ -57,7 +57,7 @@ module Fog
|
|
|
57
57
|
|
|
58
58
|
def all(filters = filters)
|
|
59
59
|
unless filters.is_a?(Hash)
|
|
60
|
-
Fog::Logger.
|
|
60
|
+
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('group-name' => []) instead [light_black](#{caller.first})[/]")
|
|
61
61
|
filters = {'group-name' => [*filters]}
|
|
62
62
|
end
|
|
63
63
|
self.filters = filters
|
|
@@ -169,8 +169,10 @@ module Fog
|
|
|
169
169
|
data = connection.run_instances(image_id, 1, 1, options)
|
|
170
170
|
merge_attributes(data.body['instancesSet'].first)
|
|
171
171
|
|
|
172
|
-
if self.tags
|
|
173
|
-
|
|
172
|
+
if tags = self.tags
|
|
173
|
+
# expect eventual consistency
|
|
174
|
+
Fog.wait_for { self.reload rescue nil }
|
|
175
|
+
for key, value in (self.tags = tags)
|
|
174
176
|
connection.tags.create(
|
|
175
177
|
:key => key,
|
|
176
178
|
:resource_id => self.identity,
|
|
@@ -57,7 +57,7 @@ module Fog
|
|
|
57
57
|
|
|
58
58
|
def all(filters = self.filters)
|
|
59
59
|
unless filters.is_a?(Hash)
|
|
60
|
-
Fog::Logger.
|
|
60
|
+
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('instance-id' => []) instead [light_black](#{caller.first})[/]")
|
|
61
61
|
filters = {'instance-id' => [*filters]}
|
|
62
62
|
end
|
|
63
63
|
self.filters = filters
|
|
@@ -19,7 +19,7 @@ module Fog
|
|
|
19
19
|
|
|
20
20
|
def all(filters = filters, options = {})
|
|
21
21
|
unless filters.is_a?(Hash)
|
|
22
|
-
Fog::Logger.
|
|
22
|
+
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
|
|
23
23
|
filters = {'snapshot-id' => [*filters]}
|
|
24
24
|
end
|
|
25
25
|
self.filters = filters
|
|
@@ -55,6 +55,27 @@ module Fog
|
|
|
55
55
|
super
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
def destroy
|
|
59
|
+
requires :id
|
|
60
|
+
|
|
61
|
+
connection.cancel_spot_instance_requests(id)
|
|
62
|
+
true
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def key_pair
|
|
66
|
+
requires :key_name
|
|
67
|
+
|
|
68
|
+
connection.key_pairs.all(key_name).first
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def key_pair=(new_keypair)
|
|
72
|
+
self.key_name = new_keypair && new_keypair.name
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def ready?
|
|
76
|
+
state == 'active'
|
|
77
|
+
end
|
|
78
|
+
|
|
58
79
|
def save
|
|
59
80
|
requires :image_id, :flavor_id, :price
|
|
60
81
|
|
|
@@ -83,10 +104,6 @@ module Fog
|
|
|
83
104
|
merge_attributes( spot_instance_request )
|
|
84
105
|
end
|
|
85
106
|
|
|
86
|
-
def ready?
|
|
87
|
-
state == 'active'
|
|
88
|
-
end
|
|
89
|
-
|
|
90
107
|
end
|
|
91
108
|
end
|
|
92
109
|
end
|