Class: Misty::Cloud
- Inherits:
-
Object
show all
- Defined in:
- lib/misty/cloud.rb
Overview
Misty::Cloud
is the main OpenStack cloud class. An instance holds authentication information such as token, catalog and contains all available services as methods.
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(arg) ⇒ Cloud
18
19
20
|
# File 'lib/misty/cloud.rb', line 18
def initialize(arg)
@config = Misty::Config.new(arg)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, arg = {}) ⇒ Object
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
# File 'lib/misty/cloud.rb', line 233
def method_missing(method_name, arg = {})
services_avail = []
Misty.services.types.each do |serv|
services_avail << serv if /^#{method_name}/.match(serv)
end
if services_avail.size == 1
type = services_avail[0]
raise NoMethodError, "No such Cloud Service: #{method_name}" unless self.class.method_defined?(type)
elsif services_avail.size > 1
raise NoMethodError, "Ambiguous Cloud Service: #{method_name}"
else
raise NoMethodError, "No such Cloud Service: #{method_name}"
end
send(type, arg)
end
|
Class Method Details
.dot_to_underscore(val) ⇒ Object
10
11
12
|
# File 'lib/misty/cloud.rb', line 10
def self.dot_to_underscore(val)
val.gsub(/\./,'_')
end
|
Instance Method Details
#alarming(arg = {}) ⇒ Object
36
37
38
39
40
|
# File 'lib/misty/cloud.rb', line 36
def alarming(arg = {})
@alarming ||= build_service(__method__)
@alarming.request_config(arg)
@alarming
end
|
#application_catalog(arg = {}) ⇒ Object
30
31
32
33
34
|
# File 'lib/misty/cloud.rb', line 30
def application_catalog(arg = {})
@application_catalog ||= build_service(__method__)
@application_catalog.request_config(arg)
@application_catalog
end
|
#backup(arg = {}) ⇒ Object
42
43
44
45
46
|
# File 'lib/misty/cloud.rb', line 42
def backup(arg = {})
@backup ||= build_service(__method__)
@backup.request_config(arg)
@backup
end
|
48
49
50
51
52
|
# File 'lib/misty/cloud.rb', line 48
def baremetal(arg = {})
@baremetal ||= build_service(__method__)
@baremetal.request_config(arg)
@baremetal
end
|
#block_storage(arg = {}) ⇒ Object
Also known as:
volume
54
55
56
57
58
|
# File 'lib/misty/cloud.rb', line 54
def block_storage(arg = {})
@block_storage ||= build_service(__method__)
@block_storage.request_config(arg)
@block_storage
end
|
#build_service(method) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/misty/cloud.rb', line 22
def build_service(method)
service = Misty.services.find {|service| service.type == method}
service_config = @config.get_service(method)
api_version = self.class.dot_to_underscore(service.default_version(service_config[:config][:api_version]))
klass = Object.const_get("Misty::Openstack::API::#{service.project.capitalize}::#{api_version.capitalize}")
klass.new(service_config)
end
|
#clustering(arg = {}) ⇒ Object
60
61
62
63
64
|
# File 'lib/misty/cloud.rb', line 60
def clustering(arg = {})
@clustering ||= build_service(__method__)
@clustering.request_config(arg)
@clustering
end
|
#compute(arg = {}) ⇒ Object
66
67
68
69
70
|
# File 'lib/misty/cloud.rb', line 66
def compute(arg = {})
@compute ||= build_service(__method__)
@compute.request_config(arg)
@compute
end
|
#container_infrastructure_management(arg = {}) ⇒ Object
72
73
74
75
76
|
# File 'lib/misty/cloud.rb', line 72
def container_infrastructure_management(arg = {})
@container_infrastructure_management ||= build_service(__method__)
@container_infrastructure_management.request_config(arg)
@container_infrastructure_management
end
|
#container_service(arg = {}) ⇒ Object
78
79
80
81
82
|
# File 'lib/misty/cloud.rb', line 78
def container_service(arg = {})
@container_service ||= build_service(__method__)
@container_service.request_config(args)
@container_service
end
|
#data_processing(arg = {}) ⇒ Object
84
85
86
87
88
|
# File 'lib/misty/cloud.rb', line 84
def data_processing(arg = {})
@data_processing ||= build_service(__method__)
@data_processing.request_config(arg)
@data_processing
end
|
#data_protection_orchestration(arg = {}) ⇒ Object
90
91
92
93
94
|
# File 'lib/misty/cloud.rb', line 90
def data_protection_orchestration(arg = {})
@data_protection_orchestration ||= build_service(__method__)
@data_protection_orchestration.request_config(arg)
@data_protection_orchestration
end
|
#database(arg = {}) ⇒ Object
96
97
98
99
100
|
# File 'lib/misty/cloud.rb', line 96
def database(arg = {})
@database ||= build_service(__method__)
@database.request_config(arg)
@database
end
|
#dns(arg = {}) ⇒ Object
Also known as:
domain_name_server
102
103
104
105
106
|
# File 'lib/misty/cloud.rb', line 102
def dns(arg = {})
@dns ||= build_service(__method__)
@dns.request_config(arg)
@dns
end
|
#event(arg = {}) ⇒ Object
108
109
110
111
112
|
# File 'lib/misty/cloud.rb', line 108
def event(arg = {})
@event ||= build_service(__method__)
@event.request_config(args)
@event
end
|
#identity(arg = {}) ⇒ Object
114
115
116
117
118
|
# File 'lib/misty/cloud.rb', line 114
def identity(arg = {})
@identity ||= build_service(__method__)
@identity.request_config(arg)
@identity
end
|
#image(arg = {}) ⇒ Object
120
121
122
123
124
|
# File 'lib/misty/cloud.rb', line 120
def image(arg = {})
@image ||= build_service(__method__)
@image.request_config(arg)
@image
end
|
#instance_ha(arg = {}) ⇒ Object
126
127
128
129
130
|
# File 'lib/misty/cloud.rb', line 126
def instance_ha(arg = {})
@instance_ha ||= build_service(__method__)
@instance_ha.request_config(args)
@instance_ha
end
|
#key_manager(arg = {}) ⇒ Object
132
133
134
135
136
|
# File 'lib/misty/cloud.rb', line 132
def key_manager(arg = {})
@key_manager ||= build_service(__method__)
@key_manager.request_config(args)
@key_manager
end
|
#load_balancer(arg = {}) ⇒ Object
138
139
140
141
142
|
# File 'lib/misty/cloud.rb', line 138
def load_balancer(arg = {})
@load_balancer ||= build_service(__method__)
@load_balancer.request_config(arg)
@load_balancer
end
|
#messaging(arg = {}) ⇒ Object
144
145
146
147
148
|
# File 'lib/misty/cloud.rb', line 144
def messaging(arg = {})
@messaging ||= build_service(__method__)
@messaging.request_config(arg)
@messaging
end
|
#metering(arg = {}) ⇒ Object
150
151
152
153
154
|
# File 'lib/misty/cloud.rb', line 150
def metering(arg = {})
@metering ||= build_service(__method__)
@metering.request_config(arg)
@metering
end
|
#metric(arg = {}) ⇒ Object
156
157
158
159
160
|
# File 'lib/misty/cloud.rb', line 156
def metric(arg = {})
@metric ||= build_service(__method__)
@metric.request_config(args)
@metric
end
|
#monitoring(arg = {}) ⇒ Object
162
163
164
165
166
|
# File 'lib/misty/cloud.rb', line 162
def monitoring(arg = {})
@monitoring ||= build_service(__method__)
@monitoring.request_config(args)
@monitoring
end
|
#network(arg = {}) ⇒ Object
168
169
170
171
172
|
# File 'lib/misty/cloud.rb', line 168
def network(arg = {})
@network ||= build_service(__method__)
@network.request_config(arg)
@network
end
|
#nfv_orchestration(arg = {}) ⇒ Object
174
175
176
177
178
|
# File 'lib/misty/cloud.rb', line 174
def nfv_orchestration(arg = {})
@nfv_orchestration ||= build_service(__method__)
@nfv_orchestration.request_config(arg)
@nfv_orchestration
end
|
#object_storage(arg = {}) ⇒ Object
180
181
182
183
184
|
# File 'lib/misty/cloud.rb', line 180
def object_storage(arg = {})
@object_storage ||= build_service(__method__)
@object_storage.request_config(arg)
@object_storage
end
|
#orchestration(arg = {}) ⇒ Object
186
187
188
189
190
|
# File 'lib/misty/cloud.rb', line 186
def orchestration(arg = {})
@orchestration ||= build_service(__method__)
@orchestration.request_config(arg)
@orchestration
end
|
#placement(arg = {}) ⇒ Object
192
193
194
195
196
|
# File 'lib/misty/cloud.rb', line 192
def placement(arg = {})
@placement ||= build_service(__method__)
@placement.request_config(args)
@placement
end
|
#reservation(arg = {}) ⇒ Object
198
199
200
201
202
|
# File 'lib/misty/cloud.rb', line 198
def reservation(arg = {})
@reservation ||= build_service(__method__)
@reservation.request_config(args)
@reservation
end
|
#resource_optimization(arg = {}) ⇒ Object
204
205
206
207
208
|
# File 'lib/misty/cloud.rb', line 204
def resource_optimization(arg = {})
@resource_optimization ||= build_service(__method__)
@resource_optimization.request_config(args)
@resource_optimization
end
|
#search(arg = {}) ⇒ Object
210
211
212
213
214
|
# File 'lib/misty/cloud.rb', line 210
def search(arg = {})
@search ||= build_service(__method__)
@search.request_config(arg)
@search
end
|
#shared_file_systems(arg = {}) ⇒ Object
216
217
218
219
220
|
# File 'lib/misty/cloud.rb', line 216
def shared_file_systems(arg = {})
@shared_file_systems ||= build_service(__method__)
@shared_file_systems.request_config(arg)
@shared_file_systems
end
|
#workflow(arg = {}) ⇒ Object
222
223
224
225
226
|
# File 'lib/misty/cloud.rb', line 222
def workflow(arg = {})
@workflow ||= build_service(__method__)
@workflow.request_config(args)
@workflow
end
|