kitchen-centurylink 0.1.2 → 0.1.4

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: 3c1b7b56a75b965b7083266464c9e43b50af14a4
4
- data.tar.gz: 18189c2362d18b70a272ede67ea17b8e055ce7c9
3
+ metadata.gz: 0e9db57b4134bf549e25a2bda0c3c6d576a2e982
4
+ data.tar.gz: e75913754f484cadb53c364df6e8fca107f40ba6
5
5
  SHA512:
6
- metadata.gz: 3f414724337c3ca213f0d40a226bd26d4c845e4b44ab28cedf0ae1cda42917c5753b9598eae1e616a64735c5caff09189fab188c65e926be799ce4a8b2468246
7
- data.tar.gz: 4c5fd3ece1a26cc05c3dab7c54f29503c0a1cd47cdb365372a5bba021988e989fad38ed2eb1cbc0460fae1116b8906be08e36ce15b821731fe7185f4a27fc16c
6
+ metadata.gz: 0719178deb5c019e5a76281aba808014bdab91d765036d30affcdff3b10a23013fcbcd8c8e0de276fd6f3b1f565a1558ea7500a05f1a03eec94bc8bde2028995
7
+ data.tar.gz: 5f8b03ce9bf0a0042712477e4f44b4bac347afa4320c2317eea0711af80511d5a211a9b86f06e55b9890948f6c32bf9f9e58bb424c113450e66509410f8b6af5
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # <a name="title"></a> Kitchen::Centurylink
2
2
 
3
- A Test Kitchen Driver for Centurylink.
3
+ A [Test Kitchen](http://kitchen.ci/) driver for Centurylink Cloud. Spin up, converge, test, and tear down servers on CenturyLink's cloud platform.
4
4
 
5
5
  ## <a name="requirements"></a> Requirements
6
6
 
@@ -20,8 +20,9 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'test-kitchen', '~> 1.3.1'
22
22
  spec.add_dependency 'highline'
23
+ spec.add_dependency 'clc_client', '~> 0.1.1'
23
24
 
24
- spec.add_development_dependency 'clc_ruby_api'
25
+ spec.add_development_dependency 'clc_ruby_api', '~> 0.1.3'
25
26
  spec.add_development_dependency 'bundler', '~> 1.3'
26
27
  spec.add_development_dependency 'rake'
27
28
 
@@ -17,7 +17,7 @@
17
17
  # limitations under the License.
18
18
 
19
19
  require 'kitchen'
20
- require 'clc_client.rb'
20
+ require 'clc_client'
21
21
  require 'highline/import'
22
22
 
23
23
  module Kitchen
@@ -76,14 +76,12 @@ module Kitchen
76
76
  state[:hostname] = serverInfo['details']['ipAddresses'][0]['internal']
77
77
  end
78
78
 
79
-
80
-
81
79
  end
82
80
 
83
81
  def destroy(state)
84
82
  info "Sending delete request for server #{state[:server_id]}"
85
83
 
86
- @@client.setToken(config[:token])
84
+ @@client.setToken(config[:token] || state[:token])
87
85
  response = @@client.deleteServer(config[:alias], state[:server_id])
88
86
  if response['isQueued'] == true
89
87
  info 'Delete request is queued up'
@@ -107,13 +105,11 @@ module Kitchen
107
105
  debug response
108
106
 
109
107
  serverId = response['links'].select {|x| x['rel']=="self"}[0]['id']
108
+ puts "Server request accepted, with request id #{serverId}"
109
+ serverId
110
110
  end
111
111
 
112
- def get_token(state)
113
- puts "Hi"
114
112
 
115
-
116
- end
117
113
  def assign_public_ip(state)
118
114
  response = @@client.addPublicIpAddress(config[:alias], state[:server_id], {
119
115
  :ports => [ {:protocol => 'TCP', :port => 80},
@@ -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.2"
24
+ CENTURYLINK_VERSION = "0.1.4"
25
25
  end
26
26
  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.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Howell
@@ -39,20 +39,34 @@ dependencies:
39
39
  - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: clc_client
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: 0.1.1
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 0.1.1
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: clc_ruby_api
44
58
  requirement: !ruby/object:Gem::Requirement
45
59
  requirements:
46
- - - '>='
60
+ - - ~>
47
61
  - !ruby/object:Gem::Version
48
- version: '0'
62
+ version: 0.1.3
49
63
  type: :development
50
64
  prerelease: false
51
65
  version_requirements: !ruby/object:Gem::Requirement
52
66
  requirements:
53
- - - '>='
67
+ - - ~>
54
68
  - !ruby/object:Gem::Version
55
- version: '0'
69
+ version: 0.1.3
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: bundler
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +157,6 @@ files:
143
157
  - kitchen-centurylink.gemspec
144
158
  - lib/kitchen/driver/centurylink.rb
145
159
  - lib/kitchen/driver/centurylink_version.rb
146
- - lib/kitchen/driver/clc_client.rb
147
160
  homepage: ''
148
161
  licenses:
149
162
  - Apache 2.0
@@ -164,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
177
  version: '0'
165
178
  requirements: []
166
179
  rubyforge_project:
167
- rubygems_version: 2.0.14
180
+ rubygems_version: 2.4.6
168
181
  signing_key:
169
182
  specification_version: 4
170
183
  summary: A Test Kitchen Driver for Centurylink
@@ -1,332 +0,0 @@
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