fog 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -17,7 +17,7 @@ module Fog
|
|
17
17
|
|
18
18
|
def all(filters = self.filters)
|
19
19
|
unless filters.is_a?(Hash)
|
20
|
-
Fog::Logger.
|
20
|
+
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead [light_black](#{caller.first})[/]")
|
21
21
|
filters = {'spot-instance-request-id' => [*filters]}
|
22
22
|
end
|
23
23
|
self.filters = filters
|
@@ -34,6 +34,50 @@ module Fog
|
|
34
34
|
)
|
35
35
|
end
|
36
36
|
|
37
|
+
def bootstrap(new_attributes = {})
|
38
|
+
spot_request = connection.spot_requests.new(new_attributes)
|
39
|
+
|
40
|
+
unless new_attributes[:key_name]
|
41
|
+
# first or create fog_#{credential} keypair
|
42
|
+
name = Fog.respond_to?(:credential) && Fog.credential || :default
|
43
|
+
unless spot_request.key_pair = connection.key_pairs.get("fog_#{name}")
|
44
|
+
spot_request.key_pair = connection.key_pairs.create(
|
45
|
+
:name => "fog_#{name}",
|
46
|
+
:public_key => server.public_key
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# make sure port 22 is open in the first security group
|
52
|
+
security_group = connection.security_groups.get(spot_request.groups.first)
|
53
|
+
authorized = security_group.ip_permissions.detect do |ip_permission|
|
54
|
+
ip_permission['ipRanges'].first && ip_permission['ipRanges'].first['cidrIp'] == '0.0.0.0/0' &&
|
55
|
+
ip_permission['fromPort'] == 22 &&
|
56
|
+
ip_permission['ipProtocol'] == 'tcp' &&
|
57
|
+
ip_permission['toPort'] == 22
|
58
|
+
end
|
59
|
+
unless authorized
|
60
|
+
security_group.authorize_port_range(22..22)
|
61
|
+
end
|
62
|
+
|
63
|
+
spot_request.save
|
64
|
+
spot_request.wait_for { ready? }
|
65
|
+
Fog.wait_for { server = connection.servers.get(spot_request.instance_id) }
|
66
|
+
server = connection.servers.get(spot_request.instance_id)
|
67
|
+
if spot_request.tags
|
68
|
+
for key, value in spot_request.tags
|
69
|
+
connection.tags.create(
|
70
|
+
:key => key,
|
71
|
+
:resource_id => spot_request.instance_id,
|
72
|
+
:value => value
|
73
|
+
)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
server.wait_for { ready? }
|
77
|
+
server.setup(:key_data => [server.private_key])
|
78
|
+
server
|
79
|
+
end
|
80
|
+
|
37
81
|
def get(spot_request_id)
|
38
82
|
if spot_request_id
|
39
83
|
self.class.new(:connection => connection).all('spot-instance-request-id' => spot_request_id).first
|
@@ -64,7 +64,7 @@ module Fog
|
|
64
64
|
|
65
65
|
def all(filters = filters)
|
66
66
|
unless filters.is_a?(Hash)
|
67
|
-
Fog::Logger.
|
67
|
+
Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('volume-id' => []) instead [light_black](#{caller.first})[/]")
|
68
68
|
filters = {'volume-id' => [*filters]}
|
69
69
|
end
|
70
70
|
self.filters = filters
|
@@ -12,6 +12,8 @@ module Fog
|
|
12
12
|
attribute :health_check, :aliases => 'HealthCheck'
|
13
13
|
attribute :instances, :aliases => 'Instances'
|
14
14
|
attribute :source_group, :aliases => 'SourceSecurityGroup'
|
15
|
+
attribute :hosted_zone_name, :aliases => 'CanonicalHostedZoneName'
|
16
|
+
attribute :hosted_zone_name_id, :aliases => 'CanonicalHostedZoneNameID'
|
15
17
|
|
16
18
|
def initialize(attributes={})
|
17
19
|
attributes[:availability_zones] ||= attributes['AvailabilityZones'] || %w(us-east-1a us-east-1b us-east-1c us-east-1d)
|
@@ -104,7 +104,7 @@ module Fog
|
|
104
104
|
def save(options = {})
|
105
105
|
requires :body, :directory, :key
|
106
106
|
if options != {}
|
107
|
-
Fog::Logger.
|
107
|
+
Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
|
108
108
|
end
|
109
109
|
options['x-amz-acl'] ||= @acl if @acl
|
110
110
|
options['Cache-Control'] = cache_control if cache_control
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudFormation
|
5
|
+
|
6
|
+
class UpdateStack < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def end_element(name)
|
9
|
+
case name
|
10
|
+
when 'RequestId', 'StackId'
|
11
|
+
@response[name] = value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class DeleteAlarms < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'ResponseMetadata' => {} }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attrs = [])
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def end_element(name)
|
17
|
+
case name
|
18
|
+
when 'RequestId'
|
19
|
+
@response['ResponseMetadata'][name] = @value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class DescribeAlarmHistory < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'DescribeAlarmHistoryResult' => {'AlarmHistoryItems' => []}, 'ResponseMetadata' => {} }
|
10
|
+
reset_alarm_history_item
|
11
|
+
end
|
12
|
+
|
13
|
+
def reset_alarm_history_item
|
14
|
+
@alarm_history_item = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def start_element(name, attrs = [])
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def end_element(name)
|
22
|
+
case name
|
23
|
+
when 'AlarmName', 'HistoryItemType', 'HistorySummary'
|
24
|
+
@alarm_history_item[name] = value
|
25
|
+
when 'Timestamp'
|
26
|
+
@alarm_history_item[name] = Time.parse value
|
27
|
+
when 'RequestId'
|
28
|
+
@response['ResponseMetadata'][name] = value
|
29
|
+
when 'NextToken'
|
30
|
+
@response['ResponseMetadata'][name] = value
|
31
|
+
when 'member'
|
32
|
+
@response['DescribeAlarmHistoryResult']['AlarmHistoryItems'] << @alarm_history_item
|
33
|
+
reset_alarm_history_item
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class DescribeAlarms < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'DescribeAlarmsResult' => {'MetricAlarms' => []}, 'ResponseMetadata' => {} }
|
10
|
+
reset_metric_alarms
|
11
|
+
end
|
12
|
+
|
13
|
+
def reset_metric_alarms
|
14
|
+
@metric_alarms = {'Dimensions' => []}
|
15
|
+
end
|
16
|
+
|
17
|
+
def reset_dimension
|
18
|
+
@dimension = {}
|
19
|
+
end
|
20
|
+
|
21
|
+
def start_element(name, attrs = [])
|
22
|
+
super
|
23
|
+
case name
|
24
|
+
when 'Dimensions'
|
25
|
+
@in_dimensions = true
|
26
|
+
when 'member'
|
27
|
+
if @in_dimensions
|
28
|
+
reset_dimension
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def end_element(name)
|
34
|
+
case name
|
35
|
+
when 'Name', 'Value'
|
36
|
+
@dimension[name] = value
|
37
|
+
when 'AlarmConfigurationUpdatedTimestamp', 'StateUpdatedTimestamp'
|
38
|
+
@metric_alarms[name] = Time.parse value
|
39
|
+
when 'Period', 'EvaluationPeriods'
|
40
|
+
@metric_alarms[name] = value.to_i
|
41
|
+
when 'Threshold'
|
42
|
+
@metric_alarms[name] = value.to_f
|
43
|
+
when 'AlarmActions', 'OKActions', 'InsufficientDataActions'
|
44
|
+
@metric_alarms[name] = value.to_s.strip
|
45
|
+
when 'AlarmName', 'Namespace', 'MetricName', 'AlarmDescription', 'AlarmArn', 'Unit',
|
46
|
+
'StateValue', 'Statistic', 'ComparisonOperator', 'StateReason', 'ActionsEnabled'
|
47
|
+
@metric_alarms[name] = value
|
48
|
+
when 'StateUpdatedTimestamp', 'AlarmConfigurationUpdatedTimestamp'
|
49
|
+
@metric_alarms[name] = Time.parse value
|
50
|
+
when 'Dimensions'
|
51
|
+
@in_dimensions = false
|
52
|
+
when 'RequestId'
|
53
|
+
@response['ResponseMetadata'][name] = value
|
54
|
+
when 'NextToken'
|
55
|
+
@response['ResponseMetadata'][name] = value
|
56
|
+
when 'member'
|
57
|
+
if !@in_dimensions
|
58
|
+
if @metric_alarms.has_key?('AlarmName')
|
59
|
+
@response['DescribeAlarmsResult']['MetricAlarms'] << @metric_alarms
|
60
|
+
reset_metric_alarms
|
61
|
+
elsif @response['DescribeAlarmsResult']['MetricAlarms'].last != nil
|
62
|
+
@response['DescribeAlarmsResult']['MetricAlarms'].last.merge!( @metric_alarms)
|
63
|
+
end
|
64
|
+
else
|
65
|
+
@metric_alarms['Dimensions'] << @dimension
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class DescribeAlarmsForMetric < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'DescribeAlarmsForMetricResult' => {'MetricAlarms' => []}, 'ResponseMetadata' => {} }
|
10
|
+
reset_metric_alarms
|
11
|
+
end
|
12
|
+
|
13
|
+
def reset_metric_alarms
|
14
|
+
@metric_alarms = {'Dimensions' => []}
|
15
|
+
end
|
16
|
+
|
17
|
+
def reset_dimension
|
18
|
+
@dimension = {}
|
19
|
+
end
|
20
|
+
|
21
|
+
def start_element(name, attrs = [])
|
22
|
+
super
|
23
|
+
case name
|
24
|
+
when 'Dimensions'
|
25
|
+
@in_dimensions = true
|
26
|
+
when 'member'
|
27
|
+
if @in_dimensions
|
28
|
+
reset_dimension
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def end_element(name)
|
34
|
+
case name
|
35
|
+
when 'Name', 'Value'
|
36
|
+
@dimension[name] = value
|
37
|
+
when 'Period', 'EvaluationPeriods'
|
38
|
+
@metric_alarms[name] = value.to_i
|
39
|
+
when 'Threshold'
|
40
|
+
@metric_alarms[name] = value.to_f
|
41
|
+
when 'AlarmActions', 'OKActions', 'InsufficientDataActions'
|
42
|
+
@metric_alarms[name] = value.to_s.strip
|
43
|
+
when 'AlarmName', 'Namespace', 'MetricName', 'AlarmDescription', 'AlarmArn', 'Unit',
|
44
|
+
'StateValue', 'Statistic', 'ComparisonOperator', 'StateReason', 'ActionsEnabled'
|
45
|
+
@metric_alarms[name] = value
|
46
|
+
when 'StateUpdatedTimestamp', 'AlarmConfigurationUpdatedTimestamp'
|
47
|
+
@metric_alarms[name] = Time.parse value
|
48
|
+
when 'Dimensions'
|
49
|
+
@in_dimensions = false
|
50
|
+
when 'NextToken'
|
51
|
+
@response['ResponseMetadata'][name] = value
|
52
|
+
when 'RequestId'
|
53
|
+
@response['ResponseMetadata'][name] = value
|
54
|
+
when 'member'
|
55
|
+
if !@in_dimensions
|
56
|
+
if @metric_alarms.has_key?('AlarmName')
|
57
|
+
@response['DescribeAlarmsForMetricResult']['MetricAlarms'] << @metric_alarms
|
58
|
+
reset_metric_alarms
|
59
|
+
elsif @response['DescribeAlarmsForMetricResult']['MetricAlarms'].last != nil
|
60
|
+
@response['DescribeAlarmsForMetricResult']['MetricAlarms'].last.merge!( @metric_alarms)
|
61
|
+
end
|
62
|
+
else
|
63
|
+
@metric_alarms['Dimensions'] << @dimension
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class DisableAlarmActions < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'ResponseMetadata' => {} }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attrs = [])
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def end_element(name)
|
17
|
+
case name
|
18
|
+
when 'RequestId'
|
19
|
+
@response['ResponseMetadata'][name] = value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class EnableAlarmActions < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'ResponseMetadata' => {} }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attrs = [])
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def end_element(name)
|
17
|
+
case name
|
18
|
+
when 'RequestId'
|
19
|
+
@response['ResponseMetadata'][name] = value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class PutMetricAlarm < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'ResponseMetadata' => {} }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attrs = [])
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def end_element(name)
|
17
|
+
case name
|
18
|
+
when 'RequestId'
|
19
|
+
@response['ResponseMetadata'][name] = value.strip
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module CloudWatch
|
5
|
+
|
6
|
+
class SetAlarmState < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'ResponseMetadata' => {} }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attrs = [])
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def end_element(name)
|
17
|
+
case name
|
18
|
+
when 'RequestId'
|
19
|
+
@response['ResponseMetadata'][name] = value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|