76
76
| `pypyraws.steps.s3fetchyaml `_ | Fetch a yaml file from s3 into the pypyr | s3Fetch (dict) |
77
77
| | context. | |
78
78
+-------------------------------+-------------------------------------------------+------------------------------+
79
- | `pypyraws.steps.wait `_ | Wait for an aws client method to complete. | awsWaitIn (dict) |
79
+ | `pypyraws.steps.wait `_ | Wait for an aws client waiter method to | awsWaitIn (dict) |
80
+ | | complete. | |
81
+ +-------------------------------+-------------------------------------------------+------------------------------+
82
+ | `pypyraws.steps.waitfor `_ | Wait for any aws client method to complete, | awsWaitFor (dict) |
83
+ | | even when it doesn't have an official waiter. | |
80
84
+-------------------------------+-------------------------------------------------+------------------------------+
81
85
82
86
pypyraws.steps.client
@@ -98,6 +102,9 @@ support all the methods you need.
98
102
99
103
You can actually pretty much just grab the json as written from the excellent
100
104
AWS help docs, paste it into some json that pypyr consumes and tadaaa!
105
+ Alternatively, grab the samples from the boto3 python documentation to include
106
+ in some yaml - the python dictionary structures map to yaml without too much
107
+ faff.
101
108
102
109
Supported AWS services
103
110
----------------------
@@ -361,6 +368,65 @@ The input context requires:
361
368
362
369
The *awsWaitIn * context supports text `Substitutions `_.
363
370
371
+ pypyraws.steps.waitfor
372
+ ======================
373
+ Custom waiter for any aws client operation. Where `pypyraws.steps.wait `_ uses
374
+ the official AWS waiters from the low-level client api, this step allows you to
375
+ execute *any * aws low-level client method and wait for a specified field in
376
+ the response to become the value you want it to be.
377
+
378
+ This is especially handy for things like Beanstalk, because Elastic Beanstalk
379
+ does not have Waiters for environment creation.
380
+
381
+ The input context looks like this:
382
+
383
+ .. code-block :: yaml
384
+
385
+ awsWaitFor :
386
+ awsClientIn : # required. awsClientIn allows the same arguments as pypyraws.steps.client.
387
+ serviceName : elasticbeanstalk
388
+ methodName : describe_environments
389
+ methodArgs :
390
+ ApplicationName : my wonderful beanstalk default application
391
+ EnvironmentNames :
392
+ - my-wonderful-environment
393
+ VersionLabel : v0.1
394
+ waitForField : ' {Environments[0][Status]}' # required. format expression for field name to check in awsClient response
395
+ toBe : Ready # required. Stop waiting when waitForField equals this value
396
+ pollInterval : 30 # optional. Seconds to wait between polling attempts. Defaults to 30 if not specified.
397
+ maxAttempts : 10 # optional. Defaults to 10 if not specified.
398
+ errorOnWaitTimeout : True # optional. Defaults to True if not specified. Stop processing if maxAttempts exhausted without reaching toBe value.
399
+
400
+ See `pypyraws.steps.client `_ for a full listing of available arguments under
401
+ *awsClientIn *.
402
+
403
+ If ``errorOnWaitTimeout `` is True and ``max_attempts `` exhaust before reaching
404
+ the desired target state, pypyr will stop processing with a
405
+ ``pypyraws.errors.WaitTimeOut `` error.
406
+
407
+ Once this step completes it adds ``awsWaitForTimedOut `` to the pypyr context.
408
+ This is a boolean value with values:
409
+
410
+ +--------------------------+---------------------------------------------------+
411
+ | awsWaitForTimedOut | Description |
412
+ +--------------------------+---------------------------------------------------+
413
+ | True | ``errorOnWaitTimeout=False `` and ``max_attempts `` |
414
+ | | exhausted without reaching ``toBe ``. |
415
+ +--------------------------+---------------------------------------------------+
416
+ | False | ``waitForField ``'s value becomes ``toBe `` within |
417
+ | | ``max_attempts ``. |
418
+ +--------------------------+---------------------------------------------------+
419
+
420
+
421
+ The *awsWaitFor * context supports text `Substitutions `_. Do note that while
422
+ ``waitForField `` uses substitution style format strings, the substitutions are
423
+ made against the response object that returns from the aws client call specified
424
+ in *awsClientIn *, and not from the pypyr context itself.
425
+
426
+ See a worked example for an `elastic beanstalk custom waiter for environmment
427
+ creation here
428
+ <https://github.com/pypyr/pypyr-example/blob/master/pipelines/aws-beanstalk-waitfor.yaml> `__.
429
+
364
430
*************
365
431
Substitutions
366
432
*************
0 commit comments