Skip to content

Commit ff57ecb

Browse files
TPT-4111 And regions_vpc_availability_list module
1 parent 1d391b3 commit ff57ecb

5 files changed

Lines changed: 159 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ Name | Description |
144144
[linode.cloud.object_storage_quota_list](./docs/modules/object_storage_quota_list.md)|List and filter on Object Storage Quotas.|
145145
[linode.cloud.placement_group_list](./docs/modules/placement_group_list.md)|List and filter on Placement Groups.|
146146
[linode.cloud.region_list](./docs/modules/region_list.md)|List and filter on Regions.|
147+
[linode.cloud.regions_vpc_availability_list](./docs/modules/regions_vpc_availability_list.md)|List and filter on Regions VPC Availability.|
147148
[linode.cloud.ssh_key_list](./docs/modules/ssh_key_list.md)|List and filter on SSH Keys.|
148149
[linode.cloud.stackscript_list](./docs/modules/stackscript_list.md)|List and filter on StackScripts.|
149150
[linode.cloud.token_list](./docs/modules/token_list.md)|List and filter on Tokens.|
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# regions_vpc_availability_list
2+
3+
List and filter on Regions VPC Availability.
4+
5+
WARNING! This module makes use of beta endpoints and requires the C(api_version) field be explicitly set to C(v4beta).
6+
7+
- [Minimum Required Fields](#minimum-required-fields)
8+
- [Examples](#examples)
9+
- [Parameters](#parameters)
10+
- [Return Values](#return-values)
11+
12+
## Minimum Required Fields
13+
| Field | Type | Required | Description |
14+
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15+
| `api_token` | `str` | **Required** | The Linode account personal access token. It is necessary to run the module. <br/>It can be exposed by the environment variable `LINODE_API_TOKEN` instead. <br/>See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |
16+
17+
## Examples
18+
19+
```yaml
20+
- name: List all of the Linode regions VPC availability
21+
linode.cloud.regions_vpc_availability_list: {}
22+
```
23+
24+
25+
## Parameters
26+
27+
| Field | Type | Required | Description |
28+
|-----------|------|----------|------------------------------------------------------------------------------|
29+
| `order` | <center>`str`</center> | <center>Optional</center> | The order to list Regions VPC Availability in. **(Choices: `desc`, `asc`; Default: `asc`)** |
30+
| `order_by` | <center>`str`</center> | <center>Optional</center> | The attribute to order Regions VPC Availability by. |
31+
| [`filters` (sub-options)](#filters) | <center>`list`</center> | <center>Optional</center> | A list of filters to apply to the resulting Regions VPC Availability. |
32+
| `count` | <center>`int`</center> | <center>Optional</center> | The number of Regions VPC Availability to return. If undefined, all results will be returned. |
33+
34+
### filters
35+
36+
| Field | Type | Required | Description |
37+
|-----------|------|----------|------------------------------------------------------------------------------|
38+
| `name` | <center>`str`</center> | <center>**Required**</center> | The name of the field to filter on. Valid filterable fields can be found [here](TODO). |
39+
| `values` | <center>`list`</center> | <center>**Required**</center> | A list of values to allow for this field. Fields will pass this filter if at least one of these values matches. |
40+
41+
## Return Values
42+
43+
- `regions_vpc_availability` - The returned Regions VPC Availability.
44+
45+
- Sample Response:
46+
```json
47+
[
48+
{
49+
"region": "nl-ams",
50+
"available": true,
51+
"available_ipv6_prefix_lengths": [
52+
48,
53+
52
54+
]
55+
},
56+
{
57+
"region": "fr-par-2",
58+
"available": true,
59+
"available_ipv6_prefix_lengths": [
60+
48,
61+
52
62+
]
63+
},
64+
{
65+
"region": "jp-tyo-3",
66+
"available": true,
67+
"available_ipv6_prefix_lengths": [
68+
48,
69+
52
70+
]
71+
}
72+
]
73+
```
74+
- See the [Linode API response documentation](TODO) for a list of returned fields
75+
76+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Documentation fragments for the regions_vpc_availability_list module"""
2+
3+
specdoc_examples = ['''
4+
- name: List all of the Linode regions VPC availability
5+
linode.cloud.regions_vpc_availability_list: {}''']
6+
7+
result_regions_vpc_availability_samples = ['''[
8+
{
9+
"region": "nl-ams",
10+
"available": true,
11+
"available_ipv6_prefix_lengths": [
12+
48,
13+
52
14+
]
15+
},
16+
{
17+
"region": "fr-par-2",
18+
"available": true,
19+
"available_ipv6_prefix_lengths": [
20+
48,
21+
52
22+
]
23+
},
24+
{
25+
"region": "jp-tyo-3",
26+
"available": true,
27+
"available_ipv6_prefix_lengths": [
28+
48,
29+
52
30+
]
31+
}
32+
]''']
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
3+
4+
"""This module allows users to list Linode regions VPC availability."""
5+
6+
from __future__ import absolute_import, division, print_function
7+
8+
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.regions_vpc_availability_list as docs
9+
from ansible_collections.linode.cloud.plugins.module_utils.linode_common_list import (
10+
ListModule,
11+
)
12+
13+
module = ListModule(
14+
result_display_name="Regions VPC Availability",
15+
result_field_name="regions_vpc_availability",
16+
endpoint_template="/regions/vpc-availability",
17+
result_docs_url="TODO",
18+
requires_beta=True,
19+
examples=docs.specdoc_examples,
20+
result_samples=docs.result_regions_vpc_availability_samples,
21+
)
22+
23+
SPECDOC_META = module.spec
24+
25+
DOCUMENTATION = r"""
26+
"""
27+
EXAMPLES = r"""
28+
"""
29+
RETURN = r"""
30+
"""
31+
32+
if __name__ == "__main__":
33+
module.run()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: regions_vpc_availability_list
2+
block:
3+
- name: List regions VPC availability
4+
linode.cloud.regions_vpc_availability_list:
5+
register: result
6+
7+
- name: Assert regions_vpc_availability_list
8+
assert:
9+
that:
10+
- result.regions_vpc_availability | length >= 0
11+
12+
environment:
13+
LINODE_UA_PREFIX: '{{ ua_prefix }}'
14+
LINODE_API_TOKEN: '{{ api_token }}'
15+
LINODE_API_URL: '{{ api_url }}'
16+
LINODE_API_VERSION: '{{ api_version }}'
17+
LINODE_CA: '{{ ca_file or "" }}'

0 commit comments

Comments
 (0)