clc_client 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clc_client.rb +240 -238
- data/lib/clc_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99e11b1c736421d2761c8a0f131951a7962a1f5d
|
4
|
+
data.tar.gz: 415ecae363fb4a89f33f6231b40ded73120394ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f2456f77b7e79c1758e51dfe4b5dbbcf3e8f9d8da6a80a3fc2484e6c2b8b81f8a172a61be189e0c50f147eed352b403a654794acb249474717eaeee77fced2
|
7
|
+
data.tar.gz: 4209b64ab4153321679e101fb53cf0dc4bf145b727b7c439237f5b2879a9c9302f4f26cab92734c0197874b94c7b03d82912f6824342f3f31a963ac8365c3829
|
data/lib/clc_client.rb
CHANGED
@@ -13,7 +13,7 @@ module ClcClient
|
|
13
13
|
}
|
14
14
|
|
15
15
|
CLC_API = "https://api.ctl.io"
|
16
|
-
|
16
|
+
|
17
17
|
def self.setToken(token)
|
18
18
|
$token = token
|
19
19
|
end
|
@@ -47,286 +47,288 @@ module ClcClient
|
|
47
47
|
:content_type => :json, :accept => :json,
|
48
48
|
:authorization => "Bearer #{$token}"
|
49
49
|
)
|
50
|
-
puts response
|
51
50
|
JSON.parse(response)
|
52
|
-
|
53
|
-
|
54
|
-
def self.deleteServer(accountAlias, serverId)
|
55
|
-
response = RestClient.delete("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}", :authorization => "Bearer #{$token}")
|
56
|
-
JSON.parse(response)
|
57
|
-
end
|
51
|
+
end
|
58
52
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
53
|
+
def self.deleteServer(accountAlias, serverId)
|
54
|
+
response = RestClient.delete("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}", :authorization => "Bearer #{$token}")
|
55
|
+
JSON.parse(response)
|
56
|
+
end
|
63
57
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
:accept => :json,
|
69
|
-
:authorization => "Bearer #{$token}")
|
70
|
-
JSON.parse(response)
|
71
|
-
end
|
58
|
+
def self.getServerCredentials(accountAlias, serverId)
|
59
|
+
response = RestClient.get("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}/credentials", :authorization => "Bearer #{$token}")
|
60
|
+
JSON.parse(response)
|
61
|
+
end
|
72
62
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
63
|
+
def self.setServerCpuOrMemory(accountAlias, serverId, payload = {})
|
64
|
+
response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
|
65
|
+
payload.to_json,
|
66
|
+
:content_type => :json,
|
67
|
+
:accept => :json,
|
68
|
+
:authorization => "Bearer #{$token}")
|
69
|
+
JSON.parse(response)
|
70
|
+
end
|
81
71
|
|
82
|
-
|
83
|
-
|
72
|
+
def self.setServerCredentials(accountAlias, serverId, payload = {})
|
73
|
+
response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
|
74
|
+
payload.to_json,
|
75
|
+
:content_type => :json, :accept => :json,
|
76
|
+
:authorization => "Bearer #{$token}"
|
77
|
+
)
|
78
|
+
JSON.parse(response)
|
79
|
+
end
|
84
80
|
|
85
|
-
|
86
|
-
|
87
|
-
:authorization => "Bearer #{$token}"
|
88
|
-
)
|
89
|
-
JSON.parse(response)
|
90
|
-
end
|
81
|
+
def self.setServerCustomsFields(accountAlias, serverId, payload = {})
|
82
|
+
response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
|
91
83
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
JSON.parse(response)
|
99
|
-
end
|
84
|
+
payload.to_json,
|
85
|
+
:content_type => :json, :accept => :json,
|
86
|
+
:authorization => "Bearer #{$token}"
|
87
|
+
)
|
88
|
+
JSON.parse(response)
|
89
|
+
end
|
100
90
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
91
|
+
def self.setServerDescriptionOrGroup(accountAlias, serverId, payload = {})
|
92
|
+
response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
|
93
|
+
payload.to_json,
|
94
|
+
:content_type => :json, :accept => :json,
|
95
|
+
:authorization => "Bearer #{$token}"
|
96
|
+
)
|
97
|
+
JSON.parse(response)
|
98
|
+
end
|
109
99
|
|
110
|
-
|
111
|
-
|
100
|
+
def self.setServerDisks(accountAlias, serverId, payload = {})
|
101
|
+
response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
|
102
|
+
payload.to_json,
|
103
|
+
:content_type => :json, :accept => :json,
|
112
104
|
:authorization => "Bearer #{$token}"
|
113
105
|
)
|
114
|
-
|
106
|
+
JSON.parse(response)
|
107
|
+
end
|
115
108
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
JSON.parse(response)
|
123
|
-
end
|
109
|
+
def self.getQueueStatus(accountAlias, serverId)
|
110
|
+
response = RestClient.get("https://api.ctl.io/v2/operations/#{accountAlias}/status/#{serverId}",
|
111
|
+
:authorization => "Bearer #{$token}"
|
112
|
+
)
|
113
|
+
JSON.parse(response)
|
114
|
+
end
|
124
115
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
116
|
+
def self.addPublicIpAddress(accountAlias, serverId, payload = {})
|
117
|
+
response = RestClient.post("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}/publicIPAddresses",
|
118
|
+
payload.to_json,
|
119
|
+
:content_type => :json, :accept => :json,
|
120
|
+
:authorization => "Bearer #{$token}"
|
121
|
+
)
|
122
|
+
JSON.parse(response)
|
123
|
+
end
|
129
124
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
125
|
+
def self.getPublicIpAddress(accountAlias, serverId, publicIP)
|
126
|
+
response = RestClient.get("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}/publicIPAddresses/#{publicIP}", :authorization => "Bearer #{$token}")
|
127
|
+
JSON.parse(response)
|
128
|
+
end
|
134
129
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
:authorization => "Bearer #{$token}"
|
140
|
-
)
|
141
|
-
JSON.parse(response)
|
142
|
-
end
|
130
|
+
def self.deletePublicIpAddress(accountAlias, serverId, publicIP)
|
131
|
+
response = RestClient.get("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}/publicIPAddresses/#{publicIP}", :authorization => "Bearer #{$token}")
|
132
|
+
JSON.parse(response)
|
133
|
+
end
|
143
134
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
135
|
+
def self.updatePublicIpAddress(accountAlias, serverId, publicIP, payload = {})
|
136
|
+
response = RestClient.post("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}/publicIPAddresses",
|
137
|
+
payload.to_json,
|
138
|
+
:content_type => :json, :accept => :json,
|
139
|
+
:authorization => "Bearer #{$token}"
|
140
|
+
)
|
141
|
+
JSON.parse(response)
|
142
|
+
end
|
152
143
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
144
|
+
def self.archiveServer(accountAlias, serverIds = {})
|
145
|
+
response = RestClient.post("https://api.ctl.io/v2/operations/#{accountAlias}/servers/archive",
|
146
|
+
serversIds.to_json,
|
147
|
+
:content_type => :json, :accept => :json,
|
148
|
+
:authorization => "Bearer #{$token}"
|
149
|
+
)
|
150
|
+
JSON.parse(response)
|
151
|
+
end
|
160
152
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
153
|
+
def self.createSnapshot(accountAlias, payload = {})
|
154
|
+
response = RestClient.post("https://api.ctl.io/v2/operations/{accountAlias}/servers/createSnapshot",
|
155
|
+
payload.to_json,
|
156
|
+
:content_type => :json, :accept => :json,
|
157
|
+
:authorization => "Bearer #{$token}"
|
158
|
+
)
|
159
|
+
JSON.parse(response)
|
160
|
+
end
|
169
161
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
162
|
+
def self.executePackage(accountAlias, payload = {})
|
163
|
+
response = RestClient.post("https://api.ctl.io/v2/operations/#{accountAlias}/servers/executePackage",
|
164
|
+
payload.to_json,
|
165
|
+
:content_type => :json, :accept => :json,
|
166
|
+
:authorization => "Bearer #{$token}"
|
167
|
+
)
|
168
|
+
JSON.parse(response)
|
169
|
+
end
|
177
170
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
171
|
+
def self.restoreServer(accountAlias, targetGroupId)
|
172
|
+
response = RestClient.post("https://api.ctl.io/v2/servers/{accountAlias}/{serverId}/restore",
|
173
|
+
{:targetGroupId => targetGroupId}.to_json,
|
174
|
+
:content_type => :json, :accept => :json,
|
175
|
+
:authorization => "Bearer #{$token}")
|
176
|
+
JSON.parse(response)
|
177
|
+
end
|
185
178
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
179
|
+
def self.setPowerOperation(accountAlias, powerOperation, serverIds = {})
|
180
|
+
response = RestClient.post("https://api.ctl.io/v2/operations/#{accountAlias}/servers/#{powerOperation}",
|
181
|
+
{:serverIds => serverIds}.to_json,
|
182
|
+
:content_type => :json, :accept => :json,
|
183
|
+
:authorization => "Bearer #{$token}")
|
184
|
+
JSON.parse(response)
|
185
|
+
end
|
193
186
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
end
|
187
|
+
def self.setMaintenanceMode(accountAlias, servers = {})
|
188
|
+
response = RestClient.post("https://api.ctl.io/v2/operations/#{accountAlias}/servers/setMaintenance",
|
189
|
+
servers.to_json,
|
190
|
+
:content_type => :json, :accept => :json,
|
191
|
+
:authorization => "Bearer #{$token}")
|
192
|
+
JSON.parse(response)
|
193
|
+
end
|
202
194
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
195
|
+
def self.archiveGroup(accountAlias, groupId, payload = {})
|
196
|
+
response = RestClient.post("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/archive",
|
197
|
+
payload.to_json,
|
198
|
+
:content_type => :json, :accept => :json,
|
199
|
+
:authorization => authorization
|
200
|
+
)
|
201
|
+
JSON.parse(response)
|
202
|
+
end
|
203
|
+
|
204
|
+
def self.restoreGroup(accountAlias, groupId, targetGroupId)
|
205
|
+
response = RestClient.post("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/restore",
|
206
|
+
{:targetGroupId => targetGroupId}.to_json,
|
207
|
+
:content_type => :json, :accept => :json,
|
208
|
+
:authorization => "Bearer #{$token}")
|
209
|
+
JSON.parse(response)
|
210
|
+
end
|
209
211
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
212
|
+
def self.createGroup(accountAlias, payload)
|
213
|
+
response = RestClient.post("https://api.ctl.io/v2/groups/#{accountAlias}",
|
214
|
+
payload.to_json,
|
215
|
+
:content_type => :json, :accept => :json,
|
216
|
+
:authorization => "Bearer #{$token}")
|
217
|
+
JSON.parse(response)
|
218
|
+
end
|
219
|
+
|
220
|
+
def self.deleteGroup(accountAlias, groupId)
|
221
|
+
response = RestClient.delete("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
|
214
222
|
:authorization => "Bearer #{$token}")
|
215
|
-
|
216
|
-
|
223
|
+
JSON.parse(response)
|
224
|
+
end
|
217
225
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
226
|
+
def self.getGroup(accountAlias, groupId)
|
227
|
+
response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
|
228
|
+
:authorization => "Bearer #{$token}")
|
229
|
+
JSON.parse(response)
|
230
|
+
end
|
223
231
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
232
|
+
def self.getGroupBillingDetails(accountAlias, groupId)
|
233
|
+
response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/billing",
|
234
|
+
:authorization => authorization)
|
235
|
+
JSON.parse(response)
|
236
|
+
end
|
229
237
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
238
|
+
def self.getGroupMonitorinfStatistics(accountAlias, groupId)
|
239
|
+
response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/statistics?start=#{datetime}&sampleInterval=dd:hh:mm:ss",
|
240
|
+
:authorization => "Bearer #{$token}")
|
241
|
+
JSON.parse(response)
|
242
|
+
end
|
235
243
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
244
|
+
def self.setCustomFields(accountAlias, groupId, patchOperation = {})
|
245
|
+
response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
|
246
|
+
{:patchOperation => patchOperation}.to_json,
|
247
|
+
:content_type => :json, :accept => :json,
|
248
|
+
:authorization => "Bearer #{$token}")
|
249
|
+
JSON.parse(response)
|
250
|
+
end
|
241
251
|
|
242
|
-
|
243
|
-
|
252
|
+
def self.setGroupNameOrDescription(accountAlias, groupId, patchOperation = {})
|
253
|
+
response = RestClient.patch("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
|
244
254
|
{:patchOperation => patchOperation}.to_json,
|
245
255
|
:content_type => :json, :accept => :json,
|
246
256
|
:authorization => "Bearer #{$token}")
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
def self.setGroupNameOrDescription(accountAlias, groupId, patchOperation = {})
|
251
|
-
response = RestClient.patch("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
|
252
|
-
{:patchOperation => patchOperation}.to_json,
|
253
|
-
:content_type => :json, :accept => :json,
|
254
|
-
:authorization => "Bearer #{$token}")
|
255
|
-
JSON.parse(response)
|
256
|
-
end
|
257
|
-
|
257
|
+
JSON.parse(response)
|
258
|
+
end
|
258
259
|
|
259
|
-
def self.setGroupParent(accountAlias, groupId, patchOperation = {})
|
260
|
-
response = RestClient.patch("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
|
261
|
-
{:patchOperation => patchOperation}.to_json,
|
262
|
-
:content_type => :json, :accept => :json,
|
263
|
-
:authorization => "Bearer #{$token}")
|
264
|
-
JSON.parse(response)
|
265
|
-
end
|
266
260
|
|
267
|
-
|
268
|
-
|
269
|
-
:
|
270
|
-
|
271
|
-
JSON.parse(response)
|
272
|
-
end
|
273
|
-
|
274
|
-
def self.getDataCenter(accountAlias, dataCenter)
|
275
|
-
response = RestClient.get("https://api.ctl.io/v2/datacenters/#{accountAlias}/#{dataCenter}?groupLinks=true|false",
|
261
|
+
def self.setGroupParent(accountAlias, groupId, patchOperation = {})
|
262
|
+
response = RestClient.patch("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
|
263
|
+
{:patchOperation => patchOperation}.to_json,
|
264
|
+
:content_type => :json, :accept => :json,
|
276
265
|
:authorization => "Bearer #{$token}")
|
277
|
-
|
278
|
-
|
266
|
+
JSON.parse(response)
|
267
|
+
end
|
279
268
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
269
|
+
def self.getCustomGroups(accountAlias)
|
270
|
+
response = RestClient.get("https://api.ctl.io/v2/accounts/#{accountAlias}/customFields",
|
271
|
+
:authorization => "Bearer #{$token}"
|
272
|
+
)
|
273
|
+
JSON.parse(response)
|
274
|
+
end
|
285
275
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
276
|
+
def self.getDataCenter(accountAlias, dataCenter)
|
277
|
+
response = RestClient.get("https://api.ctl.io/v2/datacenters/#{accountAlias}/#{dataCenter}?groupLinks=true|false",
|
278
|
+
:authorization => "Bearer #{$token}")
|
279
|
+
JSON.parse(response)
|
280
|
+
end
|
291
281
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
282
|
+
def self.getDataCentereploymentCapalities(accountAlias, datacenter)
|
283
|
+
response = RestClient.get("https://api.ctl.io/v2/datacenters/#{accountAlias}/#{dataCenter}/deploymentCapabilities",
|
284
|
+
:authorization => "Bearer #{$token}")
|
285
|
+
JSON.parse(response)
|
286
|
+
end
|
297
287
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
288
|
+
def self.getDataCenterList(accountAlias)
|
289
|
+
response = RestClient.get("https://api.ctl.io/v2/datacenters/#{accountAlias}",
|
290
|
+
:authorization => "Bearer #{$token}")
|
291
|
+
JSON.parse(response)
|
292
|
+
end
|
303
293
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
JSON.parse(response)
|
310
|
-
end
|
294
|
+
def self.getCustomFields(accountAlias)
|
295
|
+
response = RestClient.get("https://api.ctl.io/v2/accounts/#{accountAlias}/customFields",
|
296
|
+
:authorization => "Bearer #{$token}")
|
297
|
+
JSON.parse(response)
|
298
|
+
end
|
311
299
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
JSON.parse(response)
|
318
|
-
end
|
300
|
+
def self.createAntiAffinityPolicy(accountAlias)
|
301
|
+
response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}",
|
302
|
+
:authorization => "Bearer #{$token}")
|
303
|
+
JSON.parse(response)
|
304
|
+
end
|
319
305
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
306
|
+
def self.deleteAntiAffinityPolicy(accountAlias, policyId, payload = {})
|
307
|
+
response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}/#{policyId}",
|
308
|
+
payload.to_json,
|
309
|
+
:content_type => :json, :accept => :json,
|
310
|
+
:authorization => "Bearer #{$token}")
|
311
|
+
JSON.parse(response)
|
312
|
+
end
|
325
313
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
314
|
+
def self.updateAntiAffinityPolicy(accountAlias, policyId, name)
|
315
|
+
response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}/#{policyId}",
|
316
|
+
{:name => name}.to_json,
|
317
|
+
:content_type => :json, :accept => :json,
|
318
|
+
:authorization => "Bearer #{$token}")
|
319
|
+
JSON.parse(response)
|
320
|
+
end
|
321
|
+
|
322
|
+
def self.getAntiAffinityPolicy(accountAlias, policyId)
|
323
|
+
response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}/#{policyId}",
|
324
|
+
:authorization => "Bearer #{$token}")
|
325
|
+
JSON.parse(response)
|
326
|
+
end
|
331
327
|
|
328
|
+
def self.getAntiAffinityPolicies(accountAlias)
|
329
|
+
response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}",
|
330
|
+
:authorization => "Bearer #{$token}")
|
331
|
+
JSON.parse(response)
|
332
332
|
end
|
333
|
+
|
334
|
+
end
|
data/lib/clc_client/version.rb
CHANGED