Class: Morpheus::APIClient
- Inherits:
-
Object
- Object
- Morpheus::APIClient
show all
- Defined in:
- lib/morpheus/api/api_client.rb
Direct Known Subclasses
AccountGroupsInterface, AccountsInterface, AppsInterface, ArchiveBucketsInterface, ArchiveFilesInterface, AuthInterface, BlueprintsInterface, CloudDatastoresInterface, CloudFoldersInterface, CloudPoliciesInterface, CloudResourcePoolsInterface, CloudsInterface, ContainersInterface, CustomInstanceTypesInterface, CypherInterface, DashboardInterface, DeployInterface, DeploymentsInterface, EnvironmentsInterface, ExecuteSchedulesInterface, ExecutionRequestInterface, FileCopyRequestInterface, GroupPoliciesInterface, GroupsInterface, ImageBuilderBootScriptsInterface, ImageBuilderImageBuildsInterface, ImageBuilderInterface, ImageBuilderPreseedScriptsInterface, InstanceTypesInterface, InstancesInterface, KeyPairsInterface, LibraryContainerScriptsInterface, LibraryContainerTemplatesInterface, LibraryContainerTypesInterface, LibraryContainerUpgradesInterface, LibraryInstanceTypesInterface, LibraryLayoutsInterface, LicenseInterface, LoadBalancersInterface, LogsInterface, MonitoringAppsInterface, MonitoringChecksInterface, MonitoringContactsInterface, MonitoringGroupsInterface, MonitoringIncidentsInterface, MonitoringInterface, NetworkDomainsInterface, NetworkGroupsInterface, NetworkPoolServersInterface, NetworkPoolsInterface, NetworkProxiesInterface, NetworkServicesInterface, NetworkTypesInterface, NetworksInterface, OldCypherInterface, OptionTypeListsInterface, OptionTypesInterface, OptionsInterface, PackagesInterface, PoliciesInterface, PowerSchedulesInterface, ProcessesInterface, ProvisionTypesInterface, ReportsInterface, RolesInterface, SecurityGroupRulesInterface, SecurityGroupsInterface, ServerTypesInterface, ServersInterface, SetupInterface, StorageProvidersInterface, TaskSetsInterface, TasksInterface, UserGroupsInterface, UserSettingsInterface, UserSourcesInterface, UsersInterface, VirtualImagesInterface, WhoamiInterface, WikiInterface
Instance Method Summary
collapse
-
#account_groups ⇒ Object
-
#accounts ⇒ Object
-
#apps ⇒ Object
-
#archive_buckets ⇒ Object
-
#archive_files ⇒ Object
-
#auth ⇒ Object
-
#blueprints ⇒ Object
-
#cloud_datastores ⇒ Object
-
#cloud_folders ⇒ Object
-
#cloud_policies ⇒ Object
-
#cloud_resource_pools ⇒ Object
-
#clouds ⇒ Object
-
#containers ⇒ Object
-
#custom_instance_types ⇒ Object
-
#cypher ⇒ Object
-
#dashboard ⇒ Object
-
#default_content_type ⇒ Object
set this in your interface, eg.
-
#deploy ⇒ Object
-
#deployments ⇒ Object
-
#dry ⇒ Object
-
#dry_run(val = true) ⇒ Object
-
#environments ⇒ Object
-
#execute(opts, options = {}) ⇒ Object
Execute an HTTP request with this client.
-
#execute_schedules ⇒ Object
-
#execution_request ⇒ Object
-
#file_copy_request ⇒ Object
-
#group_policies ⇒ Object
-
#groups ⇒ Object
-
#image_builder ⇒ Object
-
#initialize(access_token, refresh_token = nil, expires_in = nil, base_url = nil, verify_ssl = true, options = {}) ⇒ APIClient
constructor
A new instance of APIClient.
-
#instance_types ⇒ Object
-
#instances ⇒ Object
-
#key_pairs ⇒ Object
-
#library_container_scripts ⇒ Object
-
#library_container_templates ⇒ Object
-
#library_container_types ⇒ Object
-
#library_container_upgrades ⇒ Object
-
#library_instance_types ⇒ Object
-
#library_layouts ⇒ Object
-
#license ⇒ Object
-
#load_balancers ⇒ Object
-
#logs ⇒ Object
-
#monitoring ⇒ Object
-
#network_domains ⇒ Object
-
#network_groups ⇒ Object
-
#network_pool_servers ⇒ Object
-
#network_pools ⇒ Object
-
#network_proxies ⇒ Object
-
#network_services ⇒ Object
-
#network_types ⇒ Object
-
#networks ⇒ Object
-
#old_cypher ⇒ Object
-
#option_type_lists ⇒ Object
-
#option_types ⇒ Object
-
#options ⇒ Object
-
#packages ⇒ Object
-
#policies ⇒ Object
def incidents # Morpheus::MonitoringIncidentsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options) monitoring.incidents end.
-
#power_schedules ⇒ Object
-
#processes ⇒ Object
-
#provision_types ⇒ Object
-
#reports ⇒ Object
-
#roles ⇒ Object
-
#security_group_rules ⇒ Object
-
#security_groups ⇒ Object
-
#server_types ⇒ Object
-
#servers ⇒ Object
-
#set_ssl_verification_enabled(val) ⇒ Object
-
#setopts(new_options) ⇒ Object
(also: #set_options)
set common global @options for use with all requests meant for inline use just like dry(), set_options(dry_run:true) can be used in place of dry() Example: Prints curl -XGET …/whoami -H “Bearer” instead of actually request APIClient.new(token).whoami.setopts(curl:true).get({}).
-
#setup ⇒ Object
-
#ssl_verification_enabled? ⇒ Boolean
-
#storage_providers ⇒ Object
-
#task_sets ⇒ Object
-
#tasks ⇒ Object
-
#user_groups ⇒ Object
-
#user_settings ⇒ Object
-
#user_sources ⇒ Object
-
#users ⇒ Object
-
#virtual_images ⇒ Object
-
#whoami ⇒ Object
-
#wiki ⇒ Object
-
#withopts(tmp_options, &block) ⇒ Object
(also: #with_options)
with_options sets common global @options for the duration of the block only then returns the options to their prior values.
Constructor Details
#initialize(access_token, refresh_token = nil, expires_in = nil, base_url = nil, verify_ssl = true, options = {}) ⇒ APIClient
Returns a new instance of APIClient.
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/morpheus/api/api_client.rb', line 6
def initialize(access_token, refresh_token=nil,expires_in = nil, base_url=nil, verify_ssl=true, options={})
@access_token = access_token
@refresh_token = refresh_token
@base_url = base_url
if expires_in != nil
@expires_at = DateTime.now + expires_in.seconds
end
set_ssl_verification_enabled(verify_ssl)
setopts(options)
end
|
Instance Method Details
#account_groups ⇒ Object
207
208
209
|
# File 'lib/morpheus/api/api_client.rb', line 207
def account_groups
Morpheus::AccountGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#accounts ⇒ Object
291
292
293
|
# File 'lib/morpheus/api/api_client.rb', line 291
def accounts
Morpheus::AccountsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#apps ⇒ Object
267
268
269
|
# File 'lib/morpheus/api/api_client.rb', line 267
def apps
Morpheus::AppsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#archive_buckets ⇒ Object
409
410
411
|
# File 'lib/morpheus/api/api_client.rb', line 409
def archive_buckets
Morpheus::ArchiveBucketsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#archive_files ⇒ Object
413
414
415
|
# File 'lib/morpheus/api/api_client.rb', line 413
def archive_files
Morpheus::ArchiveFilesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#auth ⇒ Object
187
188
189
|
# File 'lib/morpheus/api/api_client.rb', line 187
def auth
Morpheus::AuthInterface.new(@base_url, @access_token).setopts(@options)
end
|
#blueprints ⇒ Object
271
272
273
|
# File 'lib/morpheus/api/api_client.rb', line 271
def blueprints
Morpheus::BlueprintsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#cloud_datastores ⇒ Object
215
216
217
|
# File 'lib/morpheus/api/api_client.rb', line 215
def cloud_datastores
Morpheus::CloudDatastoresInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#cloud_folders ⇒ Object
223
224
225
|
# File 'lib/morpheus/api/api_client.rb', line 223
def cloud_folders
Morpheus::CloudFoldersInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#cloud_policies ⇒ Object
373
374
375
|
# File 'lib/morpheus/api/api_client.rb', line 373
def cloud_policies
Morpheus::CloudPoliciesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#cloud_resource_pools ⇒ Object
219
220
221
|
# File 'lib/morpheus/api/api_client.rb', line 219
def cloud_resource_pools
Morpheus::CloudResourcePoolsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#clouds ⇒ Object
211
212
213
|
# File 'lib/morpheus/api/api_client.rb', line 211
def clouds
Morpheus::CloudsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#containers ⇒ Object
235
236
237
|
# File 'lib/morpheus/api/api_client.rb', line 235
def containers
Morpheus::ContainersInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#custom_instance_types ⇒ Object
323
324
325
|
# File 'lib/morpheus/api/api_client.rb', line 323
def custom_instance_types
Morpheus::CustomInstanceTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#cypher ⇒ Object
453
454
455
|
# File 'lib/morpheus/api/api_client.rb', line 453
def cypher
Morpheus::CypherInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#dashboard ⇒ Object
335
336
337
|
# File 'lib/morpheus/api/api_client.rb', line 335
def dashboard
Morpheus::DashboardInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#default_content_type ⇒ Object
set this in your interface, eg. to ‘application/json’
35
36
37
|
# File 'lib/morpheus/api/api_client.rb', line 35
def default_content_type
nil
end
|
#deploy ⇒ Object
275
276
277
|
# File 'lib/morpheus/api/api_client.rb', line 275
def deploy
Morpheus::DeployInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#deployments ⇒ Object
279
280
281
|
# File 'lib/morpheus/api/api_client.rb', line 279
def deployments
Morpheus::DeploymentsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#dry ⇒ Object
22
23
24
|
# File 'lib/morpheus/api/api_client.rb', line 22
def dry()
dry_run(true)
end
|
#dry_run(val = true) ⇒ Object
17
18
19
20
|
# File 'lib/morpheus/api/api_client.rb', line 17
def dry_run(val=true)
@dry_run = !!val
self
end
|
#environments ⇒ Object
477
478
479
|
# File 'lib/morpheus/api/api_client.rb', line 477
def environments
Morpheus::EnvironmentsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#execute(opts, options = {}) ⇒ Object
Execute an HTTP request with this client. opts - Hash of options for HTTP Request.
:url - The full url
:method - The default method is :get (GET)
:headers - Hash of to include in the request.
eg. {'Content-Type' => 'application/json'}. :params is a special key for query parameters.
:params - query parameters
:payload - The body of the request.
:timeout - A custom timeout in seconds for api requests. The default is 30. todo: separate timeout options
options - Hash of common global options that commands parse. eg. :headers, :timeout, :dry_run, :curl, etc
:headers - to add. This expects a Hash like {'Content-Type' => 'application/json'}.
:timeout - A custom timeout in seconds for api requests. The default is 30. todo: separate timeout options
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# File 'lib/morpheus/api/api_client.rb', line 92
def execute(opts, options={})
if @options
options = options.merge(@options)
else
options = options.clone
end
if opts[:method].nil?
else
opts[:method] = opts[:method].to_s.downcase.to_sym
end
opts[:headers] ||= {}
if @access_token
if opts[:headers][:authorization].nil? && opts[:headers]['Authorization'].nil?
opts[:headers][:authorization] = "Bearer #{@access_token}"
else
end
end
if opts[:headers]['Content-Type'].nil? && default_content_type
opts[:headers]['Content-Type'] = default_content_type
end
if options[:timeout]
opts[:timeout] = options[:timeout].to_f
end
if options[:headers]
opts[:headers] = opts[:headers].merge(options[:headers])
end
if opts[:params] && (opts[:headers][:params].nil? || opts[:headers][:params].empty?)
opts[:headers][:params] = opts[:params]
end
if @verify_ssl == false
opts[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE
end
if @dry_run
opts[:command_options] = options
return opts
end
response = Morpheus::RestClient.execute(opts)
if opts[:parse_json] != false && options[:parse_json] != false
return JSON.parse(response.to_s)
else
return response
end
end
|
#execute_schedules ⇒ Object
343
344
345
|
# File 'lib/morpheus/api/api_client.rb', line 343
def execute_schedules
Morpheus::ExecuteSchedulesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#execution_request ⇒ Object
461
462
463
|
# File 'lib/morpheus/api/api_client.rb', line 461
def execution_request
Morpheus::ExecutionRequestInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#file_copy_request ⇒ Object
465
466
467
|
# File 'lib/morpheus/api/api_client.rb', line 465
def file_copy_request
Morpheus::FileCopyRequestInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#group_policies ⇒ Object
369
370
371
|
# File 'lib/morpheus/api/api_client.rb', line 369
def group_policies
Morpheus::GroupPoliciesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#groups ⇒ Object
203
204
205
|
# File 'lib/morpheus/api/api_client.rb', line 203
def groups
Morpheus::GroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#image_builder ⇒ Object
417
418
419
|
# File 'lib/morpheus/api/api_client.rb', line 417
def image_builder
Morpheus::ImageBuilderInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#instance_types ⇒ Object
239
240
241
|
# File 'lib/morpheus/api/api_client.rb', line 239
def instance_types
Morpheus::InstanceTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#instances ⇒ Object
231
232
233
|
# File 'lib/morpheus/api/api_client.rb', line 231
def instances
Morpheus::InstancesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#key_pairs ⇒ Object
315
316
317
|
# File 'lib/morpheus/api/api_client.rb', line 315
def key_pairs
Morpheus::KeyPairsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#library_container_scripts ⇒ Object
441
442
443
|
# File 'lib/morpheus/api/api_client.rb', line 441
def library_container_scripts
Morpheus::LibraryContainerScriptsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#library_container_templates ⇒ Object
445
446
447
|
# File 'lib/morpheus/api/api_client.rb', line 445
def library_container_templates
Morpheus::LibraryContainerTemplatesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#library_container_types ⇒ Object
437
438
439
|
# File 'lib/morpheus/api/api_client.rb', line 437
def library_container_types
Morpheus::LibraryContainerTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#library_container_upgrades ⇒ Object
433
434
435
|
# File 'lib/morpheus/api/api_client.rb', line 433
def library_container_upgrades
Morpheus::LibraryContainerUpgradesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#library_instance_types ⇒ Object
425
426
427
|
# File 'lib/morpheus/api/api_client.rb', line 425
def library_instance_types
Morpheus::LibraryInstanceTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#library_layouts ⇒ Object
429
430
431
|
# File 'lib/morpheus/api/api_client.rb', line 429
def library_layouts
Morpheus::LibraryLayoutsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#license ⇒ Object
319
320
321
|
# File 'lib/morpheus/api/api_client.rb', line 319
def license
Morpheus::LicenseInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#load_balancers ⇒ Object
251
252
253
|
# File 'lib/morpheus/api/api_client.rb', line 251
def load_balancers
Morpheus::LoadBalancersInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#logs ⇒ Object
307
308
309
|
# File 'lib/morpheus/api/api_client.rb', line 307
def logs
Morpheus::LogsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#monitoring ⇒ Object
351
352
353
|
# File 'lib/morpheus/api/api_client.rb', line 351
def monitoring
Morpheus::MonitoringInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#network_domains ⇒ Object
401
402
403
|
# File 'lib/morpheus/api/api_client.rb', line 401
def network_domains
Morpheus::NetworkDomainsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#network_groups ⇒ Object
385
386
387
|
# File 'lib/morpheus/api/api_client.rb', line 385
def network_groups
Morpheus::NetworkGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#network_pool_servers ⇒ Object
397
398
399
|
# File 'lib/morpheus/api/api_client.rb', line 397
def network_pool_servers
Morpheus::NetworkPoolServersInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#network_pools ⇒ Object
389
390
391
|
# File 'lib/morpheus/api/api_client.rb', line 389
def network_pools
Morpheus::NetworkPoolsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#network_proxies ⇒ Object
405
406
407
|
# File 'lib/morpheus/api/api_client.rb', line 405
def network_proxies
Morpheus::NetworkProxiesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#network_services ⇒ Object
393
394
395
|
# File 'lib/morpheus/api/api_client.rb', line 393
def network_services
Morpheus::NetworkServicesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#network_types ⇒ Object
381
382
383
|
# File 'lib/morpheus/api/api_client.rb', line 381
def network_types
Morpheus::NetworkTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#networks ⇒ Object
377
378
379
|
# File 'lib/morpheus/api/api_client.rb', line 377
def networks
Morpheus::NetworksInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#old_cypher ⇒ Object
457
458
459
|
# File 'lib/morpheus/api/api_client.rb', line 457
def old_cypher
Morpheus::OldCypherInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#option_type_lists ⇒ Object
331
332
333
|
# File 'lib/morpheus/api/api_client.rb', line 331
def option_type_lists
Morpheus::OptionTypeListsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#option_types ⇒ Object
327
328
329
|
# File 'lib/morpheus/api/api_client.rb', line 327
def option_types
Morpheus::OptionTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#options ⇒ Object
199
200
201
|
# File 'lib/morpheus/api/api_client.rb', line 199
def options
Morpheus::OptionsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#packages ⇒ Object
449
450
451
|
# File 'lib/morpheus/api/api_client.rb', line 449
def packages
Morpheus::PackagesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#policies ⇒ Object
def incidents
monitoring.incidents
end
365
366
367
|
# File 'lib/morpheus/api/api_client.rb', line 365
def policies
Morpheus::PoliciesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#power_schedules ⇒ Object
339
340
341
|
# File 'lib/morpheus/api/api_client.rb', line 339
def power_schedules
Morpheus::PowerSchedulesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#processes ⇒ Object
469
470
471
|
# File 'lib/morpheus/api/api_client.rb', line 469
def processes
Morpheus::ProcessesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#provision_types ⇒ Object
247
248
249
|
# File 'lib/morpheus/api/api_client.rb', line 247
def provision_types
Morpheus::ProvisionTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#reports ⇒ Object
473
474
475
|
# File 'lib/morpheus/api/api_client.rb', line 473
def reports
Morpheus::ReportsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#roles ⇒ Object
311
312
313
|
# File 'lib/morpheus/api/api_client.rb', line 311
def roles
Morpheus::RolesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#security_group_rules ⇒ Object
287
288
289
|
# File 'lib/morpheus/api/api_client.rb', line 287
def security_group_rules
Morpheus::SecurityGroupRulesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#security_groups ⇒ Object
283
284
285
|
# File 'lib/morpheus/api/api_client.rb', line 283
def security_groups
Morpheus::SecurityGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#server_types ⇒ Object
243
244
245
|
# File 'lib/morpheus/api/api_client.rb', line 243
def server_types
Morpheus::ServerTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#servers ⇒ Object
227
228
229
|
# File 'lib/morpheus/api/api_client.rb', line 227
def servers
Morpheus::ServersInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#set_ssl_verification_enabled(val) ⇒ Object
30
31
32
|
# File 'lib/morpheus/api/api_client.rb', line 30
def set_ssl_verification_enabled(val)
@verify_ssl = !!val
end
|
#setopts(new_options) ⇒ Object
Also known as:
set_options
set common global @options for use with all requests meant for inline use just like dry(), set_options(dry_run:true) can be used in place of dry() Example: Prints curl -XGET …/whoami -H “Bearer” instead of actually request APIClient.new(token).whoami.setopts(curl:true).get({})
55
56
57
58
59
60
61
|
# File 'lib/morpheus/api/api_client.rb', line 55
def setopts(new_options)
@options = new_options
if @options[:dry_run]
dry_run(true)
end
self
end
|
#setup ⇒ Object
347
348
349
|
# File 'lib/morpheus/api/api_client.rb', line 347
def setup
Morpheus::SetupInterface.new(@base_url).setopts(@options).setopts(@options)
end
|
#ssl_verification_enabled? ⇒ Boolean
26
27
28
|
# File 'lib/morpheus/api/api_client.rb', line 26
def ssl_verification_enabled?
@verify_ssl
end
|
#storage_providers ⇒ Object
421
422
423
|
# File 'lib/morpheus/api/api_client.rb', line 421
def storage_providers
Morpheus::StorageProvidersInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#task_sets ⇒ Object
259
260
261
|
# File 'lib/morpheus/api/api_client.rb', line 259
def task_sets
Morpheus::TaskSetsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#tasks ⇒ Object
255
256
257
|
# File 'lib/morpheus/api/api_client.rb', line 255
def tasks
Morpheus::TasksInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#user_groups ⇒ Object
299
300
301
|
# File 'lib/morpheus/api/api_client.rb', line 299
def user_groups
Morpheus::UserGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#user_settings ⇒ Object
195
196
197
|
# File 'lib/morpheus/api/api_client.rb', line 195
def user_settings
Morpheus::UserSettingsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#user_sources ⇒ Object
303
304
305
|
# File 'lib/morpheus/api/api_client.rb', line 303
def user_sources
Morpheus::UserSourcesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#users ⇒ Object
295
296
297
|
# File 'lib/morpheus/api/api_client.rb', line 295
def users
Morpheus::UsersInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#virtual_images ⇒ Object
263
264
265
|
# File 'lib/morpheus/api/api_client.rb', line 263
def virtual_images
Morpheus::VirtualImagesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#whoami ⇒ Object
191
192
193
|
# File 'lib/morpheus/api/api_client.rb', line 191
def whoami
Morpheus::WhoamiInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#wiki ⇒ Object
481
482
483
|
# File 'lib/morpheus/api/api_client.rb', line 481
def wiki
Morpheus::WikiInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
end
|
#withopts(tmp_options, &block) ⇒ Object
Also known as:
with_options
with_options sets common global @options for the duration of the block only then returns the options to their prior values
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/morpheus/api/api_client.rb', line 67
def withopts(tmp_options, &block)
@_old_options = @options
begin
@options = tmp_options
result = block.call()
ensure
@options = @_old_options
end
return result
end
|