fog 1.27.0 → 1.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +71 -0
- data/Rakefile +2 -2
- data/bin/fog +2 -2
- data/fog.gemspec +4 -3
- data/lib/fog/bin/clodo.rb +1 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/digitalocean/examples/getting_started.md +46 -4
- data/lib/fog/digitalocean/models/compute/server.rb +1 -3
- data/lib/fog/digitalocean/models/compute/servers.rb +30 -0
- data/lib/fog/fogdocker/compute.rb +3 -2
- data/lib/fog/fogdocker/requests/compute/container_action.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_all.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_commit.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_create.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_delete.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_get.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_all.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_create.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_delete.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_get.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_search.rb +1 -1
- data/lib/fog/google/compute.rb +2 -1
- data/lib/fog/google/core.rb +42 -12
- data/lib/fog/google/dns.rb +2 -1
- data/lib/fog/google/monitoring.rb +1 -1
- data/lib/fog/google/sql.rb +1 -1
- data/lib/fog/hp/requests/storage/get_object.rb +5 -3
- data/lib/fog/joyent/compute.rb +2 -0
- data/lib/fog/openstack.rb +1 -0
- data/lib/fog/openstack/baremetal.rb +370 -0
- data/lib/fog/openstack/core.rb +1 -0
- data/lib/fog/openstack/docs/orchestration.md +318 -0
- data/lib/fog/openstack/docs/storage.md +1 -7
- data/lib/fog/openstack/models/baremetal/chassis.rb +60 -0
- data/lib/fog/openstack/models/baremetal/chassis_collection.rb +38 -0
- data/lib/fog/openstack/models/baremetal/driver.rb +30 -0
- data/lib/fog/openstack/models/baremetal/drivers.rb +21 -0
- data/lib/fog/openstack/models/baremetal/node.rb +85 -0
- data/lib/fog/openstack/models/baremetal/nodes.rb +38 -0
- data/lib/fog/openstack/models/baremetal/port.rb +61 -0
- data/lib/fog/openstack/models/baremetal/ports.rb +38 -0
- data/lib/fog/openstack/models/orchestration/event.rb +20 -0
- data/lib/fog/openstack/models/orchestration/events.rb +28 -0
- data/lib/fog/openstack/models/orchestration/resource.rb +32 -0
- data/lib/fog/openstack/models/orchestration/resource_schemas.rb +17 -0
- data/lib/fog/openstack/models/orchestration/resources.rb +35 -0
- data/lib/fog/openstack/models/orchestration/stack.rb +91 -24
- data/lib/fog/openstack/models/orchestration/stacks.rb +38 -4
- data/lib/fog/openstack/models/orchestration/template.rb +15 -0
- data/lib/fog/openstack/models/orchestration/templates.rb +44 -0
- data/lib/fog/openstack/orchestration.rb +48 -2
- data/lib/fog/openstack/requests/baremetal/create_chassis.rb +44 -0
- data/lib/fog/openstack/requests/baremetal/create_node.rb +54 -0
- data/lib/fog/openstack/requests/baremetal/create_port.rb +46 -0
- data/lib/fog/openstack/requests/baremetal/delete_chassis.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/delete_node.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/delete_port.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/get_chassis.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_driver.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_driver_properties.rb +40 -0
- data/lib/fog/openstack/requests/baremetal/get_node.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_port.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/list_chassis.rb +48 -0
- data/lib/fog/openstack/requests/baremetal/list_chassis_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/list_drivers.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/list_nodes.rb +40 -0
- data/lib/fog/openstack/requests/baremetal/list_nodes_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/list_ports.rb +48 -0
- data/lib/fog/openstack/requests/baremetal/list_ports_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/patch_chassis.rb +42 -0
- data/lib/fog/openstack/requests/baremetal/patch_node.rb +41 -0
- data/lib/fog/openstack/requests/baremetal/patch_port.rb +41 -0
- data/lib/fog/openstack/requests/compute/create_server.rb +1 -0
- data/lib/fog/openstack/requests/orchestration/abandon_stack.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/build_info.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/create_stack.rb +31 -12
- data/lib/fog/openstack/requests/orchestration/delete_stack.rb +28 -5
- data/lib/fog/openstack/requests/orchestration/get_stack_template.rb +20 -0
- data/lib/fog/openstack/requests/orchestration/list_resource_events.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/list_resource_types.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/list_resources.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/list_stack_data.rb +27 -0
- data/lib/fog/openstack/requests/orchestration/list_stack_events.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/preview_stack.rb +16 -0
- data/lib/fog/openstack/requests/orchestration/show_event_details.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_data.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_metadata.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_schema.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_template.rb +20 -0
- data/lib/fog/openstack/requests/orchestration/show_stack_details.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/update_stack.rb +34 -7
- data/lib/fog/openstack/requests/orchestration/validate_template.rb +16 -0
- data/lib/fog/openstack/volume.rb +0 -1
- data/lib/fog/ovirt/compute.rb +6 -0
- data/lib/fog/ovirt/models/compute/server.rb +10 -0
- data/lib/fog/ovirt/models/compute/template.rb +1 -0
- data/lib/fog/ovirt/models/compute/volumes.rb +1 -2
- data/lib/fog/ovirt/requests/compute/attach_volume.rb +22 -0
- data/lib/fog/ovirt/requests/compute/detach_volume.rb +22 -0
- data/lib/fog/ovirt/requests/compute/list_volumes.rb +19 -0
- data/lib/fog/ovirt/requests/compute/mock_files/disks.xml +58 -0
- data/lib/fog/vcloud_director/models/compute/task.rb +2 -2
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +3 -0
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +20 -11
- data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +41 -0
- data/lib/fog/vsphere/requests/compute/get_network.rb +35 -6
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +19 -13
- data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +92 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +16 -11
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +6 -5
- data/lib/fog/xenserver/requests/compute/create_sr.rb +3 -4
- data/lib/tasks/changelog_task.rb +1 -0
- data/tests/helper.rb +3 -3
- data/tests/helpers/mock_helper.rb +0 -4
- data/tests/openstack/requests/baremetal/chassis_tests.rb +48 -0
- data/tests/openstack/requests/baremetal/driver_tests.rb +40 -0
- data/tests/openstack/requests/baremetal/node_tests.rb +65 -0
- data/tests/openstack/requests/baremetal/port_tests.rb +56 -0
- data/tests/openstack/requests/compute/server_tests.rb +2 -0
- data/tests/openstack/requests/orchestration/stack_tests.rb +2 -2
- data/tests/vsphere/requests/compute/get_network_tests.rb +48 -0
- metadata +88 -23
- data/lib/fog/aws.rb +0 -23
- data/lib/fog/bin/riakcs.rb +0 -25
- data/lib/fog/openstack/requests/orchestration/list_stacks.rb +0 -47
- data/lib/fog/riakcs.rb +0 -2
- data/lib/fog/riakcs/core.rb +0 -121
- data/lib/fog/riakcs/provisioning.rb +0 -98
- data/lib/fog/riakcs/requests/provisioning/create_user.rb +0 -77
- data/lib/fog/riakcs/requests/provisioning/disable_user.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/enable_user.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/get_user.rb +0 -41
- data/lib/fog/riakcs/requests/provisioning/list_users.rb +0 -43
- data/lib/fog/riakcs/requests/provisioning/regrant_secret.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/update_user.rb +0 -23
- data/lib/fog/riakcs/requests/usage/get_usage.rb +0 -68
- data/lib/fog/riakcs/usage.rb +0 -62
- data/tests/riakcs/requests/provisioning/provisioning_tests.rb +0 -174
- data/tests/riakcs/requests/usage/usage_tests.rb +0 -29
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Orchestration
|
5
|
+
class OpenStack
|
6
|
+
class Resource < Fog::Model
|
7
|
+
|
8
|
+
include Reflectable
|
9
|
+
|
10
|
+
identity :id
|
11
|
+
|
12
|
+
%w{resource_name description links logical_resource_id resource_status
|
13
|
+
updated_time required_by resource_status_reason resource_type}.each do |a|
|
14
|
+
attribute a.to_sym
|
15
|
+
end
|
16
|
+
|
17
|
+
def events(options={})
|
18
|
+
@events ||= service.events.all(self, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def metadata
|
22
|
+
@metadata ||= service.show_resource_metadata(stack, self.resource_name).body['metadata']
|
23
|
+
end
|
24
|
+
|
25
|
+
def template
|
26
|
+
@template ||= service.templates.get(self)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Orchestration
|
5
|
+
class OpenStack
|
6
|
+
class ResourceSchemas < Fog::Collection
|
7
|
+
|
8
|
+
def get(resource_type)
|
9
|
+
service.show_resource_schema(resource_type).body
|
10
|
+
rescue Fog::Compute::OpenStack::NotFound
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'fog/openstack/models/orchestration/resource'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Orchestration
|
5
|
+
class OpenStack
|
6
|
+
class Resources < Fog::Collection
|
7
|
+
model Fog::Orchestration::OpenStack::Resource
|
8
|
+
|
9
|
+
def types
|
10
|
+
service.list_resource_types.body['resource_types'].sort
|
11
|
+
end
|
12
|
+
|
13
|
+
def all(stack, options={})
|
14
|
+
data = service.list_resources(stack, options).body['resources']
|
15
|
+
load(data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(resource_name, stack=nil)
|
19
|
+
stack = self.first.stack if stack.nil?
|
20
|
+
data = service.show_resource_data(stack.stack_name, stack.id, resource_name).body['resource']
|
21
|
+
new(data)
|
22
|
+
rescue Fog::Compute::OpenStack::NotFound
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def metadata(stack_name, stack_id, resource_name)
|
27
|
+
service.show_resource_metadata(stack_name, stack_id, resource_name).body['resource']
|
28
|
+
rescue Fog::Compute::OpenStack::NotFound
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,22 +1,15 @@
|
|
1
|
-
require 'fog/core/model'
|
2
|
-
|
3
1
|
module Fog
|
4
2
|
module Orchestration
|
5
3
|
class OpenStack
|
6
4
|
class Stack < Fog::Model
|
7
|
-
identity :id
|
8
5
|
|
9
|
-
|
10
|
-
attribute :stack_status
|
11
|
-
attribute :stack_status_reason
|
12
|
-
attribute :creation_time
|
13
|
-
attribute :updated_time
|
14
|
-
attribute :id
|
6
|
+
identity :id
|
15
7
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
8
|
+
%w{capabilities description disable_rollback links notification_topics outputs parameters
|
9
|
+
stack_name stack_status stack_status_reason template_description timeout_mins
|
10
|
+
creation_time updated_time}.each do |a|
|
11
|
+
attribute a.to_sym
|
12
|
+
end
|
20
13
|
|
21
14
|
def initialize(attributes)
|
22
15
|
# Old 'connection' is renamed as service and should be used instead
|
@@ -24,28 +17,102 @@ module Fog
|
|
24
17
|
super
|
25
18
|
end
|
26
19
|
|
27
|
-
def save
|
28
|
-
|
29
|
-
|
20
|
+
def save(options={})
|
21
|
+
if persisted?
|
22
|
+
service.update_stack(self, default_options.merge(options)).body['stack']
|
23
|
+
else
|
24
|
+
service.stacks.create(default_options.merge(options))
|
25
|
+
end
|
30
26
|
end
|
31
27
|
|
28
|
+
# Deprecated
|
32
29
|
def create
|
30
|
+
Fog::Logger.deprecation("#create is deprecated, use #save(options) instead [light_black](#{caller.first})[/]")
|
33
31
|
requires :stack_name
|
34
|
-
service.
|
35
|
-
self
|
32
|
+
service.stacks.create(default_options)
|
36
33
|
end
|
37
34
|
|
35
|
+
# Deprecated
|
38
36
|
def update
|
37
|
+
Fog::Logger.deprecation("#update is deprecated, use #save(options) instead [light_black](#{caller.first})[/]")
|
39
38
|
requires :stack_name
|
40
|
-
service.update_stack(
|
41
|
-
|
39
|
+
service.update_stack(self, default_options).body['stack']
|
40
|
+
end
|
41
|
+
|
42
|
+
def delete
|
43
|
+
service.delete_stack(self)
|
44
|
+
end
|
45
|
+
alias_method :destroy, :delete
|
46
|
+
|
47
|
+
def details
|
48
|
+
@details ||= service.stacks.get(self.stack_name, self.id)
|
49
|
+
end
|
50
|
+
|
51
|
+
def resources(options={})
|
52
|
+
@resources ||= service.resources.all(self, options)
|
53
|
+
end
|
54
|
+
|
55
|
+
def events(options={})
|
56
|
+
@events ||= service.events.all(self, options)
|
57
|
+
end
|
58
|
+
|
59
|
+
def template
|
60
|
+
@template ||= service.templates.get(self)
|
42
61
|
end
|
43
62
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
63
|
+
def abandon
|
64
|
+
service.abandon_stack(self)
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
# Deprecated
|
69
|
+
def template_url
|
70
|
+
Fog::Logger.deprecation("#template_url is deprecated, use it in options for #save(options) instead [light_black](#{caller.first})[/]")
|
71
|
+
@template_url
|
72
|
+
end
|
73
|
+
|
74
|
+
# Deprecated
|
75
|
+
def template_url=(url)
|
76
|
+
Fog::Logger.deprecation("#template_url= is deprecated, use it in options for #save(options) instead [light_black](#{caller.first})[/]")
|
77
|
+
@template_url = url
|
78
|
+
end
|
79
|
+
|
80
|
+
# Deprecated
|
81
|
+
def template=(content)
|
82
|
+
Fog::Logger.deprecation("#template=(content) is deprecated, use it in options for #save(options) instead [light_black](#{caller.first})[/]")
|
83
|
+
@template = content
|
84
|
+
end
|
85
|
+
|
86
|
+
# Deprecated
|
87
|
+
def timeout_in_minutes
|
88
|
+
Fog::Logger.deprecation("#timeout_in_minutes is deprecated, set timeout_mins in options for save(options) instead [light_black](#{caller.first})[/]")
|
89
|
+
timeout_mins
|
90
|
+
end
|
91
|
+
|
92
|
+
# Deprecated
|
93
|
+
def timeout_in_minutes=(minutes)
|
94
|
+
Fog::Logger.deprecation("#timeout_in_minutes=(minutes) is deprecated, set timeout_mins in options for save(options) instead [light_black](#{caller.first})[/]")
|
95
|
+
timeout_mins = minutes
|
96
|
+
end
|
97
|
+
|
98
|
+
# build options to create or update stack
|
99
|
+
def default_options
|
100
|
+
template_content =
|
101
|
+
if template && template.is_a?(Fog::Orchestration::OpenStack::Template)
|
102
|
+
template.content
|
103
|
+
else
|
104
|
+
template
|
105
|
+
end
|
106
|
+
|
107
|
+
{
|
108
|
+
:stack_name => stack_name,
|
109
|
+
:disable_rollback => disable_rollback,
|
110
|
+
:template_url => @template_url,
|
111
|
+
:template => template_content,
|
112
|
+
:timeout_mins => timeout_mins
|
113
|
+
}
|
48
114
|
end
|
115
|
+
private :default_options
|
49
116
|
end
|
50
117
|
end
|
51
118
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
1
|
require 'fog/openstack/models/orchestration/stack'
|
3
2
|
|
4
3
|
module Fog
|
@@ -7,14 +6,49 @@ module Fog
|
|
7
6
|
class Stacks < Fog::Collection
|
8
7
|
model Fog::Orchestration::OpenStack::Stack
|
9
8
|
|
10
|
-
def all
|
11
|
-
|
9
|
+
def all(options={})
|
10
|
+
data = service.list_stack_data(options).body['stacks']
|
11
|
+
load(data)
|
12
12
|
end
|
13
13
|
|
14
|
+
# Deprecated
|
14
15
|
def find_by_id(id)
|
16
|
+
Fog::Logger.deprecation("#find_by_id(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]")
|
15
17
|
self.find {|stack| stack.id == id}
|
16
18
|
end
|
17
|
-
|
19
|
+
|
20
|
+
def get(arg1, arg2 = nil)
|
21
|
+
if arg2.nil?
|
22
|
+
# Deprecated: get(id)
|
23
|
+
Fog::Logger.deprecation("#get(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]")
|
24
|
+
return find_by_id(arg1)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Normal use: get(name, id)
|
28
|
+
name = arg1
|
29
|
+
id = arg2
|
30
|
+
data = service.show_stack_details(name, id).body['stack']
|
31
|
+
new(data)
|
32
|
+
rescue Fog::Compute::OpenStack::NotFound
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def adopt(options={})
|
37
|
+
service.create_stack(options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def create(options={})
|
41
|
+
service.create_stack(options).body['stack']
|
42
|
+
end
|
43
|
+
|
44
|
+
def preview(options={})
|
45
|
+
data = service.preview_stack(options).body['stack']
|
46
|
+
new(data)
|
47
|
+
end
|
48
|
+
|
49
|
+
def build_info
|
50
|
+
service.build_info.body
|
51
|
+
end
|
18
52
|
end
|
19
53
|
end
|
20
54
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Orchestration
|
5
|
+
class OpenStack
|
6
|
+
class Template < Fog::Model
|
7
|
+
|
8
|
+
%w{format description template_version parameters resources content}.each do |a|
|
9
|
+
attribute a.to_sym
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'fog/openstack/models/orchestration/template'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Orchestration
|
5
|
+
class OpenStack
|
6
|
+
class Templates < Fog::Collection
|
7
|
+
model Fog::Orchestration::OpenStack::Template
|
8
|
+
|
9
|
+
def get(obj)
|
10
|
+
data = if obj.is_a?(Stack)
|
11
|
+
service.get_stack_template(obj).body
|
12
|
+
else
|
13
|
+
service.show_resource_template(obj.resource_name).body
|
14
|
+
end
|
15
|
+
|
16
|
+
if data.has_key?('AWSTemplateFormatVersion')
|
17
|
+
data['content'] = data.to_json
|
18
|
+
data['format'] = 'CFN'
|
19
|
+
data['template_version'] = data.delete('AWSTemplateFormatVersion')
|
20
|
+
data['description'] = data.delete('Description')
|
21
|
+
data['parameter'] = data.delete('Parameters')
|
22
|
+
data['resources'] = data.delete('Resources')
|
23
|
+
else
|
24
|
+
data['content'] = data.to_yaml
|
25
|
+
data['format'] = 'HOT'
|
26
|
+
data['template_version'] = data.delete('heat_template_version')
|
27
|
+
end
|
28
|
+
|
29
|
+
new(data)
|
30
|
+
rescue Fog::Compute::OpenStack::NotFound
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate(options={})
|
35
|
+
data = service.validate_template(options).body
|
36
|
+
temp = new
|
37
|
+
temp.parameters = data['Parameters']
|
38
|
+
temp.description = data['Description']
|
39
|
+
temp
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -15,11 +15,57 @@ module Fog
|
|
15
15
|
model :stack
|
16
16
|
collection :stacks
|
17
17
|
|
18
|
+
model :resource
|
19
|
+
collection :resources
|
20
|
+
|
21
|
+
collection :resource_schemas
|
22
|
+
|
23
|
+
model :event
|
24
|
+
collection :events
|
25
|
+
|
26
|
+
model :template
|
27
|
+
collection :templates
|
28
|
+
|
18
29
|
request_path 'fog/openstack/requests/orchestration'
|
30
|
+
request :abandon_stack
|
31
|
+
request :build_info
|
19
32
|
request :create_stack
|
20
|
-
request :update_stack
|
21
33
|
request :delete_stack
|
22
|
-
request :
|
34
|
+
request :get_stack_template
|
35
|
+
request :list_resource_events
|
36
|
+
request :list_resource_types
|
37
|
+
request :list_resources
|
38
|
+
request :list_stack_data
|
39
|
+
request :list_stack_events
|
40
|
+
request :preview_stack
|
41
|
+
request :show_event_details
|
42
|
+
request :show_resource_data
|
43
|
+
request :show_resource_metadata
|
44
|
+
request :show_resource_schema
|
45
|
+
request :show_resource_template
|
46
|
+
request :show_stack_details
|
47
|
+
request :update_stack
|
48
|
+
request :validate_template
|
49
|
+
|
50
|
+
module Reflectable
|
51
|
+
|
52
|
+
REFLECTION_REGEX = /\/stacks\/(\w+)\/([\w|-]+)\/resources\/(\w+)/
|
53
|
+
|
54
|
+
def resource
|
55
|
+
@resource ||= service.resources.get(r[3], stack)
|
56
|
+
end
|
57
|
+
|
58
|
+
def stack
|
59
|
+
@stack ||= service.stacks.get(r[1], r[2])
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def reflection
|
65
|
+
@reflection ||= REFLECTION_REGEX.match(self.links[0]['href'])
|
66
|
+
end
|
67
|
+
alias :r :reflection
|
68
|
+
end
|
23
69
|
|
24
70
|
class Mock
|
25
71
|
attr_reader :auth_token
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Fog
|
2
|
+
module Baremetal
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
# Create a new chassis
|
6
|
+
#
|
7
|
+
# === Attributes ===
|
8
|
+
# description = Free text description of the chassis
|
9
|
+
# extra = Record arbitrary key/value metadata. Can be specified multiple times
|
10
|
+
def create_chassis(attributes)
|
11
|
+
desired_options = [
|
12
|
+
:description,
|
13
|
+
:extra
|
14
|
+
]
|
15
|
+
|
16
|
+
# Filter only allowed creation attributes
|
17
|
+
data = attributes.select { |key, value| desired_options.include?(key.to_sym) }
|
18
|
+
|
19
|
+
request(
|
20
|
+
:body => Fog::JSON.encode(data),
|
21
|
+
:expects => [200,201],
|
22
|
+
:method => 'POST',
|
23
|
+
:path => 'chassis'
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Mock
|
29
|
+
def create_chassis(attributes)
|
30
|
+
response = Excon::Response.new
|
31
|
+
response.status = 200
|
32
|
+
response.headers = {
|
33
|
+
"X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf",
|
34
|
+
"Content-Type" => "application/json",
|
35
|
+
"Content-Length" => "356",
|
36
|
+
"Date" => Date.new
|
37
|
+
}
|
38
|
+
response.body = self.data[:chassis_collection].first
|
39
|
+
response
|
40
|
+
end
|
41
|
+
end # mock
|
42
|
+
end # openstack
|
43
|
+
end # baremetal
|
44
|
+
end # fog
|