| 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_system_replacemsggroup_mm7 |
| 15 |
short_description: Replacement message table entries. |
| 16 |
version_added: "2.0.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 |
replacemsg-group: |
| 29 |
description: Deprecated, please use "replacemsg_group" |
| 30 |
type: str |
| 31 |
replacemsg_group: |
| 32 |
description: The parameter (replacemsg-group) in requested url. |
| 33 |
type: str |
| 34 |
system_replacemsggroup_mm7: |
| 35 |
description: The top level parameters set. |
| 36 |
required: false |
| 37 |
type: dict |
| 38 |
suboptions: |
| 39 |
add_smil: |
| 40 |
aliases: ['add-smil'] |
| 41 |
type: str |
| 42 |
description: Add message encapsulation |
| 43 |
choices: ['disable', 'enable'] |
| 44 |
addr_type: |
| 45 |
aliases: ['addr-type'] |
| 46 |
type: str |
| 47 |
description: From address type |
| 48 |
choices: ['rfc2822-addr', 'number', 'short-code'] |
| 49 |
allow_content_adaptation: |
| 50 |
aliases: ['allow-content-adaptation'] |
| 51 |
type: str |
| 52 |
description: Allow content adaptations |
| 53 |
choices: ['disable', 'enable'] |
| 54 |
charset: |
| 55 |
type: str |
| 56 |
description: Character encoding used for replacement message |
| 57 |
choices: ['us-ascii', 'utf-8'] |
| 58 |
class: |
| 59 |
type: str |
| 60 |
description: Message class |
| 61 |
choices: ['personal', 'advertisement', 'informational', 'auto', 'not-included'] |
| 62 |
format: |
| 63 |
type: str |
| 64 |
description: Format flag. |
| 65 |
choices: ['none', 'text', 'html', 'wml'] |
| 66 |
from: |
| 67 |
type: str |
| 68 |
description: From address |
| 69 |
from_sender: |
| 70 |
aliases: ['from-sender'] |
| 71 |
type: str |
| 72 |
description: Notification message sent from recipient |
| 73 |
choices: ['disable', 'enable'] |
| 74 |
header: |
| 75 |
type: str |
| 76 |
description: Header flag. |
| 77 |
choices: ['none', 'http', '8bit'] |
| 78 |
image: |
| 79 |
type: str |
| 80 |
description: Message string. |
| 81 |
fmgr_message: |
| 82 |
type: str |
| 83 |
description: Message text |
| 84 |
msg_type: |
| 85 |
aliases: ['msg-type'] |
| 86 |
type: str |
| 87 |
description: Message type. |
| 88 |
required: true |
| 89 |
priority: |
| 90 |
type: str |
| 91 |
description: Message priority |
| 92 |
choices: ['low', 'normal', 'high', 'not-included'] |
| 93 |
rsp_status: |
| 94 |
aliases: ['rsp-status'] |
| 95 |
type: str |
| 96 |
description: Response status |
| 97 |
choices: ['success', 'partial-success', 'client-err', 'oper-restrict', 'addr-err', |
| 98 |
'addr-not-found', 'content-refused', 'msg-id-not-found', |
| 99 |
'link-id-not-found', 'msg-fmt-corrupt', 'app-id-not-found', |
| 100 |
'repl-app-id-not-found', 'srv-err', 'not-possible', 'msg-rejected', |
| 101 |
'multiple-addr-not-supp', 'app-addr-not-supp', 'gen-service-err', |
| 102 |
'improper-ident', 'unsupp-ver', 'unsupp-oper', 'validation-err', |
| 103 |
'service-err', 'service-unavail', 'service-denied', 'app-denied'] |
| 104 |
smil_part: |
| 105 |
aliases: ['smil-part'] |
| 106 |
type: str |
| 107 |
description: Message encapsulation text |
| 108 |
subject: |
| 109 |
type: str |
| 110 |
description: Subject text string |
| 111 |
''' |
| 112 |
|
| 113 |
EXAMPLES = ''' |
| 114 |
- name: Example playbook (generated based on argument schema) |
| 115 |
hosts: fortimanagers |
| 116 |
connection: httpapi |
| 117 |
gather_facts: false |
| 118 |
tasks: |
| 119 |
- name: Replacement message table entries. |
| 120 |
fortinet.fortimanager.fmgr_system_replacemsggroup_mm7: |
| 121 |
# workspace_locking_adom: <global or your adom name> |
| 122 |
adom: <your own value> |
| 123 |
replacemsg_group: <your own value> |
| 124 |
state: present # <value in [present, absent]> |
| 125 |
system_replacemsggroup_mm7: |
| 126 |
msg_type: "your value" # Required variable, string |
| 127 |
# add_smil: <value in [disable, enable]> |
| 128 |
# addr_type: <value in [rfc2822-addr, number, short-code]> |
| 129 |
# allow_content_adaptation: <value in [disable, enable]> |
| 130 |
# charset: <value in [us-ascii, utf-8]> |
| 131 |
# class: <value in [personal, advertisement, informational, ...]> |
| 132 |
# format: <value in [none, text, html, ...]> |
| 133 |
# from: <string> |
| 134 |
# from_sender: <value in [disable, enable]> |
| 135 |
# header: <value in [none, http, 8bit]> |
| 136 |
# image: <string> |
| 137 |
# fmgr_message: <string> |
| 138 |
# priority: <value in [low, normal, high, ...]> |
| 139 |
# rsp_status: <value in [success, partial-success, client-err, ...]> |
| 140 |
# smil_part: <string> |
| 141 |
# subject: <string> |
| 142 |
''' |
| 143 |
|
| 144 |
RETURN = ''' |
| 145 |
meta: |
| 146 |
description: The result of the request. |
| 147 |
type: dict |
| 148 |
returned: always |
| 149 |
contains: |
| 150 |
request_url: |
| 151 |
description: The full url requested. |
| 152 |
returned: always |
| 153 |
type: str |
| 154 |
sample: /sys/login/user |
| 155 |
response_code: |
| 156 |
description: The status of api request. |
| 157 |
returned: always |
| 158 |
type: int |
| 159 |
sample: 0 |
| 160 |
response_data: |
| 161 |
description: The api response. |
| 162 |
type: list |
| 163 |
returned: always |
| 164 |
response_message: |
| 165 |
description: The descriptive message of the api response. |
| 166 |
type: str |
| 167 |
returned: always |
| 168 |
sample: OK. |
| 169 |
system_information: |
| 170 |
description: The information of the target system. |
| 171 |
type: dict |
| 172 |
returned: always |
| 173 |
rc: |
| 174 |
description: The status the request. |
| 175 |
type: int |
| 176 |
returned: always |
| 177 |
sample: 0 |
| 178 |
version_check_warning: |
| 179 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 180 |
type: list |
| 181 |
returned: complex |
| 182 |
''' |
| 183 |
from ansible.module_utils.basic import AnsibleModule |
| 184 |
from ansible.module_utils.connection import Connection |
| 185 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 186 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 187 |
|
| 188 |
|
| 189 |
def main(): |
| 190 |
urls_list = [ |
| 191 |
'/pm/config/adom/{adom}/obj/system/replacemsg-group/{replacemsg-group}/mm7', |
| 192 |
'/pm/config/global/obj/system/replacemsg-group/{replacemsg-group}/mm7' |
| 193 |
] |
| 194 |
module_arg_spec = { |
| 195 |
'adom': {'required': True, 'type': 'str'}, |
| 196 |
'replacemsg-group': {'type': 'str', 'api_name': 'replacemsg_group'}, |
| 197 |
'replacemsg_group': {'type': 'str'}, |
| 198 |
'revision_note': {'type': 'str'}, |
| 199 |
'system_replacemsggroup_mm7': { |
| 200 |
'type': 'dict', 'v_range': [['6.0.0', '7.6.2']], |
| 201 |
'options': { |
| 202 |
'add-smil': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 203 |
'addr-type': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['rfc2822-addr', 'number', 'short-code'], 'type': 'str'}, |
| 204 |
'allow-content-adaptation': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 205 |
'charset': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['us-ascii', 'utf-8'], 'type': 'str'}, |
| 206 |
'class': { |
| 207 |
'v_range': [['6.0.0', '7.6.2']], |
| 208 |
'choices': ['personal', 'advertisement', 'informational', 'auto', 'not-included'], |
| 209 |
'type': 'str' |
| 210 |
}, |
| 211 |
'format': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'text', 'html', 'wml'], 'type': 'str'}, |
| 212 |
'from': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'}, |
| 213 |
'from-sender': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 214 |
'header': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'http', '8bit'], 'type': 'str'}, |
| 215 |
'image': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'}, |
| 216 |
'fmgr_message': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'}, |
| 217 |
'msg-type': {'v_range': [['6.0.0', '7.6.2']], 'required': True, 'type': 'str'}, |
| 218 |
'priority': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['low', 'normal', 'high', 'not-included'], 'type': 'str'}, |
| 219 |
'rsp-status': { |
| 220 |
'v_range': [['6.0.0', '7.6.2']], |
| 221 |
'choices': [ |
| 222 |
'success', 'partial-success', 'client-err', 'oper-restrict', 'addr-err', 'addr-not-found', 'content-refused', 'msg-id-not-found', |
| 223 |
'link-id-not-found', 'msg-fmt-corrupt', 'app-id-not-found', 'repl-app-id-not-found', 'srv-err', 'not-possible', 'msg-rejected', |
| 224 |
'multiple-addr-not-supp', 'app-addr-not-supp', 'gen-service-err', 'improper-ident', 'unsupp-ver', 'unsupp-oper', |
| 225 |
'validation-err', 'service-err', 'service-unavail', 'service-denied', 'app-denied' |
| 226 |
], |
| 227 |
'type': 'str' |
| 228 |
}, |
| 229 |
'smil-part': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'}, |
| 230 |
'subject': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'} |
| 231 |
} |
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
module_option_spec = get_module_arg_spec('full crud') |
| 236 |
module_arg_spec.update(module_option_spec) |
| 237 |
check_galaxy_version(module_arg_spec) |
| 238 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_replacemsggroup_mm7'), |
| 239 |
supports_check_mode=True) |
| 240 |
if not module._socket_path: |
| 241 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 242 |
connection = Connection(module._socket_path) |
| 243 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 244 |
'msg-type', 'data', module, connection) |
| 245 |
fmgr.process_crud() |
| 246 |
module.exit_json(meta=module.params) |
| 247 |
|
| 248 |
|
| 249 |
if __name__ == '__main__': |
| 250 |
main() |