| 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_sql_customskipidx |
| 15 |
short_description: List of aditional SQL skip index fields. |
| 16 |
version_added: "2.1.0" |
| 17 |
extends_documentation_fragment: |
| 18 |
- fortinet.fortimanager.general |
| 19 |
- fortinet.fortimanager.general.full_crud |
| 20 |
options: |
| 21 |
system_sql_customskipidx: |
| 22 |
description: The top level parameters set. |
| 23 |
required: false |
| 24 |
type: dict |
| 25 |
suboptions: |
| 26 |
device_type: |
| 27 |
aliases: ['device-type'] |
| 28 |
type: str |
| 29 |
description: |
| 30 |
- Device type. |
| 31 |
- FortiGate - Set device type to FortiGate. |
| 32 |
- FortiManager - Set device type to FortiManager |
| 33 |
- FortiClient - Set device type to FortiClient. |
| 34 |
- FortiMail - Set device type to FortiMail. |
| 35 |
- FortiWeb - Set device type to FortiWeb. |
| 36 |
- FortiSandbox - Set device type to FortiSandbox |
| 37 |
- FortiProxy - Set device type to FortiProxy |
| 38 |
choices: ['FortiGate', 'FortiManager', 'FortiClient', 'FortiMail', 'FortiWeb', |
| 39 |
'FortiSandbox', 'FortiProxy'] |
| 40 |
id: |
| 41 |
type: int |
| 42 |
description: Add or Edit log index fields. |
| 43 |
required: true |
| 44 |
index_field: |
| 45 |
aliases: ['index-field'] |
| 46 |
type: str |
| 47 |
description: Field to be added to skip index. |
| 48 |
log_type: |
| 49 |
aliases: ['log-type'] |
| 50 |
type: str |
| 51 |
description: |
| 52 |
- Log type. |
| 53 |
- app-ctrl |
| 54 |
- attack |
| 55 |
- content |
| 56 |
- dlp |
| 57 |
- emailfilter |
| 58 |
- event |
| 59 |
- generic |
| 60 |
- history |
| 61 |
- traffic |
| 62 |
- virus |
| 63 |
- voip |
| 64 |
- webfilter |
| 65 |
- netscan |
| 66 |
- fct-event |
| 67 |
- fct-traffic |
| 68 |
- fct-netscan |
| 69 |
- waf |
| 70 |
- gtp |
| 71 |
- dns |
| 72 |
- ssh |
| 73 |
- ssl |
| 74 |
- file-filter |
| 75 |
- asset |
| 76 |
choices: ['app-ctrl', 'attack', 'content', 'dlp', 'emailfilter', 'event', |
| 77 |
'generic', 'history', 'traffic', 'virus', 'voip', 'webfilter', |
| 78 |
'netscan', 'fct-event', 'fct-traffic', 'fct-netscan', 'waf', 'gtp', |
| 79 |
'dns', 'ssh', 'ssl', 'file-filter', 'asset', 'protocol', 'siem', 'ztna', |
| 80 |
'security'] |
| 81 |
''' |
| 82 |
|
| 83 |
EXAMPLES = ''' |
| 84 |
- name: Example playbook (generated based on argument schema) |
| 85 |
hosts: fortimanagers |
| 86 |
connection: httpapi |
| 87 |
gather_facts: false |
| 88 |
tasks: |
| 89 |
- name: List of aditional SQL skip index fields. |
| 90 |
fortinet.fortimanager.fmgr_system_sql_customskipidx: |
| 91 |
# workspace_locking_adom: <global or your adom name> |
| 92 |
state: present # <value in [present, absent]> |
| 93 |
system_sql_customskipidx: |
| 94 |
id: 0 # Required variable, integer |
| 95 |
# device_type: <value in [FortiGate, FortiManager, FortiClient, ...]> |
| 96 |
# index_field: <string> |
| 97 |
# log_type: <value in [app-ctrl, attack, content, ...]> |
| 98 |
''' |
| 99 |
|
| 100 |
RETURN = ''' |
| 101 |
meta: |
| 102 |
description: The result of the request. |
| 103 |
type: dict |
| 104 |
returned: always |
| 105 |
contains: |
| 106 |
request_url: |
| 107 |
description: The full url requested. |
| 108 |
returned: always |
| 109 |
type: str |
| 110 |
sample: /sys/login/user |
| 111 |
response_code: |
| 112 |
description: The status of api request. |
| 113 |
returned: always |
| 114 |
type: int |
| 115 |
sample: 0 |
| 116 |
response_data: |
| 117 |
description: The api response. |
| 118 |
type: list |
| 119 |
returned: always |
| 120 |
response_message: |
| 121 |
description: The descriptive message of the api response. |
| 122 |
type: str |
| 123 |
returned: always |
| 124 |
sample: OK. |
| 125 |
system_information: |
| 126 |
description: The information of the target system. |
| 127 |
type: dict |
| 128 |
returned: always |
| 129 |
rc: |
| 130 |
description: The status the request. |
| 131 |
type: int |
| 132 |
returned: always |
| 133 |
sample: 0 |
| 134 |
version_check_warning: |
| 135 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 136 |
type: list |
| 137 |
returned: complex |
| 138 |
''' |
| 139 |
from ansible.module_utils.basic import AnsibleModule |
| 140 |
from ansible.module_utils.connection import Connection |
| 141 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 142 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 143 |
|
| 144 |
|
| 145 |
def main(): |
| 146 |
urls_list = [ |
| 147 |
'/cli/global/system/sql/custom-skipidx' |
| 148 |
] |
| 149 |
module_arg_spec = { |
| 150 |
'system_sql_customskipidx': { |
| 151 |
'type': 'dict', 'v_range': [['6.2.3', '']], |
| 152 |
'options': { |
| 153 |
'device-type': { |
| 154 |
'v_range': [['6.2.3', '']], |
| 155 |
'choices': ['FortiGate', 'FortiManager', 'FortiClient', 'FortiMail', 'FortiWeb', 'FortiSandbox', 'FortiProxy'], |
| 156 |
'type': 'str' |
| 157 |
}, |
| 158 |
'id': {'v_range': [['6.2.3', '']], 'required': True, 'type': 'int'}, |
| 159 |
'index-field': {'v_range': [['6.2.3', '']], 'type': 'str'}, |
| 160 |
'log-type': { |
| 161 |
'v_range': [['6.2.3', '']], |
| 162 |
'choices': [ |
| 163 |
'app-ctrl', 'attack', 'content', 'dlp', 'emailfilter', 'event', 'generic', 'history', 'traffic', 'virus', 'voip', 'webfilter', |
| 164 |
'netscan', 'fct-event', 'fct-traffic', 'fct-netscan', 'waf', 'gtp', 'dns', 'ssh', 'ssl', 'file-filter', 'asset', 'protocol', |
| 165 |
'siem', 'ztna', 'security' |
| 166 |
], |
| 167 |
'type': 'str' |
| 168 |
} |
| 169 |
} |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
module_option_spec = get_module_arg_spec('full crud') |
| 174 |
module_arg_spec.update(module_option_spec) |
| 175 |
check_galaxy_version(module_arg_spec) |
| 176 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_sql_customskipidx'), |
| 177 |
supports_check_mode=True) |
| 178 |
if not module._socket_path: |
| 179 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 180 |
connection = Connection(module._socket_path) |
| 181 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 182 |
'id', 'data', module, connection) |
| 183 |
fmgr.process_crud() |
| 184 |
module.exit_json(meta=module.params) |
| 185 |
|
| 186 |
|
| 187 |
if __name__ == '__main__': |
| 188 |
main() |