-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes: minor_changes: - Include networks_appliance_traffic_shaping_custom_performance_classes_info plugin.
- Loading branch information
1 parent
1572d7e
commit e989263
Showing
6 changed files
with
249 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
namespace: cisco | ||
name: meraki | ||
version: 2.18.1 | ||
version: 2.18.2 | ||
readme: README.md | ||
authors: | ||
- Francisco Muñoz <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
plugins/action/networks_appliance_traffic_shaping_custom_performance_classes_info.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright (c) 2021, Cisco Systems | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
from ansible.plugins.action import ActionBase | ||
try: | ||
from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( | ||
AnsibleArgSpecValidator, | ||
) | ||
except ImportError: | ||
ANSIBLE_UTILS_IS_INSTALLED = False | ||
else: | ||
ANSIBLE_UTILS_IS_INSTALLED = True | ||
from ansible.errors import AnsibleActionFail | ||
from ansible_collections.cisco.meraki.plugins.plugin_utils.meraki import ( | ||
MERAKI, | ||
meraki_argument_spec, | ||
) | ||
|
||
# Get common arguments specification | ||
argument_spec = meraki_argument_spec() | ||
# Add arguments specific for this module | ||
argument_spec.update(dict( | ||
networkId=dict(type="str"), | ||
customPerformanceClassId=dict(type="str"), | ||
)) | ||
|
||
required_if = [] | ||
required_one_of = [] | ||
mutually_exclusive = [] | ||
required_together = [] | ||
|
||
|
||
class ActionModule(ActionBase): | ||
def __init__(self, *args, **kwargs): | ||
if not ANSIBLE_UTILS_IS_INSTALLED: | ||
raise AnsibleActionFail( | ||
"ansible.utils is not installed. Execute 'ansible-galaxy collection install ansible.utils'") | ||
super(ActionModule, self).__init__(*args, **kwargs) | ||
self._supports_async = False | ||
self._supports_check_mode = True | ||
self._result = None | ||
|
||
# Checks the supplied parameters against the argument spec for this module | ||
def _check_argspec(self): | ||
aav = AnsibleArgSpecValidator( | ||
data=self._task.args, | ||
schema=dict(argument_spec=argument_spec), | ||
schema_format="argspec", | ||
schema_conditionals=dict( | ||
required_if=required_if, | ||
required_one_of=required_one_of, | ||
mutually_exclusive=mutually_exclusive, | ||
required_together=required_together, | ||
), | ||
name=self._task.action, | ||
) | ||
valid, errors, self._task.args = aav.validate() | ||
if not valid: | ||
raise AnsibleActionFail(errors) | ||
|
||
def get_object(self, params): | ||
new_object = {} | ||
if params.get("networkId") is not None: | ||
new_object["networkId"] = params.get( | ||
"networkId") | ||
if params.get("customPerformanceClassId") is not None: | ||
new_object["customPerformanceClassId"] = params.get( | ||
"customPerformanceClassId") | ||
return new_object | ||
|
||
def get_all(self, params): | ||
new_object = {} | ||
if params.get("networkId") is not None: | ||
new_object["networkId"] = params.get( | ||
"networkId") | ||
|
||
return new_object | ||
|
||
def run(self, tmp=None, task_vars=None): | ||
self._task.diff = False | ||
self._result = super(ActionModule, self).run(tmp, task_vars) | ||
self._result["changed"] = False | ||
self._check_argspec() | ||
|
||
self._result.update(dict(meraki_response={})) | ||
|
||
meraki = MERAKI(params=self._task.args) | ||
|
||
id = self._task.args.get("customPerformanceClassId") | ||
if id: | ||
response = meraki.exec_meraki( | ||
family="appliance", | ||
function='getNetworkApplianceTrafficShapingCustomPerformanceClass', | ||
params=self.get_object(self._task.args), | ||
) | ||
self._result.update(dict(meraki_response=response)) | ||
self._result.update(meraki.exit_json()) | ||
return self._result | ||
if not id: | ||
response = meraki.exec_meraki( | ||
family="appliance", | ||
function='getNetworkApplianceTrafficShapingCustomPerformanceClasses', | ||
params=self.get_all(self._task.args), | ||
) | ||
self._result.update(dict(meraki_response=response)) | ||
self._result.update(meraki.exit_json()) | ||
return self._result |
120 changes: 120 additions & 0 deletions
120
plugins/modules/networks_appliance_traffic_shaping_custom_performance_classes_info.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright (c) 2021, Cisco Systems | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
DOCUMENTATION = r""" | ||
--- | ||
module: networks_appliance_traffic_shaping_custom_performance_classes_info | ||
short_description: Information module for networks _appliance _trafficshaping _customperformanceclasses | ||
description: | ||
- Get all networks _appliance _trafficshaping _customperformanceclasses. | ||
- Get networks _appliance _trafficshaping _customperformanceclasses by id. | ||
- List all custom performance classes for an MX network. | ||
- Return a custom performance class for an MX network. | ||
version_added: '1.0.0' | ||
extends_documentation_fragment: | ||
- cisco.meraki.module_info | ||
author: Francisco Munoz (@fmunoz) | ||
options: | ||
headers: | ||
description: Additional headers. | ||
type: dict | ||
networkId: | ||
description: | ||
- NetworkId path parameter. Network ID. | ||
type: str | ||
customPerformanceClassId: | ||
description: | ||
- CustomPerformanceClassId path parameter. Custom performance class ID. | ||
type: str | ||
requirements: | ||
- meraki >= 2.4.9 | ||
- python >= 3.5 | ||
seealso: | ||
- name: Cisco Meraki documentation for appliance getNetworkApplianceTrafficShapingCustomPerformanceClass | ||
description: Complete reference of the getNetworkApplianceTrafficShapingCustomPerformanceClass API. | ||
link: https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-traffic-shaping-custom-performance-class | ||
- name: Cisco Meraki documentation for appliance getNetworkApplianceTrafficShapingCustomPerformanceClasses | ||
description: Complete reference of the getNetworkApplianceTrafficShapingCustomPerformanceClasses API. | ||
link: https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-traffic-shaping-custom-performance-classes | ||
notes: | ||
- SDK Method used are | ||
appliance.Appliance.get_network_appliance_traffic_shaping_custom_performance_class, | ||
appliance.Appliance.get_network_appliance_traffic_shaping_custom_performance_classes, | ||
- Paths used are | ||
get /networks/{networkId}/appliance/trafficShaping/customPerformanceClasses, | ||
get /networks/{networkId}/appliance/trafficShaping/customPerformanceClasses/{customPerformanceClassId}, | ||
""" | ||
|
||
EXAMPLES = r""" | ||
- name: Get all networks _appliance _trafficshaping _customperformanceclasses | ||
cisco.meraki.networks_appliance_traffic_shaping_custom_performance_classes_info: | ||
meraki_api_key: "{{meraki_api_key}}" | ||
meraki_base_url: "{{meraki_base_url}}" | ||
meraki_single_request_timeout: "{{meraki_single_request_timeout}}" | ||
meraki_certificate_path: "{{meraki_certificate_path}}" | ||
meraki_requests_proxy: "{{meraki_requests_proxy}}" | ||
meraki_wait_on_rate_limit: "{{meraki_wait_on_rate_limit}}" | ||
meraki_nginx_429_retry_wait_time: "{{meraki_nginx_429_retry_wait_time}}" | ||
meraki_action_batch_retry_wait_time: "{{meraki_action_batch_retry_wait_time}}" | ||
meraki_retry_4xx_error: "{{meraki_retry_4xx_error}}" | ||
meraki_retry_4xx_error_wait_time: "{{meraki_retry_4xx_error_wait_time}}" | ||
meraki_maximum_retries: "{{meraki_maximum_retries}}" | ||
meraki_output_log: "{{meraki_output_log}}" | ||
meraki_log_file_prefix: "{{meraki_log_file_prefix}}" | ||
meraki_log_path: "{{meraki_log_path}}" | ||
meraki_print_console: "{{meraki_print_console}}" | ||
meraki_suppress_logging: "{{meraki_suppress_logging}}" | ||
meraki_simulate: "{{meraki_simulate}}" | ||
meraki_be_geo_id: "{{meraki_be_geo_id}}" | ||
meraki_caller: "{{meraki_caller}}" | ||
meraki_use_iterator_for_get_pages: "{{meraki_use_iterator_for_get_pages}}" | ||
meraki_inherit_logging_config: "{{meraki_inherit_logging_config}}" | ||
networkId: string | ||
register: result | ||
- name: Get networks _appliance _trafficshaping _customperformanceclasses by id | ||
cisco.meraki.networks_appliance_traffic_shaping_custom_performance_classes_info: | ||
meraki_api_key: "{{meraki_api_key}}" | ||
meraki_base_url: "{{meraki_base_url}}" | ||
meraki_single_request_timeout: "{{meraki_single_request_timeout}}" | ||
meraki_certificate_path: "{{meraki_certificate_path}}" | ||
meraki_requests_proxy: "{{meraki_requests_proxy}}" | ||
meraki_wait_on_rate_limit: "{{meraki_wait_on_rate_limit}}" | ||
meraki_nginx_429_retry_wait_time: "{{meraki_nginx_429_retry_wait_time}}" | ||
meraki_action_batch_retry_wait_time: "{{meraki_action_batch_retry_wait_time}}" | ||
meraki_retry_4xx_error: "{{meraki_retry_4xx_error}}" | ||
meraki_retry_4xx_error_wait_time: "{{meraki_retry_4xx_error_wait_time}}" | ||
meraki_maximum_retries: "{{meraki_maximum_retries}}" | ||
meraki_output_log: "{{meraki_output_log}}" | ||
meraki_log_file_prefix: "{{meraki_log_file_prefix}}" | ||
meraki_log_path: "{{meraki_log_path}}" | ||
meraki_print_console: "{{meraki_print_console}}" | ||
meraki_suppress_logging: "{{meraki_suppress_logging}}" | ||
meraki_simulate: "{{meraki_simulate}}" | ||
meraki_be_geo_id: "{{meraki_be_geo_id}}" | ||
meraki_caller: "{{meraki_caller}}" | ||
meraki_use_iterator_for_get_pages: "{{meraki_use_iterator_for_get_pages}}" | ||
meraki_inherit_logging_config: "{{meraki_inherit_logging_config}}" | ||
networkId: string | ||
customPerformanceClassId: string | ||
register: result | ||
""" | ||
RETURN = r""" | ||
meraki_response: | ||
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK | ||
returned: always | ||
type: dict | ||
sample: > | ||
{ | ||
"customPerformanceClassId": "string", | ||
"maxJitter": 0, | ||
"maxLatency": 0, | ||
"maxLossPercentage": 0, | ||
"name": "string" | ||
} | ||
""" |