kitchen-centurylink 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1821d66ff0a94e3a052c27b42e0501b2aa6f9fb1
4
- data.tar.gz: c8cd6ac814d6dbfebeedd441f4f84ab302eca857
3
+ metadata.gz: 3c1b7b56a75b965b7083266464c9e43b50af14a4
4
+ data.tar.gz: 18189c2362d18b70a272ede67ea17b8e055ce7c9
5
5
  SHA512:
6
- metadata.gz: 7897a40d338de81821764484d0d6ee14e027465c8c0c2313a109d8ad8a249e93a99e91fb8702848e69e909376715bdc4924931bba7dbc746abcbbc58c91a13b7
7
- data.tar.gz: 426af5620cd504d8736a357cb5d63293b0f8748a0b57fea417a1a95d6ccf0586d35320858ca19a163c8ce17e6653038a6199586bb6739cc066445e151284fbe8
6
+ metadata.gz: 3f414724337c3ca213f0d40a226bd26d4c845e4b44ab28cedf0ae1cda42917c5753b9598eae1e616a64735c5caff09189fab188c65e926be799ce4a8b2468246
7
+ data.tar.gz: 4c5fd3ece1a26cc05c3dab7c54f29503c0a1cd47cdb365372a5bba021988e989fad38ed2eb1cbc0460fae1116b8906be08e36ce15b821731fe7185f4a27fc16c
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
- gem 'clc_ruby_api', :path=> "C:/Users/Main/intellij projects/clc-ruby-api"
3
+
4
4
 
data/README.md CHANGED
@@ -4,59 +4,30 @@ A Test Kitchen Driver for Centurylink.
4
4
 
5
5
  ## <a name="requirements"></a> Requirements
6
6
 
7
- You will need a <a href="www.centurylinkcloud.com" >CenturyLink Cloud account</a>s
7
+ You will need a [CenturyLink Cloud](http://centurylinkcloud.com) account
8
8
 
9
9
  ## <a name="installation"></a> Installation and Setup
10
10
 
11
- Please read the [Driver usage][driver_usage] page for more details.
12
-
13
- ## <a name="config"></a> Configuration
14
-
15
- **TODO:** Write descriptions of all configuration options
16
-
17
- ### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
18
-
19
- Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
20
- installed. There are several different behaviors available:
21
-
22
- * `true` - the latest release will be installed. Subsequent converges
23
- will skip re-installing if chef is present.
24
- * `latest` - the latest release will be installed. Subsequent converges
25
- will always re-install even if chef is present.
26
- * `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
27
- be passed the the install.sh script. Subsequent converges will skip if
28
- the installed version and the desired version match.
29
- * `false` or `nil` - no chef is installed.
30
-
31
- The default value is unset, or `nil`.
32
-
33
- ## <a name="development"></a> Development
34
-
35
- * Source hosted at [GitHub][repo]
36
- * Report issues/questions/feature requests on [GitHub Issues][issues]
37
-
38
- Pull requests are very welcome! Make sure your patches are well tested.
39
- Ideally create a topic branch for every separate change you make. For
40
- example:
41
-
42
- 1. Fork the repo
43
- 2. Create your feature branch (`git checkout -b my-new-feature`)
44
- 3. Commit your changes (`git commit -am 'Added some feature'`)
45
- 4. Push to the branch (`git push origin my-new-feature`)
46
- 5. Create new Pull Request
47
-
48
- ## <a name="authors"></a> Authors
49
-
50
- Created and maintained by [TODO: Write your name][author] (<TODO: Write your email>)
51
-
52
- ## <a name="license"></a> License
53
-
54
- Apache 2.0 (see [LICENSE][license])
55
-
56
-
57
- [author]: https://github.com/enter-github-user
58
- [issues]: https://github.com/enter-github-user/kitchen-centurylink/issues
59
- [license]: https://github.com/enter-github-user/kitchen-centurylink/blob/master/LICENSE
60
- [repo]: https://github.com/enter-github-user/kitchen-centurylink
61
- [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
62
- [chef_omnibus_dl]: http://www.getchef.com/chef/install/
11
+ gem install kitchen-centurylink
12
+
13
+ Example .kitchen.yml file:
14
+ ```yaml
15
+ ---
16
+ driver:
17
+ name: centurylink
18
+
19
+ provisioner:
20
+ name: chef_solo
21
+
22
+ platforms:
23
+ - name: ubuntu
24
+ driver_config:
25
+ accountAlias: ALIAS
26
+ groupId: 123456789
27
+ server_name: test
28
+ cpu: 1
29
+ memoryGB: 4
30
+ serverTemplate: UBUNTU-14-64-TEMPLATE
31
+
32
+ ```
33
+ See the [CenturyLink Cloud API documentation](http://www.centurylinkcloud.com/api-docs/v2/#servers-create-server) for more info on how to set these values.
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'test-kitchen', '~> 1.3.1'
22
- spec.add_dependency 'clc_ruby_api'
22
+ spec.add_dependency 'highline'
23
23
 
24
24
  spec.add_development_dependency 'clc_ruby_api'
25
25
  spec.add_development_dependency 'bundler', '~> 1.3'
@@ -17,9 +17,9 @@
17
17
  # limitations under the License.
18
18
 
19
19
  require 'kitchen'
20
- require 'clc_ruby_api.rb'
21
- require "highline/import"
22
- require 'pp'
20
+ require 'clc_client.rb'
21
+ require 'highline/import'
22
+
23
23
  module Kitchen
24
24
 
25
25
  module Driver
@@ -38,31 +38,31 @@ module Kitchen
38
38
  default_config :type, 'standard'
39
39
  default_config :assign_public_ip, false
40
40
 
41
- @@client = ClcRubyApi
41
+ @@client = ClcClient
42
42
 
43
43
  def create(state)
44
44
 
45
45
  if !config[:token] && !state[:token]
46
- puts "No CLC API token was found. Please enter your credentials to have one generated."
46
+ puts 'No CLC API token was found. Please enter your credentials to have one generated.'
47
47
  generateToken(state)
48
48
  end
49
49
 
50
50
  if !config[:groupId]
51
- puts "No groupId was set. Please set groupId in .kitchen.yml and try again"
52
- puts "See --> http://www.centurylinkcloud.com/api-docs/v2/#servers-create-server#request"
53
- raise "Incorrect config"
51
+ puts 'No groupId was set. Please set groupId in .kitchen.yml and try again'
52
+ puts 'See --> http://www.centurylinkcloud.com/api-docs/v2/#servers-create-server#request'
53
+ raise 'Incorrect config'
54
54
  end
55
55
 
56
56
  @@client.setToken(config[:token] || state[:token])
57
57
 
58
58
  queueId = create_server
59
- serverInfo = @@client.getServerDetails(config[:alias], queueId + "?uuid=True")
59
+ serverInfo = @@client.getServerDetails(config[:alias], queueId + '?uuid=True')
60
60
 
61
- info "Checking server status before continuing"
61
+ info 'Checking server status before continuing'
62
62
 
63
- while serverInfo["status"] != "active" do
64
- info "Server not up. Server status is: #{serverInfo["status"]}."
65
- serverInfo = @@client.getServerDetails(config[:alias], queueId + "?uuid=True")
63
+ while serverInfo['status'] != 'active' do
64
+ info "Server not up. Server status is: #{serverInfo['status']}."
65
+ serverInfo = @@client.getServerDetails(config[:alias], queueId + '?uuid=True')
66
66
  sleep 20
67
67
  end
68
68
  info serverInfo
@@ -70,7 +70,7 @@ module Kitchen
70
70
  info "Created server with id #{state[:server_id]}"
71
71
 
72
72
  if config[:assign_public_ip]
73
- info "Assigning public IP"
73
+ info 'Assigning public IP'
74
74
  assign_public_ip(state)
75
75
  else
76
76
  state[:hostname] = serverInfo['details']['ipAddresses'][0]['internal']
@@ -86,14 +86,14 @@ module Kitchen
86
86
  @@client.setToken(config[:token])
87
87
  response = @@client.deleteServer(config[:alias], state[:server_id])
88
88
  if response['isQueued'] == true
89
- info "Delete request is queued up"
89
+ info 'Delete request is queued up'
90
90
  state.delete(:server_id)
91
91
  state.delete(:hostname)
92
92
  end
93
93
  end
94
94
 
95
95
  def create_server
96
- info "Sending create server request"
96
+ info 'Sending create server request'
97
97
  response = @@client.createServer(config[:alias],
98
98
  {
99
99
  :name => config[:server_name],
@@ -116,16 +116,16 @@ module Kitchen
116
116
  end
117
117
  def assign_public_ip(state)
118
118
  response = @@client.addPublicIpAddress(config[:alias], state[:server_id], {
119
- :ports => [ {:protocol => "TCP", :port => 80},
120
- {:protocol => "TCP", :port => 8080},
121
- {:protocol => "TCP", :port => 443},
122
- {:protocol => "TCP", :port => 22},
119
+ :ports => [ {:protocol => 'TCP', :port => 80},
120
+ {:protocol => 'TCP', :port => 8080},
121
+ {:protocol => 'TCP', :port => 443},
122
+ {:protocol => 'TCP', :port => 22},
123
123
  ]})
124
124
  puts response
125
- statusId = response["id"]
125
+ statusId = response['id']
126
126
  status = @@client.getQueueStatus(config[:alias], statusId)
127
127
 
128
- while status["status"] != "succeeded" do
128
+ while status['status'] != 'succeeded' do
129
129
 
130
130
  info "Waiting for public IP job to complete. Status is #{status["status"]}"
131
131
  sleep 20
@@ -138,11 +138,11 @@ module Kitchen
138
138
 
139
139
  def generateToken(state)
140
140
  if !config[:clc_username]
141
- username = ask "Username:"
141
+ username = ask 'Username:'
142
142
  end
143
- password = ask ("Password:") { |q| q.echo = false }
143
+ password = ask ('Password:') { |q| q.echo = false }
144
144
  token = @@client.login username, password
145
- info "Generated new token:"
145
+ info 'Generated new token:'
146
146
  info token
147
147
  info "Save this to your project's .kitchen.yml file to use for future logins"
148
148
 
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Centurylink Kitchen driver
24
- CENTURYLINK_VERSION = "0.1.0"
24
+ CENTURYLINK_VERSION = "0.1.2"
25
25
  end
26
26
  end
@@ -0,0 +1,332 @@
1
+ require "clc_client/version"
2
+ require "rest-client"
3
+
4
+ module ClcClient
5
+
6
+ createServerRequest = {
7
+ :name => "DFT",
8
+ :groupId => "a163d30b196f436aac885f2e28ad28b9",
9
+ :sourceServerId => "UBUNTU-14-64-TEMPLATE",
10
+ :cpu => 1,
11
+ :memoryGB => 2,
12
+ :type => "standard",
13
+ }
14
+
15
+ CLC_API = "https://api.ctl.io"
16
+
17
+ def self.setToken(token)
18
+ $token = token
19
+ end
20
+
21
+ def self.login(username, password)
22
+ begin
23
+ response = RestClient.post("https://api.ctl.io/v2/authentication/login",
24
+ {:username => username,
25
+ :password => password
26
+ }.to_json,
27
+ :content_type => :json, :accept => :json
28
+ )
29
+ rescue => e
30
+ puts e.response
31
+ end
32
+ $token = JSON.parse(response)['bearerToken']
33
+ end
34
+
35
+ def self.getServerDetails(accountAlias, serverId)
36
+ begin
37
+ response = RestClient.get("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}", :authorization => "Bearer #{$token}")
38
+ rescue => e
39
+ puts e
40
+ end
41
+ JSON.parse(response)
42
+ end
43
+
44
+ def self.createServer(accountAlias, payload = {})
45
+ response = RestClient.post("https://api.ctl.io/v2/servers/#{accountAlias}",
46
+ payload.to_json,
47
+ :content_type => :json, :accept => :json,
48
+ :authorization => "Bearer #{$token}"
49
+ )
50
+ puts response
51
+ 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
58
+
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
63
+
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
72
+
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
81
+
82
+ def self.setServerCustomsFields(accountAlias, serverId, payload = {})
83
+ response = RestClient.patch("https://api.ctl.io/v2/servers/#{accountAlias}/#{serverId}",
84
+
85
+ payload.to_json,
86
+ :content_type => :json, :accept => :json,
87
+ :authorization => "Bearer #{$token}"
88
+ )
89
+ JSON.parse(response)
90
+ end
91
+
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
100
+
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
109
+
110
+ def self.getQueueStatus(accountAlias, serverId)
111
+ response = RestClient.get("https://api.ctl.io/v2/operations/#{acctAlias}/status/#{statusId}",
112
+ :authorization => "Bearer #{$token}"
113
+ )
114
+ end
115
+
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
124
+
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
129
+
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
134
+
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
143
+
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
152
+
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
160
+
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
169
+
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
177
+
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
185
+
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
193
+
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
202
+
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
209
+
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,
214
+ :authorization => "Bearer #{$token}")
215
+ JSON.parse(response)
216
+ end
217
+
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
223
+
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
229
+
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
235
+
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
241
+
242
+ def self.setCustomFields(accountAlias, groupId, patchOperation = {})
243
+ response = RestClient.get("https://api.ctl.io/v2/groups/#{accountAlias}/#{groupId}",
244
+ {:patchOperation => patchOperation}.to_json,
245
+ :content_type => :json, :accept => :json,
246
+ :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
+
258
+
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
+
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",
276
+ :authorization => "Bearer #{$token}")
277
+ JSON.parse(response)
278
+ end
279
+
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
285
+
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
291
+
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
297
+
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
303
+
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
311
+
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
319
+
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
325
+
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
331
+
332
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-centurylink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Howell
@@ -26,7 +26,7 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.3.1
28
28
  - !ruby/object:Gem::Dependency
29
- name: clc_ruby_api
29
+ name: highline
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '>='
@@ -143,6 +143,7 @@ files:
143
143
  - kitchen-centurylink.gemspec
144
144
  - lib/kitchen/driver/centurylink.rb
145
145
  - lib/kitchen/driver/centurylink_version.rb
146
+ - lib/kitchen/driver/clc_client.rb
146
147
  homepage: ''
147
148
  licenses:
148
149
  - Apache 2.0