Class: Morpheus::APIClient
- Inherits:
-
Object
- Object
- Morpheus::APIClient
show all
- Defined in:
- lib/morpheus/api/api_client.rb
Direct Known Subclasses
AccountGroupsInterface, AccountsInterface, AppTemplatesInterface, AppsInterface, ArchiveBucketsInterface, ArchiveFilesInterface, AuthInterface, BlueprintsInterface, CloudDatastoresInterface, CloudPoliciesInterface, CloudsInterface, ContainersInterface, CustomInstanceTypesInterface, CypherInterface, DashboardInterface, DeployInterface, DeploymentsInterface, 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, NetworksInterface, OptionTypeListsInterface, OptionTypesInterface, OptionsInterface, PackagesInterface, PoliciesInterface, PowerSchedulesInterface, ProcessesInterface, ProvisionTypesInterface, RolesInterface, SecurityGroupRulesInterface, SecurityGroupsInterface, ServersInterface, SetupInterface, StorageProvidersInterface, TaskSetsInterface, TasksInterface, UserGroupsInterface, UserSettingsInterface, UserSourcesInterface, UsersInterface, VirtualImagesInterface, WhoamiInterface
Instance Method Summary
collapse
Constructor Details
#initialize(access_token, refresh_token = nil, expires_in = nil, base_url = nil, verify_ssl = true) ⇒ APIClient
Returns a new instance of APIClient.
6
7
8
9
10
11
12
13
14
|
# 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)
@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)
end
|
Instance Method Details
#account_groups ⇒ Object
76
77
78
|
# File 'lib/morpheus/api/api_client.rb', line 76
def account_groups
Morpheus::AccountGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#accounts ⇒ Object
152
153
154
|
# File 'lib/morpheus/api/api_client.rb', line 152
def accounts
Morpheus::AccountsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#app_templates ⇒ Object
132
133
134
|
# File 'lib/morpheus/api/api_client.rb', line 132
def app_templates
Morpheus::AppTemplatesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#apps ⇒ Object
124
125
126
|
# File 'lib/morpheus/api/api_client.rb', line 124
def apps
Morpheus::AppsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#archive_buckets ⇒ Object
266
267
268
|
# File 'lib/morpheus/api/api_client.rb', line 266
def archive_buckets
Morpheus::ArchiveBucketsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#archive_files ⇒ Object
270
271
272
|
# File 'lib/morpheus/api/api_client.rb', line 270
def archive_files
Morpheus::ArchiveFilesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#auth ⇒ Object
56
57
58
|
# File 'lib/morpheus/api/api_client.rb', line 56
def auth
Morpheus::AuthInterface.new(@base_url, @access_token)
end
|
#blueprints ⇒ Object
128
129
130
|
# File 'lib/morpheus/api/api_client.rb', line 128
def blueprints
Morpheus::BlueprintsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#cloud_datastores ⇒ Object
84
85
86
|
# File 'lib/morpheus/api/api_client.rb', line 84
def cloud_datastores
Morpheus::CloudDatastoresInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#cloud_policies ⇒ Object
234
235
236
|
# File 'lib/morpheus/api/api_client.rb', line 234
def cloud_policies
Morpheus::CloudPoliciesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#clouds ⇒ Object
80
81
82
|
# File 'lib/morpheus/api/api_client.rb', line 80
def clouds
Morpheus::CloudsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#containers ⇒ Object
96
97
98
|
# File 'lib/morpheus/api/api_client.rb', line 96
def containers
Morpheus::ContainersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#custom_instance_types ⇒ Object
#cypher ⇒ Object
310
311
312
|
# File 'lib/morpheus/api/api_client.rb', line 310
def cypher
Morpheus::CypherInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#dashboard ⇒ Object
196
197
198
|
# File 'lib/morpheus/api/api_client.rb', line 196
def dashboard
Morpheus::DashboardInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#deploy ⇒ Object
136
137
138
|
# File 'lib/morpheus/api/api_client.rb', line 136
def deploy
Morpheus::DeployInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#deployments ⇒ Object
140
141
142
|
# File 'lib/morpheus/api/api_client.rb', line 140
def deployments
Morpheus::DeploymentsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#dry ⇒ Object
21
22
23
|
# File 'lib/morpheus/api/api_client.rb', line 21
def dry()
dry_run(true)
end
|
#dry_run(val = true) ⇒ Object
16
17
18
19
|
# File 'lib/morpheus/api/api_client.rb', line 16
def dry_run(val=true)
@dry_run = !!val
self
end
|
#execute(opts, parse_json = true) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/morpheus/api/api_client.rb', line 33
def execute(opts, parse_json=true)
if @verify_ssl == false
opts[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE
end
if @dry_run
return opts
end
response = Morpheus::RestClient.execute(opts)
if parse_json
return JSON.parse(response.to_s)
else
return response
end
end
|
#execute_schedules ⇒ Object
204
205
206
|
# File 'lib/morpheus/api/api_client.rb', line 204
def execute_schedules
Morpheus::ExecuteSchedulesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#execution_request ⇒ Object
314
315
316
|
# File 'lib/morpheus/api/api_client.rb', line 314
def execution_request
Morpheus::ExecutionRequestInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#file_copy_request ⇒ Object
318
319
320
|
# File 'lib/morpheus/api/api_client.rb', line 318
def file_copy_request
Morpheus::FileCopyRequestInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#group_policies ⇒ Object
230
231
232
|
# File 'lib/morpheus/api/api_client.rb', line 230
def group_policies
Morpheus::GroupPoliciesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#groups ⇒ Object
72
73
74
|
# File 'lib/morpheus/api/api_client.rb', line 72
def groups
Morpheus::GroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#image_builder ⇒ Object
274
275
276
|
# File 'lib/morpheus/api/api_client.rb', line 274
def image_builder
Morpheus::ImageBuilderInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#instance_types ⇒ Object
100
101
102
|
# File 'lib/morpheus/api/api_client.rb', line 100
def instance_types
Morpheus::InstanceTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#instances ⇒ Object
92
93
94
|
# File 'lib/morpheus/api/api_client.rb', line 92
def instances
Morpheus::InstancesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#key_pairs ⇒ Object
176
177
178
|
# File 'lib/morpheus/api/api_client.rb', line 176
def key_pairs
Morpheus::KeyPairsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#library_container_scripts ⇒ Object
#library_container_templates ⇒ Object
#library_container_types ⇒ Object
#library_container_upgrades ⇒ Object
#library_instance_types ⇒ Object
#library_layouts ⇒ Object
286
287
288
|
# File 'lib/morpheus/api/api_client.rb', line 286
def library_layouts
Morpheus::LibraryLayoutsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#license ⇒ Object
180
181
182
|
# File 'lib/morpheus/api/api_client.rb', line 180
def license
Morpheus::LicenseInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#load_balancers ⇒ Object
108
109
110
|
# File 'lib/morpheus/api/api_client.rb', line 108
def load_balancers
Morpheus::LoadBalancersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#logs ⇒ Object
168
169
170
|
# File 'lib/morpheus/api/api_client.rb', line 168
def logs
Morpheus::LogsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#monitoring ⇒ Object
212
213
214
|
# File 'lib/morpheus/api/api_client.rb', line 212
def monitoring
Morpheus::MonitoringInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#network_domains ⇒ Object
258
259
260
|
# File 'lib/morpheus/api/api_client.rb', line 258
def network_domains
Morpheus::NetworkDomainsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#network_groups ⇒ Object
242
243
244
|
# File 'lib/morpheus/api/api_client.rb', line 242
def network_groups
Morpheus::NetworkGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#network_pool_servers ⇒ Object
#network_pools ⇒ Object
246
247
248
|
# File 'lib/morpheus/api/api_client.rb', line 246
def network_pools
Morpheus::NetworkPoolsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#network_proxies ⇒ Object
262
263
264
|
# File 'lib/morpheus/api/api_client.rb', line 262
def network_proxies
Morpheus::NetworkProxiesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#network_services ⇒ Object
250
251
252
|
# File 'lib/morpheus/api/api_client.rb', line 250
def network_services
Morpheus::NetworkServicesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#networks ⇒ Object
238
239
240
|
# File 'lib/morpheus/api/api_client.rb', line 238
def networks
Morpheus::NetworksInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#option_type_lists ⇒ Object
192
193
194
|
# File 'lib/morpheus/api/api_client.rb', line 192
def option_type_lists
Morpheus::OptionTypeListsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#option_types ⇒ Object
188
189
190
|
# File 'lib/morpheus/api/api_client.rb', line 188
def option_types
Morpheus::OptionTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#options ⇒ Object
68
69
70
|
# File 'lib/morpheus/api/api_client.rb', line 68
def options
Morpheus::OptionsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#packages ⇒ Object
306
307
308
|
# File 'lib/morpheus/api/api_client.rb', line 306
def packages
Morpheus::PackagesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#policies ⇒ Object
def incidents
monitoring.incidents
end
226
227
228
|
# File 'lib/morpheus/api/api_client.rb', line 226
def policies
Morpheus::PoliciesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#power_schedules ⇒ Object
200
201
202
|
# File 'lib/morpheus/api/api_client.rb', line 200
def power_schedules
Morpheus::PowerSchedulesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#processes ⇒ Object
322
323
324
|
# File 'lib/morpheus/api/api_client.rb', line 322
def processes
Morpheus::ProcessesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#provision_types ⇒ Object
104
105
106
|
# File 'lib/morpheus/api/api_client.rb', line 104
def provision_types
Morpheus::ProvisionTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#roles ⇒ Object
172
173
174
|
# File 'lib/morpheus/api/api_client.rb', line 172
def roles
Morpheus::RolesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#security_group_rules ⇒ Object
#security_groups ⇒ Object
144
145
146
|
# File 'lib/morpheus/api/api_client.rb', line 144
def security_groups
Morpheus::SecurityGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#servers ⇒ Object
88
89
90
|
# File 'lib/morpheus/api/api_client.rb', line 88
def servers
Morpheus::ServersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#set_ssl_verification_enabled(val) ⇒ Object
29
30
31
|
# File 'lib/morpheus/api/api_client.rb', line 29
def set_ssl_verification_enabled(val)
@verify_ssl = !!val
end
|
#ssl_verification_enabled? ⇒ Boolean
25
26
27
|
# File 'lib/morpheus/api/api_client.rb', line 25
def ssl_verification_enabled?
@verify_ssl
end
|
#storage_providers ⇒ Object
278
279
280
|
# File 'lib/morpheus/api/api_client.rb', line 278
def storage_providers
Morpheus::StorageProvidersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#task_sets ⇒ Object
116
117
118
|
# File 'lib/morpheus/api/api_client.rb', line 116
def task_sets
Morpheus::TaskSetsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#tasks ⇒ Object
112
113
114
|
# File 'lib/morpheus/api/api_client.rb', line 112
def tasks
Morpheus::TasksInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#user_groups ⇒ Object
160
161
162
|
# File 'lib/morpheus/api/api_client.rb', line 160
def user_groups
Morpheus::UserGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#user_settings ⇒ Object
64
65
66
|
# File 'lib/morpheus/api/api_client.rb', line 64
def user_settings
Morpheus::UserSettingsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#user_sources ⇒ Object
164
165
166
|
# File 'lib/morpheus/api/api_client.rb', line 164
def user_sources
Morpheus::UserSourcesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#users ⇒ Object
156
157
158
|
# File 'lib/morpheus/api/api_client.rb', line 156
def users
Morpheus::UsersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#virtual_images ⇒ Object
120
121
122
|
# File 'lib/morpheus/api/api_client.rb', line 120
def virtual_images
Morpheus::VirtualImagesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#whoami ⇒ Object
60
61
62
|
# File 'lib/morpheus/api/api_client.rb', line 60
def whoami
Morpheus::WhoamiInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|