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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a4813f1a8e30df69925611efa77f5bf07bf773e
4
- data.tar.gz: 45d6b3977f944df716acfba4ebabd51822452a37
3
+ metadata.gz: 99e11b1c736421d2761c8a0f131951a7962a1f5d
4
+ data.tar.gz: 415ecae363fb4a89f33f6231b40ded73120394ab
5
5
  SHA512:
6
- metadata.gz: 000c86548bd0604ab74837a0548550d883f0a5cc7bd15bcbcd3d297b14d37130bc8b1663e1886a6f7b0a1e35dd1fc1be8485e0d308a4facb9cd0fc68062fd634
7
- data.tar.gz: 2012d21159cb0befaef1a0e9aa657b446e417aab4fd30e65177b7e0960ab77ae4401f8e30ce2ec42a2517ad433b3785f14c24eff3a5e8627634a41ca665c188f
6
+ metadata.gz: b7f2456f77b7e79c1758e51dfe4b5dbbcf3e8f9d8da6a80a3fc2484e6c2b8b81f8a172a61be189e0c50f147eed352b403a654794acb249474717eaeee77fced2
7
+ data.tar.gz: 4209b64ab4153321679e101fb53cf0dc4bf145b727b7c439237f5b2879a9c9302f4f26cab92734c0197874b94c7b03d82912f6824342f3f31a963ac8365c3829
@@ -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
- end
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
- def self.getServerCredentials(accountAlias, serverId)
60
- response = RestClient.get("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}/credentials", :authorization => "Bearer #{$token}")
61
- JSON.parse(response)
62
- end
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
- def self.setServerCpuOrMemory(accountAlias, serverId, payload = {})
65
- response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
66
- payload.to_json,
67
- :content_type => :json,
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
- def self.setServerCredentials(accountAlias, serverId, payload = {})
74
- response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
75
- payload.to_json,
76
- :content_type => :json, :accept => :json,
77
- :authorization => "Bearer #{$token}"
78
- )
79
- JSON.parse(response)
80
- end
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
- def self.setServerCustomsFields(accountAlias, serverId, payload = {})
83
- response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
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
- payload.to_json,
86
- :content_type => :json, :accept => :json,
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
- def self.setServerDescriptionOrGroup(accountAlias, serverId, payload = {})
93
- response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
94
- payload.to_json,
95
- :content_type => :json, :accept => :json,
96
- :authorization => "Bearer #{$token}"
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
- def self.setServerDisks(accountAlias, serverId, payload = {})
102
- response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
103
- payload.to_json,
104
- :content_type => :json, :accept => :json,
105
- :authorization => "Bearer #{$token}"
106
- )
107
- JSON.parse(response)
108
- end
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
- def self.getQueueStatus(accountAlias, serverId)
111
- response = RestClient.get("https://api.ctl.io/v2/operations/#{accountAlias}/status/#{serverId}",
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
- end
106
+ JSON.parse(response)
107
+ end
115
108
 
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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
- end
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
- def self.executePackage(accountAlias, payload = {})
162
- response = RestClient.post("https://api.ctl.io/v2/operations/#{accountAlias}/servers/executePackage",
163
- payload.to_json,
164
- :content_type => :json, :accept => :json,
165
- :authorization => "Bearer #{$token}"
166
- )
167
- JSON.parse(response)
168
- end
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
- def self.restoreServer(accountAlias, targetGroupId)
171
- response = RestClient.post("https://api.ctl.io/v2/servers/{accountAlias}/{serverId}/restore",
172
- {:targetGroupId => targetGroupId}.to_json,
173
- :content_type => :json, :accept => :json,
174
- :authorization => "Bearer #{$token}")
175
- JSON.parse(response)
176
- end
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
- def self.setPowerOperation(accountAlias, powerOperation, serverIds = {})
179
- response = RestClient.post("https://api.ctl.io/v2/operations/#{accountAlias}/servers/#{powerOperation}",
180
- {:serverIds => serverIds}.to_json,
181
- :content_type => :json, :accept => :json,
182
- :authorization => "Bearer #{$token}")
183
- JSON.parse(response)
184
- end
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
- def self.setMaintenanceMode(accountAlias, servers = {})
187
- response = RestClient.post("https://api.ctl.io/v2/operations/#{accountAlias}/servers/setMaintenance",
188
- servers.to_json,
189
- :content_type => :json, :accept => :json,
190
- :authorization => "Bearer #{$token}")
191
- JSON.parse(response)
192
- end
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
- def self.archiveGroup(accountAlias, groupId, payload = {})
195
- response = RestClient.post("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/archive",
196
- payload.to_json,
197
- :content_type => :json, :accept => :json,
198
- :authorization => authorization
199
- )
200
- JSON.parse(response)
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
- def self.restoreGroup(accountAlias, groupId, targetGroupId)
204
- response = RestClient.post("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/restore",
205
- {:targetGroupId => targetGroupId}.to_json,
206
- :content_type => :json, :accept => :json,
207
- :authorization => "Bearer #{$token}")
208
- end
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
- def self.createGroup(accountAlias, payload)
211
- response = RestClient.post("https://api.ctl.io/v2/groups/#{accountAlias}",
212
- payload.to_json,
213
- :content_type => :json, :accept => :json,
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
- JSON.parse(response)
216
- end
223
+ JSON.parse(response)
224
+ end
217
225
 
218
- def self.deleteGroup(accountAlias, groupId)
219
- response = RestClient.delete("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
220
- :authorization => "Bearer #{$token}")
221
- JSON.parse(response)
222
- end
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
- def self.getGroup(accountAlias, groupId)
225
- response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
226
- :authorization => "Bearer #{$token}")
227
- JSON.parse(response)
228
- end
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
- def self.getGroupBillingDetails(accountAlias, groupId)
231
- response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/billing",
232
- :authorization => authorization)
233
- JSON.parse(response)
234
- end
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
- def self.getGroupMonitorinfStatistics(accountAlias, groupId)
237
- response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}/statistics?start=#{datetime}&sampleInterval=dd:hh:mm:ss",
238
- :authorization => "Bearer #{$token}")
239
- JSON.parse(response)
240
- end
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
- def self.setCustomFields(accountAlias, groupId, patchOperation = {})
243
- response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
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
- JSON.parse(response)
248
- end
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
- def self.getCustomGroups(accountAlias)
268
- response = RestClient.get("https://api.ctl.io/v2/accounts/#{accountAlias}/customFields",
269
- :authorization => "Bearer #{$token}"
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
- JSON.parse(response)
278
- end
266
+ JSON.parse(response)
267
+ end
279
268
 
280
- def self.getDataCentereploymentCapalities(accountAlias, datacenter)
281
- response = RestClient.get("https://api.ctl.io/v2/datacenters/#{accountAlias}/#{dataCenter}/deploymentCapabilities",
282
- :authorization => "Bearer #{$token}")
283
- JSON.parse(response)
284
- end
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
- def self.getDataCenterList(accountAlias)
287
- response = RestClient.get("https://api.ctl.io/v2/datacenters/#{accountAlias}",
288
- :authorization => "Bearer #{$token}")
289
- JSON.parse(response)
290
- end
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
- def self.getCustomFields(accountAlias)
293
- response = RestClient.get("https://api.ctl.io/v2/accounts/#{accountAlias}/customFields",
294
- :authorization => "Bearer #{$token}")
295
- JSON.parse(response)
296
- end
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
- def self.createAntiAffinityPolicy(accountAlias)
299
- response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}",
300
- :authorization => "Bearer #{$token}")
301
- JSON.parse(response)
302
- end
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
- def self.deleteAntiAffinityPolicy(accountAlias, policyId, payload = {})
305
- response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}/#{policyId}",
306
- payload.to_json,
307
- :content_type => :json, :accept => :json,
308
- :authorization => "Bearer #{$token}")
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
- def self.updateAntiAffinityPolicy(accountAlias, policyId, name)
313
- response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}/#{policyId}",
314
- {:name => name}.to_json,
315
- :content_type => :json, :accept => :json,
316
- :authorization => "Bearer #{$token}")
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
- def self.getAntiAffinityPolicy(accountAlias, policyId)
321
- response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}/#{policyId}",
322
- :authorization => "Bearer #{$token}")
323
- JSON.parse(response)
324
- end
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
- def self.getAntiAffinityPolicies(accountAlias)
327
- response = RestClient.get("https://api.ctl.io/v2/antiAffinityPolicies/#{accountAlias}",
328
- :authorization => "Bearer #{$token}")
329
- JSON.parse(response)
330
- end
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
@@ -1,3 +1,3 @@
1
1
  module ClcClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clc_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hinds