| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright (c) 2021, Cisco Systems |
| 5 |
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
DOCUMENTATION = r""" |
| 8 |
module: networks_webhooks_http_servers |
| 9 |
short_description: Resource module for networks _webhooks _httpservers |
| 10 |
description: |
| 11 |
- Manage operations create, update and delete of the resource networks _webhooks |
| 12 |
_httpservers. |
| 13 |
- Add an HTTP server to a network. |
| 14 |
- Delete an HTTP server from a network. |
| 15 |
- Update an HTTP server. To change a URL, create a new HTTP server. |
| 16 |
version_added: '1.0.0' |
| 17 |
extends_documentation_fragment: |
| 18 |
- cisco.meraki.module |
| 19 |
author: Francisco Munoz (@fmunoz) |
| 20 |
options: |
| 21 |
httpServerId: |
| 22 |
description: HttpServerId path parameter. Http server ID. |
| 23 |
type: str |
| 24 |
name: |
| 25 |
description: A name for easy reference to the HTTP server. |
| 26 |
type: str |
| 27 |
networkId: |
| 28 |
description: NetworkId path parameter. Network ID. |
| 29 |
type: str |
| 30 |
payloadTemplate: |
| 31 |
description: The payload template to use when posting data to the HTTP server. |
| 32 |
suboptions: |
| 33 |
name: |
| 34 |
description: The name of the payload template. |
| 35 |
type: str |
| 36 |
payloadTemplateId: |
| 37 |
description: The ID of the payload template. Defaults to 'wpt_00001' for the |
| 38 |
Meraki template. For Meraki-included templates for the Webex (included) |
| 39 |
template use 'wpt_00002'; for the Slack (included) template use 'wpt_00003'; |
| 40 |
for the Microsoft Teams (included) template use 'wpt_00004'; for the ServiceNow |
| 41 |
(included) template use 'wpt_00006'; for the PagerDuty (included) template |
| 42 |
use 'wpt_00007'. |
| 43 |
type: str |
| 44 |
type: dict |
| 45 |
sharedSecret: |
| 46 |
description: A shared secret that will be included in POSTs sent to the HTTP server. |
| 47 |
This secret can be used to verify that the request was sent by Meraki. |
| 48 |
type: str |
| 49 |
url: |
| 50 |
description: The URL of the HTTP server. Once set, cannot be updated. |
| 51 |
type: str |
| 52 |
requirements: |
| 53 |
- meraki >= 2.4.9 |
| 54 |
- python >= 3.5 |
| 55 |
seealso: |
| 56 |
- name: Cisco Meraki documentation for networks createNetworkWebhooksHttpServer |
| 57 |
description: Complete reference of the createNetworkWebhooksHttpServer API. |
| 58 |
link: https://developer.cisco.com/meraki/api-v1/#!create-network-webhooks-http-server |
| 59 |
- name: Cisco Meraki documentation for networks deleteNetworkWebhooksHttpServer |
| 60 |
description: Complete reference of the deleteNetworkWebhooksHttpServer API. |
| 61 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-network-webhooks-http-server |
| 62 |
- name: Cisco Meraki documentation for networks updateNetworkWebhooksHttpServer |
| 63 |
description: Complete reference of the updateNetworkWebhooksHttpServer API. |
| 64 |
link: https://developer.cisco.com/meraki/api-v1/#!update-network-webhooks-http-server |
| 65 |
notes: |
| 66 |
- SDK Method used are |
| 67 |
networks.Networks.create_network_webhooks_http_server, |
| 68 |
networks.Networks.delete_network_webhooks_http_server, |
| 69 |
networks.Networks.update_network_webhooks_http_server, |
| 70 |
- Paths used are |
| 71 |
post /networks/{networkId}/webhooks/httpServers, |
| 72 |
delete /networks/{networkId}/webhooks/httpServers/{httpServerId}, |
| 73 |
put /networks/{networkId}/webhooks/httpServers/{httpServerId}, |
| 74 |
""" |
| 75 |
|
| 76 |
EXAMPLES = r""" |
| 77 |
- name: Create |
| 78 |
cisco.meraki.networks_webhooks_http_servers: |
| 79 |
meraki_api_key: "{{ meraki_api_key }}" |
| 80 |
meraki_base_url: "{{ meraki_base_url }}" |
| 81 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 82 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 83 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 84 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 85 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 86 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 87 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 88 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 89 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 90 |
meraki_output_log: "{{ meraki_output_log }}" |
| 91 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 92 |
meraki_log_path: "{{ meraki_log_path }}" |
| 93 |
meraki_print_console: "{{ meraki_print_console }}" |
| 94 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 95 |
meraki_simulate: "{{ meraki_simulate }}" |
| 96 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 97 |
meraki_caller: "{{ meraki_caller }}" |
| 98 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 99 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 100 |
state: present |
| 101 |
name: Example Webhook Server |
| 102 |
networkId: string |
| 103 |
payloadTemplate: |
| 104 |
name: Meraki (included) |
| 105 |
payloadTemplateId: wpt_00001 |
| 106 |
sharedSecret: shhh |
| 107 |
url: https://example.com |
| 108 |
- name: Update by id |
| 109 |
cisco.meraki.networks_webhooks_http_servers: |
| 110 |
meraki_api_key: "{{ meraki_api_key }}" |
| 111 |
meraki_base_url: "{{ meraki_base_url }}" |
| 112 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 113 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 114 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 115 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 116 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 117 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 118 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 119 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 120 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 121 |
meraki_output_log: "{{ meraki_output_log }}" |
| 122 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 123 |
meraki_log_path: "{{ meraki_log_path }}" |
| 124 |
meraki_print_console: "{{ meraki_print_console }}" |
| 125 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 126 |
meraki_simulate: "{{ meraki_simulate }}" |
| 127 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 128 |
meraki_caller: "{{ meraki_caller }}" |
| 129 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 130 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 131 |
state: present |
| 132 |
httpServerId: string |
| 133 |
name: Example Webhook Server |
| 134 |
networkId: string |
| 135 |
payloadTemplate: |
| 136 |
payloadTemplateId: wpt_00001 |
| 137 |
sharedSecret: shhh |
| 138 |
- name: Delete by id |
| 139 |
cisco.meraki.networks_webhooks_http_servers: |
| 140 |
meraki_api_key: "{{ meraki_api_key }}" |
| 141 |
meraki_base_url: "{{ meraki_base_url }}" |
| 142 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 143 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 144 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 145 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 146 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 147 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 148 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 149 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 150 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 151 |
meraki_output_log: "{{ meraki_output_log }}" |
| 152 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 153 |
meraki_log_path: "{{ meraki_log_path }}" |
| 154 |
meraki_print_console: "{{ meraki_print_console }}" |
| 155 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 156 |
meraki_simulate: "{{ meraki_simulate }}" |
| 157 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 158 |
meraki_caller: "{{ meraki_caller }}" |
| 159 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 160 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 161 |
state: absent |
| 162 |
httpServerId: string |
| 163 |
networkId: string |
| 164 |
""" |
| 165 |
RETURN = r""" |
| 166 |
meraki_response: |
| 167 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 168 |
returned: always |
| 169 |
type: dict |
| 170 |
sample: > |
| 171 |
{ |
| 172 |
"id": "string", |
| 173 |
"name": "string", |
| 174 |
"url": "string", |
| 175 |
"networkId": "string", |
| 176 |
"payloadTemplate": { |
| 177 |
"payloadTemplateId": "string", |
| 178 |
"name": "string" |
| 179 |
} |
| 180 |
} |
| 181 |
""" |