Class: Morpheus::APIClient
- Inherits:
-
Object
- Object
- Morpheus::APIClient
show all
- Defined in:
- lib/morpheus/api/api_client.rb
Direct Known Subclasses
AccountsInterface, AppTemplatesInterface, AppsInterface, ArchiveBucketsInterface, ArchiveFilesInterface, AuthInterface, ChecksInterface, CloudsInterface, ContainersInterface, CustomInstanceTypesInterface, DashboardInterface, DeployInterface, DeploymentsInterface, GroupsInterface, ImageBuilderBootScriptsInterface, ImageBuilderImageBuildsInterface, ImageBuilderInterface, ImageBuilderPreseedScriptsInterface, IncidentsInterface, InstanceTypesInterface, InstancesInterface, KeyPairsInterface, LicenseInterface, LoadBalancersInterface, LogsInterface, MonitoringAppsInterface, MonitoringContactsInterface, MonitoringGroupsInterface, MonitoringInterface, OptionTypeListsInterface, OptionTypesInterface, OptionsInterface, ProvisionTypesInterface, RolesInterface, SecurityGroupRulesInterface, SecurityGroupsInterface, ServersInterface, SetupInterface, TaskSetsInterface, TasksInterface, 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
#accounts ⇒ Object
136
137
138
|
# File 'lib/morpheus/api/api_client.rb', line 136
def accounts
Morpheus::AccountsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#app_templates ⇒ Object
116
117
118
|
# File 'lib/morpheus/api/api_client.rb', line 116
def app_templates
Morpheus::AppTemplatesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#apps ⇒ Object
112
113
114
|
# File 'lib/morpheus/api/api_client.rb', line 112
def apps
Morpheus::AppsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#archive_buckets ⇒ Object
def incidents
monitoring.incidents
end
194
195
196
|
# File 'lib/morpheus/api/api_client.rb', line 194
def archive_buckets
Morpheus::ArchiveBucketsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#archive_files ⇒ Object
198
199
200
|
# File 'lib/morpheus/api/api_client.rb', line 198
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
|
#clouds ⇒ Object
72
73
74
|
# File 'lib/morpheus/api/api_client.rb', line 72
def clouds
Morpheus::CloudsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#containers ⇒ Object
84
85
86
|
# File 'lib/morpheus/api/api_client.rb', line 84
def containers
Morpheus::ContainersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#custom_instance_types ⇒ Object
#dashboard ⇒ Object
172
173
174
|
# File 'lib/morpheus/api/api_client.rb', line 172
def dashboard
Morpheus::DashboardInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#deploy ⇒ Object
120
121
122
|
# File 'lib/morpheus/api/api_client.rb', line 120
def deploy
Morpheus::DeployInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#deployments ⇒ Object
124
125
126
|
# File 'lib/morpheus/api/api_client.rb', line 124
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
|
#groups ⇒ Object
68
69
70
|
# File 'lib/morpheus/api/api_client.rb', line 68
def groups
Morpheus::GroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#image_builder ⇒ Object
202
203
204
|
# File 'lib/morpheus/api/api_client.rb', line 202
def image_builder
Morpheus::ImageBuilderInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#instance_types ⇒ Object
88
89
90
|
# File 'lib/morpheus/api/api_client.rb', line 88
def instance_types
Morpheus::InstanceTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#instances ⇒ Object
80
81
82
|
# File 'lib/morpheus/api/api_client.rb', line 80
def instances
Morpheus::InstancesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#key_pairs ⇒ Object
152
153
154
|
# File 'lib/morpheus/api/api_client.rb', line 152
def key_pairs
Morpheus::KeyPairsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#license ⇒ Object
156
157
158
|
# File 'lib/morpheus/api/api_client.rb', line 156
def license
Morpheus::LicenseInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#load_balancers ⇒ Object
96
97
98
|
# File 'lib/morpheus/api/api_client.rb', line 96
def load_balancers
Morpheus::LoadBalancersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#logs ⇒ Object
144
145
146
|
# File 'lib/morpheus/api/api_client.rb', line 144
def logs
Morpheus::LogsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#monitoring ⇒ Object
180
181
182
|
# File 'lib/morpheus/api/api_client.rb', line 180
def monitoring
Morpheus::MonitoringInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#option_type_lists ⇒ Object
168
169
170
|
# File 'lib/morpheus/api/api_client.rb', line 168
def option_type_lists
Morpheus::OptionTypeListsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#option_types ⇒ Object
164
165
166
|
# File 'lib/morpheus/api/api_client.rb', line 164
def option_types
Morpheus::OptionTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#options ⇒ Object
64
65
66
|
# File 'lib/morpheus/api/api_client.rb', line 64
def options
Morpheus::OptionsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#provision_types ⇒ Object
92
93
94
|
# File 'lib/morpheus/api/api_client.rb', line 92
def provision_types
Morpheus::ProvisionTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#roles ⇒ Object
148
149
150
|
# File 'lib/morpheus/api/api_client.rb', line 148
def roles
Morpheus::RolesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#security_group_rules ⇒ Object
#security_groups ⇒ Object
128
129
130
|
# File 'lib/morpheus/api/api_client.rb', line 128
def security_groups
Morpheus::SecurityGroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#servers ⇒ Object
76
77
78
|
# File 'lib/morpheus/api/api_client.rb', line 76
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
|
#task_sets ⇒ Object
104
105
106
|
# File 'lib/morpheus/api/api_client.rb', line 104
def task_sets
Morpheus::TaskSetsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#tasks ⇒ Object
100
101
102
|
# File 'lib/morpheus/api/api_client.rb', line 100
def tasks
Morpheus::TasksInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#users ⇒ Object
140
141
142
|
# File 'lib/morpheus/api/api_client.rb', line 140
def users
Morpheus::UsersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
end
|
#virtual_images ⇒ Object
108
109
110
|
# File 'lib/morpheus/api/api_client.rb', line 108
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
|