rancher-management_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +262 -0
- data/Rakefile +6 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/lib/rancher/management_api/api_key.rb +20 -0
- data/lib/rancher/management_api/manager.rb +15 -0
- data/lib/rancher/management_api/project.rb +31 -0
- data/lib/rancher/management_api/token.rb +30 -0
- data/lib/rancher/management_api/version.rb +5 -0
- data/lib/rancher/management_api.rb +20 -0
- data/lib/rancher-management_api.rb +1 -0
- data/rancher-management_api.gemspec +29 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dda5f9e739b125714ed5d9a9d97fd0ca98f2cfcb
|
4
|
+
data.tar.gz: deeb646c6177712fa9d37a6232ce4d07b0fb0cc1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f549bc9354c9032b6bc8856c036399fab0f876bd17d128041706eea3536ab5b15e4001a962a9c1a50c5a2b951e69eca10d2a9e565d81da22e106e14facaeb981
|
7
|
+
data.tar.gz: 45343165ba1269aa33e18234d91b4730bf4b52cae2ed3c15920f949b7c83b0ce0f6edde7ae345f27204a77fd5647d66719ad84bc004eccf9b721b558d1eeafa7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Donald Plummer
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
# Docs and scripts on how to Rancher
|
2
|
+
|
3
|
+
To use the `bin/console` script, set these env vars:
|
4
|
+
```
|
5
|
+
RANCHER_URL
|
6
|
+
RANCHER_ACCESS_KEY
|
7
|
+
RANCHER_SECRET_KEY
|
8
|
+
```
|
9
|
+
|
10
|
+
To create a new environment (known as a `project` to the API):
|
11
|
+
|
12
|
+
(Hint: `brew install jq` for pretty output)
|
13
|
+
|
14
|
+
Get a real username and password:
|
15
|
+
user: apiuser
|
16
|
+
pass: rancher
|
17
|
+
|
18
|
+
Ask for a JSON Web Token
|
19
|
+
|
20
|
+
```
|
21
|
+
curl 'http://localhost:8080/v1/token' \
|
22
|
+
-H 'Origin: http://localhost:8080' \
|
23
|
+
-H 'Accept-Encoding: gzip, deflate' \
|
24
|
+
-H 'Accept-Language: en-US,en;q=0.8' \
|
25
|
+
-H 'Content-Type: application/json' \
|
26
|
+
-H 'x-api-no-challenge: true' \
|
27
|
+
-H 'Accept: application/json' \
|
28
|
+
-H 'Referer: http://localhost:8080/login' \
|
29
|
+
-H 'X-Requested-With: XMLHttpRequest' \
|
30
|
+
-H 'Connection: keep-alive' \
|
31
|
+
--data-binary '{"code":"apiuser:rancher"}' \
|
32
|
+
--compressed \
|
33
|
+
| jq '.'
|
34
|
+
```
|
35
|
+
|
36
|
+
Response:
|
37
|
+
```
|
38
|
+
{
|
39
|
+
"id": null,
|
40
|
+
"type": "token",
|
41
|
+
"links": {},
|
42
|
+
"actions": {},
|
43
|
+
"accountId": "1a7",
|
44
|
+
"authProvider": "localAuthConfig",
|
45
|
+
"clientId": null,
|
46
|
+
"code": null,
|
47
|
+
"enabled": true,
|
48
|
+
"hostname": null,
|
49
|
+
"jwt": "LGV5U6TuyEsJQC9J2CRHSLeVyMX5WYTAx8jGyicr",
|
50
|
+
"scheme": null,
|
51
|
+
"security": true,
|
52
|
+
"user": "apiuser",
|
53
|
+
"userIdentity": {
|
54
|
+
"externalId": "1a7",
|
55
|
+
"profilePicture": null,
|
56
|
+
"name": "Api User",
|
57
|
+
"externalIdType": "rancher_id",
|
58
|
+
"profileUrl": null,
|
59
|
+
"login": "apiuser",
|
60
|
+
"role": null,
|
61
|
+
"projectId": null,
|
62
|
+
"all": null,
|
63
|
+
"id": "rancher_id:1a7"
|
64
|
+
},
|
65
|
+
"userType": "user"
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
Use the `jwt` key to populate our cookie and request to create a project:
|
70
|
+
|
71
|
+
```
|
72
|
+
curl 'http://localhost:8080/v1/project' \
|
73
|
+
-H 'Origin: http://localhost:8080' \
|
74
|
+
-H 'Accept-Encoding: gzip, deflate' \
|
75
|
+
-H 'Accept-Language: en-US,en;q=0.8' \
|
76
|
+
-H 'Content-Type: application/json' \
|
77
|
+
-H 'x-api-no-challenge: true' \
|
78
|
+
-H 'Accept: application/json' \
|
79
|
+
-H 'Referer: http://localhost:8080/settings/env/add' \
|
80
|
+
-H 'X-Requested-With: XMLHttpRequest' \
|
81
|
+
-H 'Cookie: PL=rancher; token=LGV5U6TuyEsJQC9J2CRHSLeVyMX5WYTAx8jGyicr' \
|
82
|
+
-H 'Connection: keep-alive' \
|
83
|
+
--data-binary '{"swarm":false,"kubernetes":false,"mesos":false,"virtualMachine":false,"publicDns":false,"type":"project","name":"test4","description":null,"projectMembers":[{"externalId":"1a7","profilePicture":null,"name":"Api User","externalIdType":"rancher_id","profileUrl":null,"login":"apiuser","role":"owner","projectId":null,"all":null,"id":"rancher_id:1a7","type":"identity"}],"created":null,"kind":null,"removed":null,"uuid":null,"members":[{"externalId":"1a7","profilePicture":null,"name":"Api User","externalIdType":"rancher_id","profileUrl":null,"login":"apiuser","role":"owner","projectId":null,"all":null,"id":"rancher_id:1a7","type":"identity"}]}' \
|
84
|
+
--compressed \
|
85
|
+
| jq '.'
|
86
|
+
```
|
87
|
+
|
88
|
+
Response:
|
89
|
+
|
90
|
+
```
|
91
|
+
{
|
92
|
+
"id": "1a12",
|
93
|
+
"type": "project",
|
94
|
+
"links": {
|
95
|
+
"self": "http://localhost:8080/v1/projects/1a12",
|
96
|
+
"auditLogs": "http://localhost:8080/v1/projects/1a12/auditlogs",
|
97
|
+
"backupTargets": "http://localhost:8080/v1/projects/1a12/backuptargets",
|
98
|
+
"backups": "http://localhost:8080/v1/projects/1a12/backups",
|
99
|
+
"certificates": "http://localhost:8080/v1/projects/1a12/certificates",
|
100
|
+
"containerEvents": "http://localhost:8080/v1/projects/1a12/containerevents",
|
101
|
+
"credentials": "http://localhost:8080/v1/projects/1a12/credentials",
|
102
|
+
"environments": "http://localhost:8080/v1/projects/1a12/environments",
|
103
|
+
"externalEvents": "http://localhost:8080/v1/projects/1a12/externalevents",
|
104
|
+
"healthcheckInstanceHostMaps": "http://localhost:8080/v1/projects/1a12/healthcheckinstancehostmaps",
|
105
|
+
"hosts": "http://localhost:8080/v1/projects/1a12/hosts",
|
106
|
+
"images": "http://localhost:8080/v1/projects/1a12/images",
|
107
|
+
"instanceLinks": "http://localhost:8080/v1/projects/1a12/instancelinks",
|
108
|
+
"instances": "http://localhost:8080/v1/projects/1a12/instances",
|
109
|
+
"ipAddresses": "http://localhost:8080/v1/projects/1a12/ipaddresses",
|
110
|
+
"labels": "http://localhost:8080/v1/projects/1a12/labels",
|
111
|
+
"mounts": "http://localhost:8080/v1/projects/1a12/mounts",
|
112
|
+
"networks": "http://localhost:8080/v1/projects/1a12/networks",
|
113
|
+
"physicalHosts": "http://localhost:8080/v1/projects/1a12/physicalhosts",
|
114
|
+
"ports": "http://localhost:8080/v1/projects/1a12/ports",
|
115
|
+
"projectMembers": "http://localhost:8080/v1/projects/1a12/projectmembers",
|
116
|
+
"serviceConsumeMaps": "http://localhost:8080/v1/projects/1a12/serviceconsumemaps",
|
117
|
+
"serviceEvents": "http://localhost:8080/v1/projects/1a12/serviceevents",
|
118
|
+
"serviceExposeMaps": "http://localhost:8080/v1/projects/1a12/serviceexposemaps",
|
119
|
+
"services": "http://localhost:8080/v1/projects/1a12/services",
|
120
|
+
"snapshots": "http://localhost:8080/v1/projects/1a12/snapshots",
|
121
|
+
"storagePools": "http://localhost:8080/v1/projects/1a12/storagepools",
|
122
|
+
"userPreferences": "http://localhost:8080/v1/projects/1a12/userpreferences",
|
123
|
+
"volumes": "http://localhost:8080/v1/projects/1a12/volumes",
|
124
|
+
"accounts": "http://localhost:8080/v1/projects/1a12/accounts",
|
125
|
+
"addOutputsInputs": "http://localhost:8080/v1/projects/1a12/addoutputsinputs",
|
126
|
+
"amazonec2Configs": "http://localhost:8080/v1/projects/1a12/amazonec2configs",
|
127
|
+
"apiKeys": "http://localhost:8080/v1/projects/1a12/apikeys",
|
128
|
+
"azureConfigs": "http://localhost:8080/v1/projects/1a12/azureconfigs",
|
129
|
+
"composeProjects": "http://localhost:8080/v1/projects/1a12/composeprojects",
|
130
|
+
"composeServices": "http://localhost:8080/v1/projects/1a12/composeservices",
|
131
|
+
"containerExecs": "http://localhost:8080/v1/projects/1a12/containerexecs",
|
132
|
+
"containers": "http://localhost:8080/v1/projects/1a12/containers",
|
133
|
+
"digitaloceanConfigs": "http://localhost:8080/v1/projects/1a12/digitaloceanconfigs",
|
134
|
+
"dnsServices": "http://localhost:8080/v1/projects/1a12/dnsservices",
|
135
|
+
"dockerBuilds": "http://localhost:8080/v1/projects/1a12/dockerbuilds",
|
136
|
+
"environmentUpgrades": "http://localhost:8080/v1/projects/1a12/environmentupgrades",
|
137
|
+
"externalDnsEvents": "http://localhost:8080/v1/projects/1a12/externaldnsevents",
|
138
|
+
"externalHostEvents": "http://localhost:8080/v1/projects/1a12/externalhostevents",
|
139
|
+
"externalServiceEvents": "http://localhost:8080/v1/projects/1a12/externalserviceevents",
|
140
|
+
"externalServices": "http://localhost:8080/v1/projects/1a12/externalservices",
|
141
|
+
"externalStoragePoolEvents": "http://localhost:8080/v1/projects/1a12/externalstoragepoolevents",
|
142
|
+
"externalVolumeEvents": "http://localhost:8080/v1/projects/1a12/externalvolumeevents",
|
143
|
+
"hostAccesses": "http://localhost:8080/v1/projects/1a12/hostaccesses",
|
144
|
+
"identities": "http://localhost:8080/v1/projects/1a12/identities",
|
145
|
+
"kubernetesServices": "http://localhost:8080/v1/projects/1a12/kubernetesservices",
|
146
|
+
"loadBalancerConfigs": "http://localhost:8080/v1/projects/1a12/loadbalancerconfigs",
|
147
|
+
"loadBalancerServices": "http://localhost:8080/v1/projects/1a12/loadbalancerservices",
|
148
|
+
"machineDrivers": "http://localhost:8080/v1/projects/1a12/machinedrivers",
|
149
|
+
"machines": "http://localhost:8080/v1/projects/1a12/machines",
|
150
|
+
"packetConfigs": "http://localhost:8080/v1/projects/1a12/packetconfigs",
|
151
|
+
"passwords": "http://localhost:8080/v1/projects/1a12/passwords",
|
152
|
+
"projects": "http://localhost:8080/v1/projects/1a12/projects",
|
153
|
+
"pullTasks": "http://localhost:8080/v1/projects/1a12/pulltasks",
|
154
|
+
"register": "http://localhost:8080/v1/projects/1a12/register",
|
155
|
+
"registrationTokens": "http://localhost:8080/v1/projects/1a12/registrationtokens",
|
156
|
+
"registries": "http://localhost:8080/v1/projects/1a12/registries",
|
157
|
+
"registryCredentials": "http://localhost:8080/v1/projects/1a12/registrycredentials",
|
158
|
+
"scalePolicys": "http://localhost:8080/v1/projects/1a12/scalepolicys",
|
159
|
+
"schemas": "http://localhost:8080/v1/projects/1a12/schemas",
|
160
|
+
"serviceProxies": "http://localhost:8080/v1/projects/1a12/serviceproxies",
|
161
|
+
"settings": "http://localhost:8080/v1/projects/1a12/settings",
|
162
|
+
"snapshotBackupInputs": "http://localhost:8080/v1/projects/1a12/snapshotbackupinputs",
|
163
|
+
"statsAccesses": "http://localhost:8080/v1/projects/1a12/statsaccesses",
|
164
|
+
"typeDocumentations": "http://localhost:8080/v1/projects/1a12/typedocumentations",
|
165
|
+
"virtualMachines": "http://localhost:8080/v1/projects/1a12/virtualmachines",
|
166
|
+
"hostStats": "http://localhost:8080/v1/projects/1a12/projects/1a12/hoststats"
|
167
|
+
},
|
168
|
+
"actions": {},
|
169
|
+
"name": "test4",
|
170
|
+
"state": "registering",
|
171
|
+
"created": "2016-07-29T18:08:23Z",
|
172
|
+
"createdTS": 1469815703000,
|
173
|
+
"description": null,
|
174
|
+
"kind": "project",
|
175
|
+
"kubernetes": false,
|
176
|
+
"members": [
|
177
|
+
{
|
178
|
+
"externalId": "1a7",
|
179
|
+
"externalIdType": "rancher_id",
|
180
|
+
"role": "owner"
|
181
|
+
}
|
182
|
+
],
|
183
|
+
"mesos": false,
|
184
|
+
"publicDns": false,
|
185
|
+
"removed": null,
|
186
|
+
"servicesPortRange": null,
|
187
|
+
"swarm": false,
|
188
|
+
"transitioning": "yes",
|
189
|
+
"transitioningMessage": "In Progress",
|
190
|
+
"transitioningProgress": null,
|
191
|
+
"uuid": "db31b902-6d96-4669-bab3-749d4c5871cb",
|
192
|
+
"virtualMachine": false
|
193
|
+
}```
|
194
|
+
|
195
|
+
## To create an api key
|
196
|
+
|
197
|
+
Use the JWT and the returned project id:
|
198
|
+
|
199
|
+
```
|
200
|
+
curl 'http://localhost:8080/v1/projects/1a8/apikey' \
|
201
|
+
-H 'Cookie: PL=rancher; token=avZcQ1kseRmc5MxACSwAN62Vv2CD7oGFn441rtHM' \
|
202
|
+
-H 'Origin: http://localhost:8080' \
|
203
|
+
-H 'Accept-Encoding: gzip, deflate' \
|
204
|
+
-H 'Accept-Language: en-US,en;q=0.8' \
|
205
|
+
-H 'Content-Type: application/json' \
|
206
|
+
-H 'x-api-no-challenge: true' \
|
207
|
+
-H 'Accept: application/json' \
|
208
|
+
-H 'Referer: http://localhost:8080/env/1a8/api' \
|
209
|
+
-H 'X-Requested-With: XMLHttpRequest' \
|
210
|
+
-H 'Connection: keep-alive' \
|
211
|
+
--data-binary '{"type":"apikey","accountId":"1a8","name":"mycoolname","description":"my cool description","created":null,"kind":null,"removed":null,"uuid":null}' \
|
212
|
+
--compressed \
|
213
|
+
| jq '.'
|
214
|
+
```
|
215
|
+
|
216
|
+
Response:
|
217
|
+
|
218
|
+
```
|
219
|
+
{
|
220
|
+
"id": "1c6",
|
221
|
+
"type": "apiKey",
|
222
|
+
"links": {
|
223
|
+
"self": "http://localhost:8080/v1/projects/1a8/apikeys/1c6",
|
224
|
+
"account": "http://localhost:8080/v1/projects/1a8/apikeys/1c6/account",
|
225
|
+
"images": "http://localhost:8080/v1/projects/1a8/apikeys/1c6/images",
|
226
|
+
"instances": "http://localhost:8080/v1/projects/1a8/apikeys/1c6/instances",
|
227
|
+
"certificate": "http://localhost:8080/v1/projects/1a8/apikeys/1c6/certificate"
|
228
|
+
},
|
229
|
+
"actions": {
|
230
|
+
"activate": "http://localhost:8080/v1/projects/1a8/apikeys/1c6/?action=activate",
|
231
|
+
"remove": "http://localhost:8080/v1/projects/1a8/apikeys/1c6/?action=remove",
|
232
|
+
"deactivate": "http://localhost:8080/v1/projects/1a8/apikeys/1c6/?action=deactivate"
|
233
|
+
},
|
234
|
+
"name": "mycoolname",
|
235
|
+
"state": "registering",
|
236
|
+
"accountId": "1a8",
|
237
|
+
"created": "2016-07-29T18:22:37Z",
|
238
|
+
"createdTS": 1469816557000,
|
239
|
+
"description": "my cool description",
|
240
|
+
"kind": "apiKey",
|
241
|
+
"publicValue": "375AD58E3AAF7191D3C0",
|
242
|
+
"removed": null,
|
243
|
+
"secretValue": "aS2tSzVn6okWKUKGCFeg1hjp3vzxe2Y367v7uQqS",
|
244
|
+
"transitioning": "yes",
|
245
|
+
"transitioningMessage": "In Progress",
|
246
|
+
"transitioningProgress": null,
|
247
|
+
"uuid": "da6e0500-b2e9-4fa8-849e-0495b26e46bd"
|
248
|
+
}
|
249
|
+
```
|
250
|
+
|
251
|
+
The `publicValue` is the RANCHER_ACCESS_KEY, and the `secretValue` is the RANCHER_SECRET_KEY
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
```
|
257
|
+
manager = Rancher::ManagementApi::Token.build_manager(username, password)
|
258
|
+
project = manager.create_project(...)
|
259
|
+
api_key = project.create_api_key(...)
|
260
|
+
api_key.access_key
|
261
|
+
api_key.secret_key
|
262
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "rancher/management_api"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
data/bin/setup
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
|
3
|
+
module Rancher
|
4
|
+
module ManagementApi
|
5
|
+
class ApiKey < OpenStruct
|
6
|
+
def self.create(project, name)
|
7
|
+
apikey_response = project.conn.post do |req|
|
8
|
+
req.url "/v1/apikey"
|
9
|
+
req.body = {
|
10
|
+
accountId: project.id,
|
11
|
+
name: name,
|
12
|
+
}.to_json
|
13
|
+
end
|
14
|
+
|
15
|
+
data = JSON.parse(apikey_response.body)
|
16
|
+
new(data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
|
3
|
+
module Rancher
|
4
|
+
module ManagementApi
|
5
|
+
class Project < OpenStruct
|
6
|
+
def self.create(conn, name)
|
7
|
+
env_response = conn.post do |req|
|
8
|
+
req.url "/v1/project"
|
9
|
+
req.body = {
|
10
|
+
name: name,
|
11
|
+
}.to_json
|
12
|
+
end
|
13
|
+
|
14
|
+
data = JSON.parse(env_response.body)
|
15
|
+
|
16
|
+
new(conn, data)
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_reader :conn
|
20
|
+
|
21
|
+
def initialize(conn, data)
|
22
|
+
@conn = conn
|
23
|
+
super(data)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_api_key(name)
|
27
|
+
ApiKey.create(self, name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
|
3
|
+
module Rancher
|
4
|
+
module ManagementApi
|
5
|
+
class Token < OpenStruct
|
6
|
+
def self.create(code:, conn:)
|
7
|
+
token_response = conn.post do |req|
|
8
|
+
req.url "/v1/token"
|
9
|
+
req.body = { code: code }.to_json
|
10
|
+
end
|
11
|
+
|
12
|
+
data = JSON.parse(token_response.body)
|
13
|
+
|
14
|
+
new(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.build_manager(host:, username:, password:)
|
18
|
+
conn = Rancher::ManagementApi.connection(host)
|
19
|
+
|
20
|
+
token = create(code: [username, password].join(":"), conn: conn)
|
21
|
+
|
22
|
+
tokened_conn = Rancher::ManagementApi.connection(host) do |faraday|
|
23
|
+
faraday.headers["Cookie"] = "token=#{token.jwt}"
|
24
|
+
end
|
25
|
+
|
26
|
+
Manager.new(tokened_conn)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rancher/management_api/version"
|
2
|
+
require "faraday"
|
3
|
+
|
4
|
+
module Rancher
|
5
|
+
module ManagementApi
|
6
|
+
def self.connection(host = ENV["RANCHER_URL"])
|
7
|
+
Faraday.new(url: host) do |faraday|
|
8
|
+
faraday.headers["Content-Type"] = "application/json"
|
9
|
+
faraday.headers["Accept"] = "application/json"
|
10
|
+
faraday.adapter Faraday.default_adapter
|
11
|
+
yield(faraday) if block_given?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require "rancher/management_api/manager"
|
18
|
+
require "rancher/management_api/api_key"
|
19
|
+
require "rancher/management_api/project"
|
20
|
+
require "rancher/management_api/token"
|
@@ -0,0 +1 @@
|
|
1
|
+
require "rancher/management_api"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rancher/management_api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rancher-management_api"
|
8
|
+
spec.version = Rancher::ManagementApi::VERSION
|
9
|
+
spec.authors = ["Donald Plummer", ""]
|
10
|
+
spec.email = ["dplummer@avvo.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Client for creating environments and apikeys for Rancher}
|
13
|
+
spec.description = "#{spec.summary}."
|
14
|
+
spec.homepage = "https://github.com/dplummer/rancher-management_api"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "faraday", "~> 0.9.2"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
28
|
+
spec.add_development_dependency "webmock", "~> 2.1"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rancher-management_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Donald Plummer
|
8
|
+
- ''
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-07-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: faraday
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.9.2
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.9.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.12'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.12'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: pry
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.10'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.10'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.5'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.5'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: webmock
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '2.1'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '2.1'
|
98
|
+
description: Client for creating environments and apikeys for Rancher.
|
99
|
+
email:
|
100
|
+
- dplummer@avvo.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- lib/rancher-management_api.rb
|
115
|
+
- lib/rancher/management_api.rb
|
116
|
+
- lib/rancher/management_api/api_key.rb
|
117
|
+
- lib/rancher/management_api/manager.rb
|
118
|
+
- lib/rancher/management_api/project.rb
|
119
|
+
- lib/rancher/management_api/token.rb
|
120
|
+
- lib/rancher/management_api/version.rb
|
121
|
+
- rancher-management_api.gemspec
|
122
|
+
homepage: https://github.com/dplummer/rancher-management_api
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.4.8
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Client for creating environments and apikeys for Rancher
|
146
|
+
test_files: []
|