Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Name | Description |
[linode.cloud.placement_group_info](./docs/modules/placement_group_info.md)|Get info about a Linode Placement Group.|
[linode.cloud.profile_info](./docs/modules/profile_info.md)|Get info about a Linode Profile.|
[linode.cloud.region_info](./docs/modules/region_info.md)|Get info about a Linode Region.|
[linode.cloud.region_vpc_availability_info](./docs/modules/region_vpc_availability_info.md)|Get info about a Linode Region VPC Availability.|
[linode.cloud.ssh_key_info](./docs/modules/ssh_key_info.md)|Get info about a Linode SSH Key.|
[linode.cloud.stackscript_info](./docs/modules/stackscript_info.md)|Get info about a Linode StackScript.|
[linode.cloud.token_info](./docs/modules/token_info.md)|Get info about a Linode Personal Access Token.|
Expand Down Expand Up @@ -144,6 +145,7 @@ Name | Description |
[linode.cloud.object_storage_quota_list](./docs/modules/object_storage_quota_list.md)|List and filter on Object Storage Quotas.|
[linode.cloud.placement_group_list](./docs/modules/placement_group_list.md)|List and filter on Placement Groups.|
[linode.cloud.region_list](./docs/modules/region_list.md)|List and filter on Regions.|
[linode.cloud.regions_vpc_availability_list](./docs/modules/regions_vpc_availability_list.md)|List and filter on Regions VPC Availability.|
Comment thread
dawiddzhafarov marked this conversation as resolved.
[linode.cloud.ssh_key_list](./docs/modules/ssh_key_list.md)|List and filter on SSH Keys.|
[linode.cloud.stackscript_list](./docs/modules/stackscript_list.md)|List and filter on StackScripts.|
[linode.cloud.token_list](./docs/modules/token_list.md)|List and filter on Tokens.|
Expand Down
49 changes: 49 additions & 0 deletions docs/modules/region_vpc_availability_info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# region_vpc_availability_info

Get info about a Linode Region VPC Availability.

WARNING! This module makes use of beta endpoints and requires the C(api_version) field be explicitly set to C(v4beta).

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
- [Return Values](#return-values)

## Minimum Required Fields
| Field | Type | Required | Description |
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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). |

Comment thread
dawiddzhafarov marked this conversation as resolved.
## Examples

```yaml
- name: Get Info of a Linode Region VPC Availability
linode.cloud.region_vpc_availability_info:
Comment thread
dawiddzhafarov marked this conversation as resolved.
id: us-mia
```


## Parameters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `id` | <center>`str`</center> | <center>**Required**</center> | The ID of the Region VPC Availability to resolve. |

## Return Values

- `region_vpc_availability` - The returned Region VPC Availability.

- Sample Response:
```json
{
"region": "us-mia",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
}
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-region-vpc-availability) for a list of returned fields


76 changes: 76 additions & 0 deletions docs/modules/regions_vpc_availability_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# regions_vpc_availability_list

List and filter on Regions VPC Availability.

WARNING! This module makes use of beta endpoints and requires the C(api_version) field be explicitly set to C(v4beta).

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
- [Return Values](#return-values)

## Minimum Required Fields
| Field | Type | Required | Description |
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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). |
Comment thread
dawiddzhafarov marked this conversation as resolved.

## Examples

```yaml
- name: List all of the Linode regions VPC availability
linode.cloud.regions_vpc_availability_list: {}
Comment thread
dawiddzhafarov marked this conversation as resolved.
Outdated
```


## Parameters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `order` | <center>`str`</center> | <center>Optional</center> | The order to list Regions VPC Availability in. **(Choices: `desc`, `asc`; Default: `asc`)** |
| `order_by` | <center>`str`</center> | <center>Optional</center> | The attribute to order Regions VPC Availability by. |
| [`filters` (sub-options)](#filters) | <center>`list`</center> | <center>Optional</center> | A list of filters to apply to the resulting Regions VPC Availability. |
| `count` | <center>`int`</center> | <center>Optional</center> | The number of Regions VPC Availability to return. If undefined, all results will be returned. |

### filters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `name` | <center>`str`</center> | <center>**Required**</center> | The name of the field to filter on. Valid filterable fields can be found [here](https://techdocs.akamai.com/linode-api/reference/get-regions-vpc-availability). |
| `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. |

## Return Values

- `regions_vpc_availability` - The returned Regions VPC Availability.

- Sample Response:
```json
[
{
"region": "nl-ams",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
},
{
"region": "fr-par-2",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
},
{
"region": "jp-tyo-3",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
}
]
```
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-regions-vpc-availability) for a list of returned fields


Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Documentation fragments for the region_vpc_availability_info module"""

specdoc_examples = ['''
- name: Get Info of a Linode Region VPC Availability
linode.cloud.region_vpc_availability_info:
Comment thread
dawiddzhafarov marked this conversation as resolved.
id: us-mia''']

result_region_vpc_availability_samples = ['''{
"region": "us-mia",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
}''']
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Documentation fragments for the regions_vpc_availability_list module"""

specdoc_examples = ['''
- name: List all of the Linode regions VPC availability
linode.cloud.regions_vpc_availability_list: {}''']
Comment thread
dawiddzhafarov marked this conversation as resolved.
Outdated

result_regions_vpc_availability_samples = ['''[
{
"region": "nl-ams",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
},
{
"region": "fr-par-2",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
},
{
"region": "jp-tyo-3",
"available": true,
"available_ipv6_prefix_lengths": [
48,
52
]
}
]''']
51 changes: 51 additions & 0 deletions plugins/modules/region_vpc_availability_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

"""This module allows users to retrieve information about a Linode Region VPC Availability."""

from __future__ import absolute_import, division, print_function

from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
region_vpc_availability_info as docs,
)
from ansible_collections.linode.cloud.plugins.module_utils.linode_common_info import (
InfoModule,
InfoModuleAttr,
InfoModuleResult,
)
from ansible_specdoc.objects import FieldType
from linode_api4 import Region

module = InfoModule(
examples=docs.specdoc_examples,
primary_result=InfoModuleResult(
display_name="Region VPC Availability",
field_name="region_vpc_availability",
field_type=FieldType.dict,
docs_url="https://techdocs.akamai.com/linode-api/reference/get-region-vpc-availability",
samples=docs.result_region_vpc_availability_samples,
),
attributes=[
InfoModuleAttr(
name="id",
display_name="ID",
type=FieldType.string,
get=lambda client, params: client.load(
Region, params.get("id")
).vpc_availability.dict,
),
],
requires_beta=True,
)

SPECDOC_META = module.spec

DOCUMENTATION = r"""
"""
EXAMPLES = r"""
"""
RETURN = r"""
"""

if __name__ == "__main__":
module.run()
35 changes: 35 additions & 0 deletions plugins/modules/regions_vpc_availability_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

"""This module allows users to list Linode regions VPC availability."""

from __future__ import absolute_import, division, print_function

from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
regions_vpc_availability_list as docs,
)
from ansible_collections.linode.cloud.plugins.module_utils.linode_common_list import (
ListModule,
)

module = ListModule(
result_display_name="Regions VPC Availability",
result_field_name="regions_vpc_availability",
endpoint_template="/regions/vpc-availability",
result_docs_url="https://techdocs.akamai.com/linode-api/reference/get-regions-vpc-availability",
requires_beta=True,
examples=docs.specdoc_examples,
result_samples=docs.result_regions_vpc_availability_samples,
)

SPECDOC_META = module.spec

DOCUMENTATION = r"""
"""
EXAMPLES = r"""
"""
RETURN = r"""
"""

if __name__ == "__main__":
module.run()
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- name: region_vpc_availability_info
block:
- name: Get Info of a Linode Region VPC Availability
linode.cloud.region_vpc_availability_info:
id: us-mia
register: result

- name: Assert region_vpc_availability_info
assert:
that:
- result.region_vpc_availability.region == 'us-mia'
- result.region_vpc_availability.available == true
- result.region_vpc_availability.available_ipv6_prefix_lengths == [48, 52]
Comment thread
dawiddzhafarov marked this conversation as resolved.

environment:
LINODE_UA_PREFIX: '{{ ua_prefix }}'
LINODE_API_TOKEN: '{{ api_token }}'
LINODE_API_URL: '{{ api_url }}'
LINODE_API_VERSION: '{{ api_version }}'
LINODE_CA: '{{ ca_file or "" }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- name: regions_vpc_availability_list
block:
- name: List regions VPC availability
linode.cloud.regions_vpc_availability_list:
register: result

- name: Assert regions_vpc_availability_list
assert:
that:
- result.regions_vpc_availability | length >= 0
Comment thread
dawiddzhafarov marked this conversation as resolved.

environment:
LINODE_UA_PREFIX: '{{ ua_prefix }}'
LINODE_API_TOKEN: '{{ api_token }}'
LINODE_API_URL: '{{ api_url }}'
LINODE_API_VERSION: '{{ api_version }}'
LINODE_CA: '{{ ca_file or "" }}'
Loading