fog-openstack 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Rakefile +25 -15
- data/{lib/fog/openstack/docs → docs}/compute.md +0 -0
- data/{lib/fog/openstack/docs → docs}/getting_started.md +0 -0
- data/{lib/fog/openstack/docs → docs}/introspection.md +0 -0
- data/{lib/fog/openstack/docs → docs}/metering.md +0 -0
- data/{lib/fog/openstack/docs → docs}/network.md +0 -0
- data/{lib/fog/openstack/docs → docs}/nfv.md +0 -0
- data/{lib/fog/openstack/docs → docs}/orchestration.md +0 -0
- data/{lib/fog/openstack/docs → docs}/planning.md +0 -0
- data/{lib/fog/openstack/docs → docs}/storage.md +0 -0
- data/{lib/fog/openstack/examples → examples}/compute/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/compute/block_device_mapping_v2.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/identity/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/image/upload-test-image.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/introspection/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/network/network_add_port.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/network/network_rbac.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/network/network_subnets_routers.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/planning/basics.rb +0 -0
- data/{lib/fog/openstack/examples → examples}/storage/set-account-quota.rb +0 -0
- data/fog-openstack.gemspec +1 -1
- data/lib/fog/openstack.rb +6 -0
- data/lib/fog/openstack/models/compute/aggregate.rb +3 -2
- data/lib/fog/openstack/models/monitoring/alarm.rb +48 -0
- data/lib/fog/openstack/models/monitoring/alarm_count.rb +17 -0
- data/lib/fog/openstack/models/monitoring/alarm_counts.rb +16 -0
- data/lib/fog/openstack/models/monitoring/alarm_definition.rb +56 -0
- data/lib/fog/openstack/models/monitoring/alarm_definitions.rb +42 -0
- data/lib/fog/openstack/models/monitoring/alarm_state.rb +32 -0
- data/lib/fog/openstack/models/monitoring/alarm_states.rb +20 -0
- data/lib/fog/openstack/models/monitoring/alarms.rb +30 -0
- data/lib/fog/openstack/models/monitoring/measurement.rb +20 -0
- data/lib/fog/openstack/models/monitoring/measurements.rb +16 -0
- data/lib/fog/openstack/models/monitoring/metric.rb +27 -0
- data/lib/fog/openstack/models/monitoring/metrics.rb +28 -0
- data/lib/fog/openstack/models/monitoring/notification_method.rb +40 -0
- data/lib/fog/openstack/models/monitoring/notification_methods.rb +38 -0
- data/lib/fog/openstack/models/monitoring/statistic.rb +20 -0
- data/lib/fog/openstack/models/monitoring/statistics.rb +16 -0
- data/lib/fog/openstack/monitoring.rb +116 -0
- data/lib/fog/openstack/requests/compute/attach_volume.rb +1 -0
- data/lib/fog/openstack/requests/compute/create_aggregate.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +2 -2
- data/lib/fog/openstack/requests/compute/detach_volume.rb +1 -0
- data/lib/fog/openstack/requests/compute/update_aggregate.rb +1 -1
- data/lib/fog/openstack/requests/monitoring/create_alarm_definition.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/create_metric.rb +29 -0
- data/lib/fog/openstack/requests/monitoring/create_metric_array.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/create_notification_method.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/delete_alarm.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/delete_alarm_definition.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/delete_notification_method.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/find_measurements.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/get_alarm.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/get_alarm_counts.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/get_alarm_definition.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/get_notification_method.rb +18 -0
- data/lib/fog/openstack/requests/monitoring/list_alarm_definitions.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_alarm_state_history_for_all_alarms.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_alarm_state_history_for_specific_alarm.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_alarms.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_metric_names.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_metrics.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_notification_methods.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/list_statistics.rb +22 -0
- data/lib/fog/openstack/requests/monitoring/patch_alarm.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/patch_alarm_definition.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/update_alarm.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/update_alarm_definition.rb +19 -0
- data/lib/fog/openstack/requests/monitoring/update_notification_method.rb +19 -0
- data/lib/fog/openstack/version.rb +1 -1
- metadata +65 -42
- data/tests/openstack/models/identity/ec2_credential_tests.rb +0 -41
- data/tests/openstack/models/identity/ec2_credentials_tests.rb +0 -58
- data/tests/openstack/models/identity/role_tests.rb +0 -31
- data/tests/openstack/models/identity/roles_tests.rb +0 -21
- data/tests/openstack/models/identity/tenant_tests.rb +0 -33
- data/tests/openstack/models/identity/tenants_tests.rb +0 -31
- data/tests/openstack/models/identity/user_tests.rb +0 -47
- data/tests/openstack/models/identity/users_tests.rb +0 -46
- data/tests/openstack/requests/baremetal/chassis_tests.rb +0 -48
- data/tests/openstack/requests/baremetal/driver_tests.rb +0 -40
- data/tests/openstack/requests/baremetal/node_tests.rb +0 -83
- data/tests/openstack/requests/baremetal/port_tests.rb +0 -56
- data/tests/openstack/requests/identity/ec2_credentials_tests.rb +0 -41
- data/tests/openstack/requests/identity/helper.rb +0 -21
- data/tests/openstack/requests/identity/role_tests.rb +0 -48
- data/tests/openstack/requests/identity/tenant_tests.rb +0 -57
- data/tests/openstack/requests/identity/user_tests.rb +0 -46
- data/tests/openstack/requests/introspection/introspection_tests.rb +0 -297
- data/tests/openstack/requests/introspection/rules_tests.rb +0 -46
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31a9071364facb7a54109c5a95e7c9b712c6f78a
|
|
4
|
+
data.tar.gz: 81f2374694077b420e017aad70ad1c52268c01ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c2f0405c2e7356ebd64426c7e4878a7526504180eb3bf5bfffb1556df985228688c74f6b9f93a253bc4eacd5441238dc2ff1d72c22d944938bc6720f79d5c94
|
|
7
|
+
data.tar.gz: 41c0cc5fbd768ba1fffb0729609fe1504daed6a746a3c6d9b744f90693443fe3c599eab228438a0e56e613883c070e1d89fa38200895d2d6ecb13379dac71283
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
|
@@ -6,26 +6,36 @@ RuboCop::RakeTask.new
|
|
|
6
6
|
|
|
7
7
|
task :default => :test
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
# To be removed once after Minitest migration
|
|
10
|
+
desc 'Run fog-openstack unit tests with Shindo'
|
|
10
11
|
task :test do
|
|
11
12
|
mock = ENV['FOG_MOCK'] || 'true'
|
|
12
13
|
sh("export FOG_MOCK=#{mock} && bundle exec shindont")
|
|
13
14
|
end
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
t.name = 'minitest'
|
|
20
|
-
t.libs.push [ "lib", "test" ]
|
|
21
|
-
t.test_files = FileList['test/openstack/*.rb']
|
|
22
|
-
t.verbose = true
|
|
16
|
+
desc 'Run fog-openstack unit tests with Minitest'
|
|
17
|
+
task :minitest do
|
|
18
|
+
mock = ENV['FOG_MOCK'] || 'true'
|
|
19
|
+
sh("export FOG_MOCK=#{mock} && bundle exec rake tests:unit")
|
|
23
20
|
end
|
|
24
21
|
|
|
25
|
-
desc
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
desc 'Run fog-openstack spec/ tests (VCR)'
|
|
23
|
+
task :spec => "tests:spec"
|
|
24
|
+
|
|
25
|
+
namespace :tests do
|
|
26
|
+
desc "Run fog-openstack test/"
|
|
27
|
+
Rake::TestTask.new do |t|
|
|
28
|
+
t.name = 'unit'
|
|
29
|
+
t.libs.push [ "lib", "test" ]
|
|
30
|
+
t.test_files = FileList['test/**/*.rb']
|
|
31
|
+
t.verbose = true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
desc "Run fog-openstack spec/"
|
|
35
|
+
Rake::TestTask.new do |t|
|
|
36
|
+
t.name = 'spec'
|
|
37
|
+
t.libs.push [ "lib", "spec" ]
|
|
38
|
+
t.pattern = 'spec/**/*_spec.rb'
|
|
39
|
+
t.verbose = true
|
|
40
|
+
end
|
|
31
41
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/fog-openstack.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
20
|
spec.require_paths = ["lib"]
|
|
21
21
|
|
|
22
|
-
spec.add_dependency 'fog-core', '>= 1.
|
|
22
|
+
spec.add_dependency 'fog-core', '>= 1.40'
|
|
23
23
|
spec.add_dependency 'fog-json', '>= 1.0'
|
|
24
24
|
spec.add_dependency 'ipaddress', '>= 0.8'
|
|
25
25
|
|
data/lib/fog/openstack.rb
CHANGED
|
@@ -15,6 +15,7 @@ require 'fog/openstack/storage'
|
|
|
15
15
|
require 'fog/openstack/volume_v1'
|
|
16
16
|
require 'fog/openstack/volume_v2'
|
|
17
17
|
require 'fog/openstack/planning'
|
|
18
|
+
require 'fog/openstack/monitoring'
|
|
18
19
|
|
|
19
20
|
module Fog
|
|
20
21
|
module Compute
|
|
@@ -57,6 +58,10 @@ module Fog
|
|
|
57
58
|
autoload :OpenStack, File.expand_path('../openstack/introspection', __FILE__)
|
|
58
59
|
end
|
|
59
60
|
|
|
61
|
+
module Monitoring
|
|
62
|
+
autoload :OpenStack, File.expand_path('../fog/openstack/monitoring', __FILE__)
|
|
63
|
+
end
|
|
64
|
+
|
|
60
65
|
module OpenStack
|
|
61
66
|
extend Fog::Provider
|
|
62
67
|
|
|
@@ -72,6 +77,7 @@ module Fog
|
|
|
72
77
|
service(:baremetal, 'Baremetal')
|
|
73
78
|
service(:planning, 'Planning')
|
|
74
79
|
service(:introspection, 'Introspection')
|
|
80
|
+
service(:monitoring, 'Monitoring')
|
|
75
81
|
|
|
76
82
|
@@token_cache = {}
|
|
77
83
|
|
|
@@ -29,17 +29,18 @@ module Fog
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def update
|
|
32
|
+
requires :id
|
|
32
33
|
merge_attributes(service.update_aggregate(self.id, self.attributes).body['aggregate'])
|
|
33
34
|
self
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def add_host(host_uuid)
|
|
37
|
-
requires :id
|
|
38
|
+
requires :id
|
|
38
39
|
service.add_aggregate_host(self.id, host_uuid)
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def remove_host(host_uuid)
|
|
42
|
-
requires :id
|
|
43
|
+
requires :id
|
|
43
44
|
service.remove_aggregate_host(self.id, host_uuid)
|
|
44
45
|
end
|
|
45
46
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'fog/openstack/models/model'
|
|
2
|
+
|
|
3
|
+
module Fog
|
|
4
|
+
module Monitoring
|
|
5
|
+
class OpenStack
|
|
6
|
+
class Alarm < Fog::OpenStack::Model
|
|
7
|
+
identity :id
|
|
8
|
+
|
|
9
|
+
attribute :name
|
|
10
|
+
attribute :links
|
|
11
|
+
attribute :link
|
|
12
|
+
attribute :alarm_definition
|
|
13
|
+
attribute :metrics
|
|
14
|
+
attribute :state
|
|
15
|
+
attribute :lifecycle_state
|
|
16
|
+
attribute :state_updated_timestamp
|
|
17
|
+
attribute :updated_timestamp
|
|
18
|
+
attribute :created_timestamp
|
|
19
|
+
|
|
20
|
+
def update(attr = nil)
|
|
21
|
+
requires :id
|
|
22
|
+
merge_attributes(
|
|
23
|
+
service.update_alarm(id, attr || attributes).body
|
|
24
|
+
)
|
|
25
|
+
self
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def patch(attr = nil)
|
|
29
|
+
requires :id
|
|
30
|
+
merge_attributes(
|
|
31
|
+
service.patch_alarm(id, attr || attributes).body
|
|
32
|
+
)
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def destroy
|
|
37
|
+
requires :id
|
|
38
|
+
service.delete_alarm(id)
|
|
39
|
+
true
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def to_s
|
|
43
|
+
name
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'fog/openstack/models/model'
|
|
2
|
+
|
|
3
|
+
module Fog
|
|
4
|
+
module Monitoring
|
|
5
|
+
class OpenStack
|
|
6
|
+
class AlarmCount < Fog::OpenStack::Model
|
|
7
|
+
attribute :links
|
|
8
|
+
attribute :columns
|
|
9
|
+
attribute :counts
|
|
10
|
+
|
|
11
|
+
def to_s
|
|
12
|
+
name
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'fog/openstack/models/collection'
|
|
2
|
+
require 'fog/openstack/models/monitoring/alarm_count'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module Monitoring
|
|
6
|
+
class OpenStack
|
|
7
|
+
class AlarmCounts < Fog::OpenStack::Collection
|
|
8
|
+
model Fog::Monitoring::OpenStack::AlarmCount
|
|
9
|
+
|
|
10
|
+
def get(options = {})
|
|
11
|
+
load_response(service.get_alarm_counts(options))
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'fog/openstack/models/model'
|
|
2
|
+
|
|
3
|
+
module Fog
|
|
4
|
+
module Monitoring
|
|
5
|
+
class OpenStack
|
|
6
|
+
class AlarmDefinition < Fog::OpenStack::Model
|
|
7
|
+
identity :id
|
|
8
|
+
|
|
9
|
+
attribute :links
|
|
10
|
+
attribute :name
|
|
11
|
+
attribute :description
|
|
12
|
+
attribute :expression
|
|
13
|
+
attribute :expression_data
|
|
14
|
+
attribute :match_by
|
|
15
|
+
attribute :severity
|
|
16
|
+
attribute :actions_enabled
|
|
17
|
+
attribute :alarm_actions
|
|
18
|
+
attribute :ok_actions
|
|
19
|
+
attribute :undetermined_actions
|
|
20
|
+
|
|
21
|
+
def create
|
|
22
|
+
requires :name, :expression
|
|
23
|
+
merge_attributes(
|
|
24
|
+
service.create_alarm_definition(attributes).body
|
|
25
|
+
)
|
|
26
|
+
self
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update(attr = nil)
|
|
30
|
+
requires :name, :expression
|
|
31
|
+
merge_attributes(
|
|
32
|
+
service.update_alarm_definition(id, attr || attributes).body
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def patch(attr = nil)
|
|
37
|
+
requires :id
|
|
38
|
+
merge_attributes(
|
|
39
|
+
service.patch_alarm_definition(id, attr || attributes).body
|
|
40
|
+
)
|
|
41
|
+
self
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def destroy
|
|
45
|
+
requires :id
|
|
46
|
+
service.delete_alarm_definition(id)
|
|
47
|
+
true
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def to_s
|
|
51
|
+
name
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'fog/openstack/models/collection'
|
|
2
|
+
require 'fog/openstack/models/monitoring/alarm_definition'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module Monitoring
|
|
6
|
+
class OpenStack
|
|
7
|
+
class AlarmDefinitions < Fog::OpenStack::Collection
|
|
8
|
+
model Fog::Monitoring::OpenStack::AlarmDefinition
|
|
9
|
+
|
|
10
|
+
def create(attributes)
|
|
11
|
+
super(attributes)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def update(attributes)
|
|
15
|
+
super(attributes)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def patch(attributes)
|
|
19
|
+
super(attributes)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def all(options = {})
|
|
23
|
+
load_response(service.list_alarm_definitions(options), 'elements')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def find_by_id(id)
|
|
27
|
+
cached_alarm_definition = detect { |alarm_definition| alarm_definition.id == id }
|
|
28
|
+
return cached_alarm_definition if cached_alarm_definition
|
|
29
|
+
alarm_definition_hash = service.get_alarm_definition(id).body
|
|
30
|
+
Fog::Monitoring::OpenStack::AlarmDefinition.new(
|
|
31
|
+
alarm_definition_hash.merge(:service => service)
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def destroy(id)
|
|
36
|
+
alarm_definition = find_by_id(id)
|
|
37
|
+
alarm_definition.destroy
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'fog/openstack/models/model'
|
|
2
|
+
|
|
3
|
+
module Fog
|
|
4
|
+
module Monitoring
|
|
5
|
+
class OpenStack
|
|
6
|
+
class AlarmState < Fog::OpenStack::Model
|
|
7
|
+
identity :id
|
|
8
|
+
|
|
9
|
+
attribute :alarm_id
|
|
10
|
+
attribute :metrics
|
|
11
|
+
attribute :old_state
|
|
12
|
+
attribute :new_state
|
|
13
|
+
attribute :reason
|
|
14
|
+
attribute :reason_data
|
|
15
|
+
attribute :timestamp
|
|
16
|
+
attribute :sub_alarms
|
|
17
|
+
|
|
18
|
+
def patch(options)
|
|
19
|
+
requires :id
|
|
20
|
+
merge_attributes(
|
|
21
|
+
service.list_alarm_state_history_for_specific_alarm(id, options)
|
|
22
|
+
)
|
|
23
|
+
self
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def to_s
|
|
27
|
+
name
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'fog/openstack/models/collection'
|
|
2
|
+
require 'fog/openstack/models/monitoring/alarm_state'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module Monitoring
|
|
6
|
+
class OpenStack
|
|
7
|
+
class AlarmStates < Fog::OpenStack::Collection
|
|
8
|
+
model Fog::Monitoring::OpenStack::AlarmState
|
|
9
|
+
|
|
10
|
+
def all(options = {})
|
|
11
|
+
load_response(service.list_alarm_state_history_for_all_alarms(options), 'elements')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def list_alarm_state_history(id, options = {})
|
|
15
|
+
load_response(service.list_alarm_state_history_for_specific_alarm(id, options), 'elements')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'fog/openstack/models/collection'
|
|
2
|
+
require 'fog/openstack/models/monitoring/alarm'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module Monitoring
|
|
6
|
+
class OpenStack
|
|
7
|
+
class Alarms < Fog::OpenStack::Collection
|
|
8
|
+
model Fog::Monitoring::OpenStack::Alarm
|
|
9
|
+
|
|
10
|
+
def all(options = {})
|
|
11
|
+
load_response(service.list_alarms(options), 'elements')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find_by_id(id)
|
|
15
|
+
cached_alarm = detect { |alarm| alarm.id == id }
|
|
16
|
+
return cached_alarm if cached_alarm
|
|
17
|
+
alarm_hash = service.get_alarm(id).body
|
|
18
|
+
Fog::Identity::OpenStack::Alarm.new(
|
|
19
|
+
alarm_hash.merge(:service => service)
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def destroy(id)
|
|
24
|
+
alarm = find_by_id(id)
|
|
25
|
+
alarm.destroy
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|