| 1 |
|
| 2 |
from __future__ import absolute_import, division, print_function |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
__metaclass__ = type |
| 7 |
|
| 8 |
ANSIBLE_METADATA = {'status': ['preview'], |
| 9 |
'supported_by': 'community', |
| 10 |
'metadata_version': '1.1'} |
| 11 |
|
| 12 |
DOCUMENTATION = ''' |
| 13 |
--- |
| 14 |
module: fmgr_cloud_orchestaws |
| 15 |
short_description: Cloud orchest aws |
| 16 |
version_added: "2.2.0" |
| 17 |
extends_documentation_fragment: |
| 18 |
- fortinet.fortimanager.general |
| 19 |
- fortinet.fortimanager.general.full_crud |
| 20 |
options: |
| 21 |
revision_note: |
| 22 |
description: The change note that can be specified when an object is created or updated. |
| 23 |
type: str |
| 24 |
adom: |
| 25 |
description: The parameter (adom) in requested url. |
| 26 |
type: str |
| 27 |
required: true |
| 28 |
cloud_orchestaws: |
| 29 |
description: The top level parameters set. |
| 30 |
required: false |
| 31 |
type: dict |
| 32 |
suboptions: |
| 33 |
connector: |
| 34 |
type: str |
| 35 |
description: Connector. |
| 36 |
name: |
| 37 |
type: str |
| 38 |
description: Name. |
| 39 |
required: true |
| 40 |
region_name: |
| 41 |
aliases: ['region-name'] |
| 42 |
type: str |
| 43 |
description: Region name. |
| 44 |
choices: ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'eu-west-1', |
| 45 |
'eu-west-2', 'eu-west-3', 'eu-north-1', 'eu-south-1', 'eu-south-2', |
| 46 |
'eu-central-1', 'eu-central-2', 'ca-central-1', 'ap-southeast-1', |
| 47 |
'ap-southeast-2', 'ap-southeast-3', 'ap-southeast-4', 'ap-south-1', |
| 48 |
'ap-south-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', |
| 49 |
'af-south-1', 'me-central-1', 'me-south-1', 'sa-east-1', 'ap-east-1', |
| 50 |
'us-gov-east-1', 'us-gov-west-1', 'ca-west-1', 'il-central-1', |
| 51 |
'ap-southeast-5', 'ap-southeast-7', 'mx-central-1'] |
| 52 |
template_configuration: |
| 53 |
aliases: ['template-configuration'] |
| 54 |
type: str |
| 55 |
description: Template configuration. |
| 56 |
''' |
| 57 |
|
| 58 |
EXAMPLES = ''' |
| 59 |
- name: Example playbook (generated based on argument schema) |
| 60 |
hosts: fortimanagers |
| 61 |
connection: httpapi |
| 62 |
gather_facts: false |
| 63 |
tasks: |
| 64 |
- name: Cloud orchest aws |
| 65 |
fortinet.fortimanager.fmgr_cloud_orchestaws: |
| 66 |
# workspace_locking_adom: <global or your adom name> |
| 67 |
adom: <your own value> |
| 68 |
state: present # <value in [present, absent]> |
| 69 |
cloud_orchestaws: |
| 70 |
name: "your value" # Required variable, string |
| 71 |
# connector: <string> |
| 72 |
# region_name: <value in [us-east-1, us-east-2, us-west-1, ...]> |
| 73 |
# template_configuration: <string> |
| 74 |
''' |
| 75 |
|
| 76 |
RETURN = ''' |
| 77 |
meta: |
| 78 |
description: The result of the request. |
| 79 |
type: dict |
| 80 |
returned: always |
| 81 |
contains: |
| 82 |
request_url: |
| 83 |
description: The full url requested. |
| 84 |
returned: always |
| 85 |
type: str |
| 86 |
sample: /sys/login/user |
| 87 |
response_code: |
| 88 |
description: The status of api request. |
| 89 |
returned: always |
| 90 |
type: int |
| 91 |
sample: 0 |
| 92 |
response_data: |
| 93 |
description: The api response. |
| 94 |
type: list |
| 95 |
returned: always |
| 96 |
response_message: |
| 97 |
description: The descriptive message of the api response. |
| 98 |
type: str |
| 99 |
returned: always |
| 100 |
sample: OK. |
| 101 |
system_information: |
| 102 |
description: The information of the target system. |
| 103 |
type: dict |
| 104 |
returned: always |
| 105 |
rc: |
| 106 |
description: The status the request. |
| 107 |
type: int |
| 108 |
returned: always |
| 109 |
sample: 0 |
| 110 |
version_check_warning: |
| 111 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 112 |
type: list |
| 113 |
returned: complex |
| 114 |
''' |
| 115 |
from ansible.module_utils.basic import AnsibleModule |
| 116 |
from ansible.module_utils.connection import Connection |
| 117 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 118 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 119 |
|
| 120 |
|
| 121 |
def main(): |
| 122 |
urls_list = [ |
| 123 |
'/pm/config/adom/{adom}/obj/cloud/orchest-aws', |
| 124 |
'/pm/config/global/obj/cloud/orchest-aws' |
| 125 |
] |
| 126 |
module_arg_spec = { |
| 127 |
'adom': {'required': True, 'type': 'str'}, |
| 128 |
'revision_note': {'type': 'str'}, |
| 129 |
'cloud_orchestaws': { |
| 130 |
'type': 'dict', 'v_range': [['7.4.0', '']], |
| 131 |
'options': { |
| 132 |
'connector': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 133 |
'name': {'v_range': [['7.4.0', '']], 'required': True, 'type': 'str'}, |
| 134 |
'region-name': { |
| 135 |
'v_range': [['7.4.0', '']], |
| 136 |
'choices': [ |
| 137 |
'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'eu-north-1', 'eu-south-1', |
| 138 |
'eu-south-2', 'eu-central-1', 'eu-central-2', 'ca-central-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-southeast-3', |
| 139 |
'ap-southeast-4', 'ap-south-1', 'ap-south-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'af-south-1', 'me-central-1', |
| 140 |
'me-south-1', 'sa-east-1', 'ap-east-1', 'us-gov-east-1', 'us-gov-west-1', 'ca-west-1', 'il-central-1', 'ap-southeast-5', |
| 141 |
'ap-southeast-7', 'mx-central-1' |
| 142 |
], |
| 143 |
'type': 'str' |
| 144 |
}, |
| 145 |
'template-configuration': {'v_range': [['7.4.0', '']], 'type': 'str'} |
| 146 |
} |
| 147 |
} |
| 148 |
} |
| 149 |
|
| 150 |
module_option_spec = get_module_arg_spec('full crud') |
| 151 |
module_arg_spec.update(module_option_spec) |
| 152 |
check_galaxy_version(module_arg_spec) |
| 153 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'cloud_orchestaws'), |
| 154 |
supports_check_mode=True) |
| 155 |
if not module._socket_path: |
| 156 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 157 |
connection = Connection(module._socket_path) |
| 158 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 159 |
'name', 'data', module, connection) |
| 160 |
fmgr.process_crud() |
| 161 |
module.exit_json(meta=module.params) |
| 162 |
|
| 163 |
|
| 164 |
if __name__ == '__main__': |
| 165 |
main() |