Skip to content

Commit 6028ad8

Browse files
committed
Added list_scenarios example
1 parent a0a0e2f commit 6028ad8

1 file changed

Lines changed: 257 additions & 2 deletions

File tree

README.md

Lines changed: 257 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ python3 setup.py install
66

77
## Usage
88

9-
## Basic Authentication
9+
## Authenticate to the API
1010

1111
#### API User Keys
1212

@@ -22,7 +22,7 @@ from gremlinapi.config import GremlinAPIConfig as config
2222
config.bearer_token = 'Bearer MU3...ZiTk...Lo...4zO..c='
2323
```
2424

25-
#### User login
25+
#### User Login
2626

2727
```python
2828
import gremlinapi
@@ -31,6 +31,8 @@ gremlinapi.login(email='kyle@gremlin.com',
3131
company_name="Gremlin Inc.")
3232
```
3333

34+
#### User Login with MFA
35+
3436
```python
3537
import gremlinapi
3638
gremlinapi.login(email='kyle@gremlin.com',
@@ -170,5 +172,258 @@ pprint.pprint(new_team_details)
170172
'AwEHoUQDQgAEOEb1Dxa58N95g30S9S05B0v3O9USUg1hAuxKfxjLHeuO/R60yuR5\n'
171173
'RYZ0y4lz87iUSI4eAaBGhCLkwba4GyvZqA==\n'
172174
'-----END EC PRIVATE KEY-----\n'}
175+
```
176+
177+
## Scenarios
178+
179+
#### List all scenarios
180+
181+
```python
182+
from gremlinapi.config import GremlinAPIConfig as config
183+
from gremlinapi.scenarios import GremlinAPIScenarios as scenarios
184+
config.bearer_token = 'Bearer MU3...ZiTk...Lo...4zO..c='
185+
team_id = 'c98194da-90a9-5666-b9cd-e5bfe0fdfee3'
186+
scenarios_list = scenarios.list_scenarios(teamId=team_id)
187+
```
173188

189+
```python
190+
import pprint
191+
pprint.pprint(scenarios_list)
192+
```
193+
194+
```python
195+
[{'create_source': 'WebApp',
196+
'created_at': '2019-10-14T21:02:47.397Z',
197+
'created_by': 'community@gremlin.com',
198+
'description': 'Confidently adopt cloud auto-scaling services. Verify your '
199+
'users have a positive experience and your application '
200+
'behaves as expected while hosts come and go.',
201+
'guid': 'ed49ebae-d45d-4412-89eb-aed45d841255',
202+
'hypothesis': 'When CPU usage ramps up and hits a set threshold, active '
203+
'instances will increase and decrease when CPU usage goes '
204+
'down. User sessions will remain active without throwing any '
205+
'errors.',
206+
'last_run_at': '2019-10-14T21:02:47.865Z',
207+
'name': 'Validate Auto-Scaling',
208+
'org_id': 'c98194da-90a9-5666-b9cd-e5bfe0fdfee3',
209+
'recommended_scenario_id': 'd543fb53-cbd8-4b92-83fb-53cbd8cb9250',
210+
'state': 'PUBLISHED',
211+
'steps': [{'attacks': [{'attackType': 'ILFI',
212+
'impactDefinition': {'commandArgs': {'allCores': True,
213+
'cliArgs': ['cpu',
214+
'-l',
215+
'60',
216+
'-p',
217+
'5',
218+
'-a'],
219+
'length': 60,
220+
'percent': 5},
221+
'commandType': 'CPU'},
222+
'targetDefinition': {'strategy': {'percentage': 100},
223+
'strategyType': 'Random',
224+
'targetType': 'Container'}}],
225+
'delay': 5},
226+
{'attacks': [{'attackType': 'ILFI',
227+
'impactDefinition': {'commandArgs': {'allCores': True,
228+
'cliArgs': ['cpu',
229+
'-l',
230+
'60',
231+
'-p',
232+
'10',
233+
'-a'],
234+
'length': 60,
235+
'percent': 10},
236+
'commandType': 'CPU'},
237+
'targetDefinition': {'strategy': {'percentage': 100},
238+
'strategyType': 'Random',
239+
'targetType': 'Container'}}],
240+
'delay': 5},
241+
{'attacks': [{'attackType': 'ILFI',
242+
'impactDefinition': {'commandArgs': {'allCores': True,
243+
'cliArgs': ['cpu',
244+
'-l',
245+
'60',
246+
'-p',
247+
'15',
248+
'-a'],
249+
'length': 60,
250+
'percent': 15},
251+
'commandType': 'CPU'},
252+
'targetDefinition': {'strategy': {'percentage': 100},
253+
'strategyType': 'Random',
254+
'targetType': 'Container'}}],
255+
'delay': 5},
256+
{'attacks': [{'attackType': 'ILFI',
257+
'impactDefinition': {'commandArgs': {'allCores': True,
258+
'cliArgs': ['cpu',
259+
'-l',
260+
'60',
261+
'-p',
262+
'20',
263+
'-a'],
264+
'length': 60,
265+
'percent': 20},
266+
'commandType': 'CPU'},
267+
'targetDefinition': {'strategy': {'percentage': 100},
268+
'strategyType': 'Random',
269+
'targetType': 'Container'}}],
270+
'delay': 5}],
271+
'tiers': ['Free', 'Enterprise'],
272+
'updated_at': '2019-10-14T21:02:48.107Z'},
273+
{'create_source': 'WebApp',
274+
'created_at': '2019-10-14T20:36:59.952Z',
275+
'created_by': 'community@gremlin.com',
276+
'description': 'Confidently adopt cloud auto-scaling services. Verify your '
277+
'users have a positive experience and your application '
278+
'behaves as expected while hosts come and go.',
279+
'guid': 'bdaeef1c-4dbd-47bd-aeef-1c4dbdf7bd3a',
280+
'hypothesis': 'When CPU usage ramps up and hits a set threshold, active '
281+
'instances will increase and decrease when CPU usage goes '
282+
'down. User sessions will remain active without throwing any '
283+
'errors.',
284+
'last_run_at': '2019-10-14T20:37:00.128Z',
285+
'name': 'Validate Auto-Scaling',
286+
'org_id': 'c98194da-90a9-5666-b9cd-e5bfe0fdfee3',
287+
'recommended_scenario_id': 'd543fb53-cbd8-4b92-83fb-53cbd8cb9250',
288+
'state': 'PUBLISHED',
289+
'steps': [{'attacks': [{'attackType': 'ILFI',
290+
'impactDefinition': {'commandArgs': {'allCores': True,
291+
'cliArgs': ['cpu',
292+
'-l',
293+
'60',
294+
'-p',
295+
'5',
296+
'-a'],
297+
'length': 60,
298+
'percent': 5},
299+
'commandType': 'CPU'},
300+
'targetDefinition': {'strategy': {'percentage': 100},
301+
'strategyType': 'Random',
302+
'targetType': 'Container'}}],
303+
'delay': 5},
304+
{'attacks': [{'attackType': 'ILFI',
305+
'impactDefinition': {'commandArgs': {'allCores': True,
306+
'cliArgs': ['cpu',
307+
'-l',
308+
'60',
309+
'-p',
310+
'10',
311+
'-a'],
312+
'length': 60,
313+
'percent': 10},
314+
'commandType': 'CPU'},
315+
'targetDefinition': {'strategy': {'percentage': 100},
316+
'strategyType': 'Random',
317+
'targetType': 'Container'}}],
318+
'delay': 5},
319+
{'attacks': [{'attackType': 'ILFI',
320+
'impactDefinition': {'commandArgs': {'allCores': True,
321+
'cliArgs': ['cpu',
322+
'-l',
323+
'60',
324+
'-p',
325+
'15',
326+
'-a'],
327+
'length': 60,
328+
'percent': 15},
329+
'commandType': 'CPU'},
330+
'targetDefinition': {'strategy': {'percentage': 100},
331+
'strategyType': 'Random',
332+
'targetType': 'Container'}}],
333+
'delay': 5},
334+
{'attacks': [{'attackType': 'ILFI',
335+
'impactDefinition': {'commandArgs': {'allCores': True,
336+
'cliArgs': ['cpu',
337+
'-l',
338+
'60',
339+
'-p',
340+
'20',
341+
'-a'],
342+
'length': 60,
343+
'percent': 20},
344+
'commandType': 'CPU'},
345+
'targetDefinition': {'strategy': {'percentage': 100},
346+
'strategyType': 'Random',
347+
'targetType': 'Container'}}],
348+
'delay': 5}],
349+
'tiers': ['Free', 'Enterprise'],
350+
'updated_at': '2019-10-14T20:37:00.314Z'},
351+
{'create_source': 'WebApp',
352+
'created_at': '2019-10-13T23:40:23.434Z',
353+
'created_by': 'community@gremlin.com',
354+
'description': 'Confidently adopt cloud auto-scaling services. Verify your '
355+
'users have a positive experience and your application '
356+
'behaves as expected while hosts come and go.',
357+
'guid': '4d9e313a-dcab-4d69-9e31-3adcabdd6964',
358+
'hypothesis': 'When CPU usage ramps up and hits a set threshold, active '
359+
'instances will increase and decrease when CPU usage goes '
360+
'down. User sessions will remain active without throwing any '
361+
'errors.',
362+
'last_run_at': '2019-10-13T23:40:24.467Z',
363+
'name': 'Validate Auto-Scaling',
364+
'org_id': 'c98194da-90a9-5666-b9cd-e5bfe0fdfee3',
365+
'recommended_scenario_id': 'd543fb53-cbd8-4b92-83fb-53cbd8cb9250',
366+
'state': 'PUBLISHED',
367+
'steps': [{'attacks': [{'attackType': 'ILFI',
368+
'impactDefinition': {'commandArgs': {'allCores': True,
369+
'cliArgs': ['cpu',
370+
'-l',
371+
'60',
372+
'-p',
373+
'5',
374+
'-a'],
375+
'length': 60,
376+
'percent': 5},
377+
'commandType': 'CPU'},
378+
'targetDefinition': {'strategy': {'percentage': 100},
379+
'strategyType': 'Random',
380+
'targetType': 'Host'}}],
381+
'delay': 5},
382+
{'attacks': [{'attackType': 'ILFI',
383+
'impactDefinition': {'commandArgs': {'allCores': True,
384+
'cliArgs': ['cpu',
385+
'-l',
386+
'60',
387+
'-p',
388+
'10',
389+
'-a'],
390+
'length': 60,
391+
'percent': 10},
392+
'commandType': 'CPU'},
393+
'targetDefinition': {'strategy': {'percentage': 100},
394+
'strategyType': 'Random',
395+
'targetType': 'Host'}}],
396+
'delay': 5},
397+
{'attacks': [{'attackType': 'ILFI',
398+
'impactDefinition': {'commandArgs': {'allCores': True,
399+
'cliArgs': ['cpu',
400+
'-l',
401+
'60',
402+
'-p',
403+
'15',
404+
'-a'],
405+
'length': 60,
406+
'percent': 15},
407+
'commandType': 'CPU'},
408+
'targetDefinition': {'strategy': {'percentage': 100},
409+
'strategyType': 'Random',
410+
'targetType': 'Host'}}],
411+
'delay': 5},
412+
{'attacks': [{'attackType': 'ILFI',
413+
'impactDefinition': {'commandArgs': {'allCores': True,
414+
'cliArgs': ['cpu',
415+
'-l',
416+
'60',
417+
'-p',
418+
'20',
419+
'-a'],
420+
'length': 60,
421+
'percent': 20},
422+
'commandType': 'CPU'},
423+
'targetDefinition': {'strategy': {'percentage': 100},
424+
'strategyType': 'Random',
425+
'targetType': 'Host'}}],
426+
'delay': 5}],
427+
'tiers': ['Free', 'Enterprise'],
428+
'updated_at': '2019-10-13T23:40:24.742Z'}]
174429
```

0 commit comments

Comments
 (0)