purest 0.1.0 → 1.0.1
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 +4 -4
- data/README.md +414 -104
- data/lib/purest.rb +4 -1
- data/lib/purest/alerts.rb +25 -0
- data/lib/purest/api_methods.rb +125 -0
- data/lib/purest/app.rb +13 -0
- data/lib/purest/cert.rb +23 -0
- data/lib/purest/directory_service.rb +17 -0
- data/lib/purest/dns.rb +17 -0
- data/lib/purest/drive.rb +13 -0
- data/lib/purest/hardware.rb +17 -0
- data/lib/purest/host.rb +18 -65
- data/lib/purest/host_group.rb +21 -62
- data/lib/purest/messages.rb +20 -0
- data/lib/purest/network.rb +25 -0
- data/lib/purest/physical_array.rb +11 -42
- data/lib/purest/port.rb +13 -0
- data/lib/purest/protection_group.rb +26 -0
- data/lib/purest/rest.rb +2 -7
- data/lib/purest/snmp.rb +25 -0
- data/lib/purest/subnet.rb +25 -0
- data/lib/purest/users.rb +34 -0
- data/lib/purest/version.rb +5 -0
- data/lib/purest/volume.rb +12 -81
- metadata +61 -18
- data/lib/purest/custom_exceptions.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab3ac73c9fc141dddadde6ec8435dcad4f40ff1011badec4ecdad573f0f2c166
|
4
|
+
data.tar.gz: b82e8f475af0b06238acd863ace402d9503acfb1d1d07f3e777a777934cafba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae3956cd6d9e11df30da2a7988fe5c4dbad2e91afff3913610d14775af84baef36104d327caf75cd4eb541d310554758d10389cf80e0b6740ec1f1e3d134e776
|
7
|
+
data.tar.gz: a21f3ca95452314c9e3ceeb283979a0903c8471a4fc468fdb69d9f2a91e3cffdecec42954de4dd4f114dee00eca5ae9540d8b84bf8b6af6393dd4f4b1efced7d
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ This started as sort of a labor of love/learning exercise, and sort of blossomed
|
|
9
9
|
|
10
10
|
2) I am not affiliated with Pure Storage, beyond the fact that my company uses their product.
|
11
11
|
|
12
|
-
3)
|
12
|
+
3) While all of the classes exist, currently only up to API version 1.11 is supported.
|
13
13
|
|
14
14
|
## Requirements
|
15
15
|
|
@@ -34,8 +34,10 @@ end
|
|
34
34
|
```
|
35
35
|
|
36
36
|
## API options
|
37
|
-
|
38
|
-
|
37
|
+
First: Authentication and session management is handled behind the scenes, you just need to supply your username/password in the configuration block (as shown in the example above). That's it.
|
38
|
+
|
39
|
+
Second: The various class methods of this gem turn the provided options into HTTP parameters, and are
|
40
|
+
named accordingly. For instance, ```Purest::Volume.get({:snap: true})``` translates
|
39
41
|
to http://purehost.yourdomain.com/api/1.11/volume?snap=true. For a full list
|
40
42
|
of options for a given class, Pure provides good documentation at:
|
41
43
|
https://purehost.yourdomain.com/static/0/help/rest/.
|
@@ -43,79 +45,122 @@ https://purehost.yourdomain.com/static/0/help/rest/.
|
|
43
45
|
Below I'll provide a large group of examples, but I won't be detailing every single method call with all of its possible options, for that I will again refer you to Pure's REST API docs.
|
44
46
|
|
45
47
|
# Examples
|
46
|
-
|
47
|
-
|
48
|
+
|
49
|
+
## Alerts
|
50
|
+
Get information about alerts/alerting
|
48
51
|
```ruby
|
49
|
-
#
|
50
|
-
Purest::
|
52
|
+
# List email recipients
|
53
|
+
Purest::Alerts.get
|
51
54
|
|
52
|
-
#
|
53
|
-
Purest::
|
55
|
+
# List information about a specific email recipient
|
56
|
+
Purest::Alerts.get(name: 'email@example.com')
|
57
|
+
```
|
54
58
|
|
55
|
-
|
56
|
-
|
59
|
+
Designate an email address to receive alerts
|
60
|
+
```ruby
|
61
|
+
Purest::Alerts.create(name: 'new-user@example.com')
|
62
|
+
```
|
57
63
|
|
58
|
-
|
59
|
-
|
64
|
+
Updating/performing alert actions
|
65
|
+
```ruby
|
66
|
+
# Send a test alert
|
67
|
+
Purest::Alerts.update(action: 'test')
|
60
68
|
|
61
|
-
#
|
62
|
-
Purest::
|
69
|
+
# Turn off alert sending for new-user@example.com
|
70
|
+
Purest::Alerts.update(name: 'new-user@example.com', enabled: false)
|
71
|
+
```
|
63
72
|
|
64
|
-
|
65
|
-
|
73
|
+
Deleting an email address from list of addresses that receive alerts
|
74
|
+
```ruby
|
75
|
+
Purest::Alerts.delete(name: 'new-user@example.com')
|
76
|
+
```
|
66
77
|
|
67
|
-
|
68
|
-
|
78
|
+
## App
|
79
|
+
```ruby
|
80
|
+
# Teeny tiny class, can get apps or get apps and initiators
|
81
|
+
Purest::App.get
|
82
|
+
Purest::App.get(initiators: true)
|
83
|
+
```
|
69
84
|
|
70
|
-
|
71
|
-
|
85
|
+
## Cert
|
86
|
+
List certificate attributes or export a certificate
|
87
|
+
```ruby
|
88
|
+
# Get certificate attributes
|
89
|
+
Purest::Cert.get
|
72
90
|
|
73
|
-
#
|
74
|
-
Purest::
|
91
|
+
# Export current certificate
|
92
|
+
Purest::Cert.get(certificate: true)
|
75
93
|
|
76
|
-
#
|
77
|
-
Purest::
|
78
|
-
```
|
94
|
+
# Export current intermediate certificate
|
95
|
+
Purest::Cert.get(intermediate_certificate: true)
|
79
96
|
|
80
|
-
|
97
|
+
# Get a CSR with current certificate attributes
|
98
|
+
Purest::Cert.get(csr: true)
|
81
99
|
|
100
|
+
# Get a CSR with current certificate attributes, but change the CN
|
101
|
+
Purest::Cert.get(csr: true, common_name: 'host.example.com')
|
102
|
+
```
|
103
|
+
|
104
|
+
Create self signed certificate, or import one. If you're wondering why this
|
105
|
+
is an update action and not a create action, I believe it comes down to the fact
|
106
|
+
that the Pure Array already has a self signed cert from the get go so we're just updating in place.
|
82
107
|
```ruby
|
83
|
-
#
|
84
|
-
Purest::
|
108
|
+
# Create a self signed certificate, using existing attributes
|
109
|
+
Purest::Cert.update(self_signed: true)
|
85
110
|
|
86
|
-
#
|
87
|
-
Purest::
|
111
|
+
# Create a self signed cert, using all existing attributes except the state
|
112
|
+
Purest::Cert.update(self_signed: true, state: 'FL')
|
88
113
|
|
89
|
-
#
|
90
|
-
Purest::
|
114
|
+
# Import a cert signed by a CA
|
115
|
+
Purest::Cert.update(certificate: 'your_huge_certificate_string')
|
116
|
+
```
|
91
117
|
|
92
|
-
|
93
|
-
|
118
|
+
## Directory Service
|
119
|
+
Get information about directory service
|
120
|
+
```ruby
|
121
|
+
Purest::DirectoryService.get
|
94
122
|
```
|
95
123
|
|
96
|
-
|
124
|
+
Update information about a directory service
|
97
125
|
```ruby
|
98
|
-
|
99
|
-
|
126
|
+
Purest::DirectoryService.update(bind_password: 'superpassword')
|
127
|
+
```
|
100
128
|
|
101
|
-
|
102
|
-
|
129
|
+
## DNS
|
130
|
+
Listing DNS attributes
|
131
|
+
```ruby
|
132
|
+
Purest::DNS.get
|
133
|
+
```
|
103
134
|
|
104
|
-
|
105
|
-
|
135
|
+
Updating DNS attributes
|
136
|
+
```ruby
|
137
|
+
Purest::DNS.update(nameservers: ['newdns1', 'newdns2'])
|
106
138
|
```
|
107
139
|
|
108
|
-
|
140
|
+
## Drive information
|
141
|
+
List flash modules, NVRAM modules, and their attributes
|
142
|
+
```ruby
|
143
|
+
Purest::Drive.get
|
109
144
|
|
145
|
+
Purest::Drive.get(name: 'SH0.BAY0')
|
146
|
+
```
|
147
|
+
|
148
|
+
## Hardware
|
149
|
+
List hardware components
|
110
150
|
```ruby
|
111
|
-
|
112
|
-
Purest::Volume.delete(:name => 'volume_to_delete')
|
151
|
+
Purest::Hardware.get
|
113
152
|
|
114
|
-
#
|
115
|
-
Purest::
|
153
|
+
# List a specific hardware component's attributes
|
154
|
+
Purest::Hardware.get(name: 'SH0.BAY0')
|
155
|
+
```
|
116
156
|
|
117
|
-
|
118
|
-
|
157
|
+
Control visual identification of specified components
|
158
|
+
```ruby
|
159
|
+
# Turn the lights on
|
160
|
+
Purest::Hardware.update(name: 'SH0.BAY0', identify: on)
|
161
|
+
|
162
|
+
# Turn the lights off :(
|
163
|
+
Purest::Hardware.update(name: 'SH0.BAY0', identify: off)
|
119
164
|
```
|
120
165
|
|
121
166
|
## Hosts
|
@@ -125,52 +170,151 @@ Getting hosts:
|
|
125
170
|
Purest::Host.get
|
126
171
|
|
127
172
|
# Get a list of hosts with performance data
|
128
|
-
Purest::Host.get(:
|
173
|
+
Purest::Host.get(action: 'monitor')
|
129
174
|
|
130
175
|
# Get a single host on an array
|
131
|
-
Purest::Host.get(:
|
176
|
+
Purest::Host.get(name: 'host123')
|
132
177
|
|
133
178
|
# Get a list of hosts, by name, on an array
|
134
|
-
Purest::Host.get(:
|
179
|
+
Purest::Host.get(names: ['host123', 'host456'])
|
180
|
+
|
181
|
+
# Get volumes associated with specific host
|
182
|
+
Purest::Host.get(name: 'hgroup1', show_volume: true)
|
135
183
|
```
|
136
184
|
|
137
185
|
Creating hosts:
|
138
186
|
```ruby
|
139
187
|
# Create a host
|
140
|
-
Purest::Host.create(
|
188
|
+
Purest::Host.create(name: 'host123')
|
141
189
|
|
142
190
|
# Create a host and set ISCSI IQNs
|
143
|
-
Purest::Host.create(:
|
191
|
+
Purest::Host.create(name: 'host123', iqnlist: ['iqnstuff-1', 'iqnstuff-2'])
|
144
192
|
|
145
193
|
# Add a host to a protection group
|
146
|
-
Purest::Host.create(:
|
194
|
+
Purest::Host.create(name: 'host123', protection_group: 'pgroup123')
|
147
195
|
|
148
196
|
# Connect a volume to a host
|
149
|
-
Purest::Host.create(:
|
197
|
+
Purest::Host.create(name: 'host123', volume: 'volume123')
|
150
198
|
```
|
151
199
|
|
152
200
|
Updating hosts:
|
153
201
|
```ruby
|
154
202
|
# Rename a host
|
155
|
-
Purest::Host.update(:
|
203
|
+
Purest::Host.update(name: 'host123', new_name: 'host456')
|
156
204
|
|
157
205
|
# Set the host username/password for CHAP
|
158
|
-
Purest::Host.update(:
|
206
|
+
Purest::Host.update(name: 'host123', host_user: 'username', host_password: 'supersecretpassword')
|
159
207
|
```
|
160
208
|
|
161
209
|
Deleting hosts:
|
162
210
|
```ruby
|
163
211
|
# Delete a host
|
164
|
-
Purest::Host.delete(:
|
212
|
+
Purest::Host.delete(name: 'host123')
|
165
213
|
|
166
214
|
# Remove a host from a protection group
|
167
|
-
Purest::Host.delete(:
|
215
|
+
Purest::Host.delete(name: 'host123', protection_group: 'pgroup123')
|
168
216
|
|
169
217
|
# Remove the connection between a host and a volume
|
170
|
-
Purest::Host.delete(:
|
218
|
+
Purest::Host.delete(name: 'host123', volume: 'volume123')
|
219
|
+
```
|
220
|
+
|
221
|
+
## Host Groups
|
222
|
+
Getting information about host groups
|
223
|
+
```ruby
|
224
|
+
# Get a list of host groups
|
225
|
+
Purest::HostGroup.get
|
226
|
+
|
227
|
+
# Get a single host group
|
228
|
+
Purest::HostGroup.get(name: 'hgroup1')
|
229
|
+
|
230
|
+
# Get a list of host groups, with monitoring information
|
231
|
+
Purest::HostGroup.get(names: ['hgroup1', 'hgroup2'], action: 'monitor')
|
232
|
+
|
233
|
+
# Get a list of volumes associated with a specified host
|
234
|
+
Purest::HostGroup.get(name: 'hgroup1', show_volume: true)
|
235
|
+
```
|
236
|
+
|
237
|
+
Creating host groups
|
238
|
+
```ruby
|
239
|
+
# Create a host group with a specified name
|
240
|
+
Purest::HostGroup.create(name: 'hgroup1')
|
241
|
+
|
242
|
+
# Create a host group and supply its host members
|
243
|
+
Purest::HostGroup.create(name: 'hgroup1', hostlist: ['host1', 'host2'])
|
244
|
+
|
245
|
+
# Add a host group to a protection group
|
246
|
+
Purest::HostGroup.create(name: 'hgroup1', protection_group: 'pgroup1')
|
247
|
+
|
248
|
+
# Connect a volume to all hosts in a specified host group
|
249
|
+
Purest::HostGroup.create(name: 'hgroup1', volume: 'v3')
|
171
250
|
```
|
172
251
|
|
173
|
-
|
252
|
+
Updating host groups
|
253
|
+
```ruby
|
254
|
+
# Renaming a host group
|
255
|
+
Purest::HostGroup.update(name: 'hgroup1', new_name: 'hgroup1-renamed')
|
256
|
+
|
257
|
+
# Replace the list of member hosts
|
258
|
+
Purest::HostGroup.update(name: 'hgroup1', hostlist: ['host1', 'host2'])
|
259
|
+
|
260
|
+
# Add a list of hosts to existing host list
|
261
|
+
Purest::HostGroup.update(name: 'hgroup1', addhostlist: ['host3', 'host4'])
|
262
|
+
|
263
|
+
# Remove a list of hosts from a host list
|
264
|
+
Purest::HostGroup.update(name: 'hgroup1', remhostlist: ['host1'])
|
265
|
+
```
|
266
|
+
|
267
|
+
Deleting host groups
|
268
|
+
```ruby
|
269
|
+
# Delete a host group
|
270
|
+
Purest::HostGroup.delete(name: 'hgroup1')
|
271
|
+
|
272
|
+
# Remove a host group member from a protection group
|
273
|
+
Purest::HostGroup.delete(name: 'hgroup1', protection_group: 'pgroup1')
|
274
|
+
|
275
|
+
# Break the connection between a host group and a volume
|
276
|
+
Purest::HostGroup.delete(name: 'hgroup1', volume: 'volume1')
|
277
|
+
```
|
278
|
+
|
279
|
+
## Messages
|
280
|
+
List alert events, audit records, etc
|
281
|
+
```ruby
|
282
|
+
Purest::Messages.get
|
283
|
+
```
|
284
|
+
|
285
|
+
Flag/unflag a message
|
286
|
+
```ruby
|
287
|
+
Purest::Messages.update(id: 2, flagged: true)
|
288
|
+
```
|
289
|
+
|
290
|
+
## Network
|
291
|
+
List network interfaces
|
292
|
+
```ruby
|
293
|
+
# Get network interfaces and their statuses
|
294
|
+
Purest::Network.get
|
295
|
+
|
296
|
+
# Get attributes about a specific network component
|
297
|
+
Purest::Network.get(name: 'ct0.eth0')
|
298
|
+
```
|
299
|
+
|
300
|
+
Create a VLAN interface
|
301
|
+
```ruby
|
302
|
+
# Create a vlan with a specified subnet
|
303
|
+
Purest::Network.create(subnet: 'subnet10')
|
304
|
+
```
|
305
|
+
|
306
|
+
Perform network interface actions or update attributes
|
307
|
+
```ruby
|
308
|
+
# Set MTU
|
309
|
+
Purest::Network.update(mtu: 2000)
|
310
|
+
```
|
311
|
+
|
312
|
+
Delete a VLAN interface
|
313
|
+
```ruby
|
314
|
+
Purest::Network.delete(name: 'ct0.eth0')
|
315
|
+
```
|
316
|
+
|
317
|
+
## Physical Arrays
|
174
318
|
|
175
319
|
List the attributes on an array:
|
176
320
|
```ruby
|
@@ -178,83 +322,240 @@ List the attributes on an array:
|
|
178
322
|
Purest::PhysicalArray.get
|
179
323
|
|
180
324
|
# List connected arrays
|
181
|
-
Purest::PhysicalArray.get(:
|
325
|
+
Purest::PhysicalArray.get(connection: true)
|
182
326
|
```
|
183
327
|
|
184
328
|
Create a connection between two arrays:
|
185
329
|
```ruby
|
186
|
-
Purest::PhysicalArray.create(:
|
330
|
+
Purest::PhysicalArray.create(connection_key: '<key>', management_address: 'hostname', type: ['replication'])
|
187
331
|
```
|
188
332
|
|
189
333
|
Update the attributes on an array:
|
190
334
|
```ruby
|
191
335
|
# rename an array
|
192
|
-
Purest::PhysicalArray.update(:
|
336
|
+
Purest::PhysicalArray.update(new_name: 'new_name')
|
193
337
|
```
|
194
338
|
|
195
339
|
Disconnect the current array from a specified array:
|
196
340
|
```ruby
|
197
341
|
# Given that your pure is purehost.yourdomain.com, as defined in the config block above
|
198
342
|
# Disconnect purehost2.yourdomain.com from yours
|
199
|
-
Purest::PhysicalArray.delete(:
|
343
|
+
Purest::PhysicalArray.delete(name: 'purehost2.yourdomain.com')
|
200
344
|
```
|
201
345
|
|
202
|
-
|
203
|
-
Getting information about
|
346
|
+
## Port
|
347
|
+
Getting information about ports, 'cause that's all you get to do
|
204
348
|
```ruby
|
205
|
-
# Get
|
206
|
-
Purest::
|
349
|
+
# Get port information
|
350
|
+
Purest::Port.get
|
207
351
|
|
208
|
-
# Get
|
209
|
-
Purest::
|
352
|
+
# Get port information + initiator information = winning
|
353
|
+
Purest::Port.get(initiators: true)
|
354
|
+
```
|
210
355
|
|
211
|
-
|
212
|
-
|
356
|
+
## Protection Groups
|
357
|
+
Getting information about protection groups
|
358
|
+
```ruby
|
359
|
+
# Get a list of protection groups
|
360
|
+
Purest::ProtectionGroup.get
|
213
361
|
|
214
|
-
# Get a list of
|
215
|
-
Purest::
|
362
|
+
# Get a list of protection groups pending deletion
|
363
|
+
Purest::ProtectionGroup.get(pending: true)
|
216
364
|
```
|
217
365
|
|
218
|
-
Creating
|
366
|
+
Creating protection groups
|
219
367
|
```ruby
|
220
|
-
# Create a
|
221
|
-
Purest::
|
368
|
+
# Create a protection group
|
369
|
+
Purest::ProtectionGroup.create(name: 'pgroup1')
|
222
370
|
|
223
|
-
# Create a
|
224
|
-
Purest::
|
371
|
+
# Create a protection group with a host list
|
372
|
+
Purest::ProtectionGroup.create(name: 'pgroup1', hostlist: ['host1', 'host2'])
|
373
|
+
```
|
225
374
|
|
226
|
-
|
227
|
-
|
375
|
+
Updating protection groups
|
376
|
+
```ruby
|
377
|
+
# Renaming a protection group
|
378
|
+
Purest::ProtectionGroup.update(name: 'pgroup1', new_name: 'pgroup1-renamed')
|
228
379
|
|
229
|
-
#
|
230
|
-
Purest::
|
380
|
+
# Add a list of hosts to an existing protection group's host list
|
381
|
+
Purest::ProtectionGroup.update(name: 'pgroup1', addhostlist: ['host3', 'host4'])
|
231
382
|
```
|
232
383
|
|
233
|
-
|
384
|
+
Deleting a protection group
|
234
385
|
```ruby
|
235
|
-
#
|
236
|
-
Purest::
|
386
|
+
# Delete it, but allow for it to remain during the 24 hour grace period
|
387
|
+
Purest::ProtectionGroup.delete(name: 'pgroup1')
|
237
388
|
|
238
|
-
#
|
239
|
-
Purest::
|
389
|
+
# Delete it, with extreme prejudice
|
390
|
+
Purest::ProtectionGroup.delete(name: 'pgroup1', eradicate: true)
|
391
|
+
```
|
240
392
|
|
241
|
-
|
242
|
-
|
393
|
+
## SNMP
|
394
|
+
Getting SNMP information
|
395
|
+
```ruby
|
396
|
+
# Get a list of SNMP managers
|
397
|
+
Purest::SNMP.get
|
243
398
|
|
244
|
-
#
|
245
|
-
Purest::
|
399
|
+
# List SNMP v3 engine ID
|
400
|
+
Purest::SNMP.get(engine_id: true)
|
246
401
|
```
|
247
402
|
|
248
|
-
|
403
|
+
Creating an SNMP manager
|
249
404
|
```ruby
|
250
|
-
#
|
251
|
-
Purest::
|
405
|
+
# Create an SNMP manager
|
406
|
+
Purest::SNMP.create(name: 'snmp-manager1', host: 'snmp.yourdomain.com')
|
252
407
|
|
253
|
-
#
|
254
|
-
Purest::
|
408
|
+
# Create an SNMP manager pointed at an IPv4 address with a custom port
|
409
|
+
Purest::SNMP.create(name: 'snmp-manager1', host: '111.11.11.111:222')
|
255
410
|
|
256
|
-
#
|
257
|
-
Purest::
|
411
|
+
# For those brave few; the strong souls using IPv6 with a custom port
|
412
|
+
Purest::SNMP.create(:name: 'snmp-manager1', :host: '[2001:db8:0:1]:222')
|
413
|
+
```
|
414
|
+
|
415
|
+
Updating an existing SNMP manager
|
416
|
+
```ruby
|
417
|
+
# Renaming an SNMP manager
|
418
|
+
Purest::SNMP.update(name: 'snmp-manager1', new_name: 'snmp-manager-renamed')
|
419
|
+
|
420
|
+
# For those not so brave; the weak souls who give up using IPv6 with a custom port
|
421
|
+
Purest::SNMP.update(name: 'snmp-manager1', host: '111.11.11.111:222')
|
422
|
+
```
|
423
|
+
|
424
|
+
Deleting an SNMP manager
|
425
|
+
```ruby
|
426
|
+
# Delete an SNMP manager
|
427
|
+
Purest::SNMP.delete(name: 'snmp-manager1')
|
428
|
+
```
|
429
|
+
|
430
|
+
## Subnet
|
431
|
+
Getting information about subnets
|
432
|
+
```ruby
|
433
|
+
Purest::Subnet.get
|
434
|
+
|
435
|
+
# Specify a subnet
|
436
|
+
Purest::Subnet.get(name: 'subnet10')
|
437
|
+
```
|
438
|
+
|
439
|
+
Creating a subnet
|
440
|
+
```ruby
|
441
|
+
Purest::Subnet.create(name: 'subnet20', gateway: '11.11.11.1')
|
442
|
+
```
|
443
|
+
|
444
|
+
Updating a subnet
|
445
|
+
```ruby
|
446
|
+
# Rename a subnet
|
447
|
+
Purest::Subnet.update(name: 'subnet20', new_name: 'subnet21')
|
448
|
+
```
|
449
|
+
|
450
|
+
Deleting a subnet
|
451
|
+
```ruby
|
452
|
+
Purest::Subnet.delete(name: 'subnet21')
|
453
|
+
```
|
454
|
+
|
455
|
+
## Users
|
456
|
+
Getting information about users
|
457
|
+
```ruby
|
458
|
+
Purest::Users.get
|
459
|
+
|
460
|
+
# Specific user information
|
461
|
+
Purest::Users.get(name: 'paxton.fettle')
|
462
|
+
|
463
|
+
# List the API token of a given user
|
464
|
+
Purest::Users.get(name: 'paxton.fettle', api_token: true)
|
465
|
+
```
|
466
|
+
|
467
|
+
Create an API token for an existing user
|
468
|
+
```ruby
|
469
|
+
Purest::Users.create(name: 'paxton.fettle')
|
470
|
+
```
|
471
|
+
|
472
|
+
Updating user related stuff
|
473
|
+
```ruby
|
474
|
+
# Clear all user permission cache entries
|
475
|
+
Purest::Users.update(clear: true)
|
476
|
+
|
477
|
+
# Update a specific user's public key
|
478
|
+
Purest::Users.update(name: 'paxton.fettle', publickey: 'hugepublickeystring')
|
479
|
+
```
|
480
|
+
|
481
|
+
Delete API token for a user
|
482
|
+
```ruby
|
483
|
+
Purest::Users.delete(name: 'paxton.fettle')
|
484
|
+
```
|
485
|
+
|
486
|
+
## Volumes
|
487
|
+
Getting volumes:
|
488
|
+
```ruby
|
489
|
+
# Get the full list of volumes
|
490
|
+
Purest::Volume.get
|
491
|
+
|
492
|
+
# Get a single volume
|
493
|
+
Purest::Volume.get(name: 'volume1')
|
494
|
+
|
495
|
+
# Get monitoring information about a volume
|
496
|
+
Purest::Volume.get(name: 'volume1', action: 'monitor')
|
497
|
+
|
498
|
+
# Get multiple volumes
|
499
|
+
Purest::Volume.get(names: ['volume1', 'volume2'])
|
500
|
+
|
501
|
+
# Get a list of snapshots
|
502
|
+
Purest::Volume.get(snap: true)
|
503
|
+
|
504
|
+
# Get a single snapshot
|
505
|
+
Purest::Volume.get(name: 'volume1', snap: true)
|
506
|
+
|
507
|
+
# Get multiple snapshots
|
508
|
+
Purest::Volume.get(names: ['volume1', 'volume2'], snap: true)
|
509
|
+
|
510
|
+
# List block differences for the specified snapshot
|
511
|
+
Purest::Volume.get(name: 'volume1.snap', show_diff: true, block_size: 512, length: '2G')
|
512
|
+
|
513
|
+
# List shared connections for a specified volume
|
514
|
+
Purest::Volume.get(name: 'volume1', show_hgroup: true)
|
515
|
+
|
516
|
+
# List private connections for a specified volume
|
517
|
+
Purest::Volume.get(:name: 'volume1', :show_host: true)
|
518
|
+
```
|
519
|
+
|
520
|
+
Creating volumes:
|
521
|
+
|
522
|
+
```ruby
|
523
|
+
# Creating a new volume
|
524
|
+
Purest::Volume.create(name: 'volume', size: '10G')
|
525
|
+
|
526
|
+
# Creating a new volume by copying another
|
527
|
+
Purest::Volume.create(name: 'volume', source: 'other_vol')
|
528
|
+
|
529
|
+
# Overwriting a volume by copying another
|
530
|
+
Purest::Volume.create(name: 'volume', source: 'other_vol', overwrite: true)
|
531
|
+
|
532
|
+
# Add a volume to a protection group
|
533
|
+
Purest::Volume.create(name: 'volume', protection_group: 'protection-group')
|
534
|
+
```
|
535
|
+
|
536
|
+
Updating volumes
|
537
|
+
```ruby
|
538
|
+
# Growing a volume
|
539
|
+
Purest::Volume.update(name: 'volume', size: "15G")
|
540
|
+
|
541
|
+
# Truncate (shrink) a volume
|
542
|
+
Purest::Volume.update(name: 'volume', size: "10G", truncate: true)
|
543
|
+
|
544
|
+
# Rename a volume
|
545
|
+
Purest::Volume.update(name: 'volume', new_name: 'volume_renamed')
|
546
|
+
```
|
547
|
+
|
548
|
+
Deleting volumes
|
549
|
+
|
550
|
+
```ruby
|
551
|
+
# Delete a volume
|
552
|
+
Purest::Volume.delete(name: 'volume_to_delete')
|
553
|
+
|
554
|
+
# Eradicating a volume
|
555
|
+
Purest::Volume.delete(name: 'volume_to_delete', eradicate: true)
|
556
|
+
|
557
|
+
# Deleting a volume from a protection group
|
558
|
+
Purest::Volume.delete(name: 'volume', protection_group: 'pgroup1')
|
258
559
|
```
|
259
560
|
|
260
561
|
# Specs
|
@@ -274,11 +575,20 @@ password: 'api-password'
|
|
274
575
|
url: 'https://yoursuperawesomepurehost.com'
|
275
576
|
```
|
276
577
|
|
277
|
-
|
578
|
+
There are a few ways you can execute the integration tests:
|
278
579
|
```
|
580
|
+
# This will execute against the latest API version the gem is aware of, right now that is 1.11
|
279
581
|
rspec -t integration
|
582
|
+
|
583
|
+
# This will execute against a specific version
|
584
|
+
API_VERSION=1.10 rspec -t integration
|
585
|
+
|
586
|
+
# This will execute against all specified versions
|
587
|
+
API_VERSION=1.1,1.2,1.5 rspec -t integration
|
588
|
+
|
589
|
+
# And finally, if you wish to execute integration tests against every version
|
590
|
+
ALL_VERSIONS=true rspec -t integration
|
280
591
|
```
|
281
592
|
|
282
|
-
By default, this will run against version 1.1 to 1.11 of the API. This is useful for ensuring functionality added/subtracted to this project is programmatically tested against all versions of the API. I mostly did this as an exercise, that being said I think it provides a lot of usefulness and if it can be improved let me know (or submit a PR).
|
283
593
|
|
284
|
-
It is worth mentioning, this generates a fair bit of work for your Pure array so...you've been warned.
|
594
|
+
It is worth mentioning, this generates a fair bit of work for your Pure array so...you've been warned. All of that being said, the integration testing is somewhat sparse at the moment
|