Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS dev guide: Minor formatting #53178

Merged
merged 1 commit into from
Mar 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/ansible/modules/cloud/amazon/GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Guidelines for AWS modules
# Guidelines for Ansible Amazon AWS module development

The Ansible AWS modules and these guidelines are maintained by the Ansible AWS Working Group. For
further information see
[the AWS working group community page](https://github.com/ansible/community/tree/master/group-aws).
[the AWS working group community page](https://github.com/ansible/community/wiki/aws).
If you are planning to contribute AWS modules to Ansible then getting in touch with the working
group will be a good way to start, especially because a similar module may already be under
development.
Expand All @@ -25,15 +25,15 @@ the amount of boilerplate code.

Change

```
```python
from ansible.module_utils.basic import AnsibleModule
...
module = AnsibleModule(...)
```

to

```
```python
from ansible.module_utils.aws.core import AnsibleAWSModule
...
module = AnsibleAWSModule(...)
Expand All @@ -47,7 +47,7 @@ When porting, keep in mind that AnsibleAWSModule also will add the default ec2
argument spec by default. In pre-port modules, you should see common arguments
specified with:

```
```python
def main():
argument_spec = ec2_argument_spec()
argument_spec.update(dict(
Expand Down Expand Up @@ -323,7 +323,7 @@ except botocore.exceptions.BotoCoreError as e:
module.fail_json_aws(e, msg="Couldn't obtain frooble %s" % name)
```

### API throttling and pagination
### API throttling (rate limiting) and pagination

For methods that return a lot of results, boto3 often provides
[paginators](http://boto3.readthedocs.io/en/latest/guide/paginators.html). If the method
Expand All @@ -343,9 +343,9 @@ the [cloud module_utils](/lib/ansible/module_utils/cloud.py)
and [AWS Architecture blog](https://www.awsarchitectureblog.com/2015/03/backoff.html)
for more details.

The combination of these two approaches is then
The combination of these two approaches is then:

```
```python
@AWSRetry.exponential_backoff(retries=5, delay=5)
def describe_some_resource_with_backoff(client, **kwargs):
paginator = client.get_paginator('describe_some_resource')
Expand All @@ -368,7 +368,7 @@ To handle authorization failures or parameter validation errors in
`describe_some_resource_with_backoff`, where we just want to return `None` if
the resource doesn't exist and not retry, we need:

```
```python
@AWSRetry.exponential_backoff(retries=5, delay=5)
def describe_some_resource_with_backoff(client, **kwargs):
try:
Expand All @@ -394,7 +394,7 @@ To make use of AWSRetry easier, it can now be wrapped around a client returned
by `AnsibleAWSModule`. any call from a client. To add retries to a client,
create a client:

```
```python
module.client('ec2', retry_decorator=AWSRetry.jittered_backoff(retries=10))
```

Expand Down