Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/log incorrect kwarg #236

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cd23f90
add validate_kwargs function
Dec 13, 2023
0147024
add validate_kwargs to each function that use **kwargs in appliance s…
Dec 13, 2023
aaa2b7e
add validate_kwargs to each function that use **kwargs in camera service
Dec 13, 2023
a26a58b
add validate_kwargs to each function that use **kwargs in cellularGat…
Dec 13, 2023
3b25b9c
add validate_kwargs to each function that use **kwargs in devices ser…
Dec 13, 2023
5afe183
add validate_kwargs to each function that use **kwargs in insight ser…
Dec 13, 2023
8340189
add validate_kwargs to each function that use **kwargs in licensing s…
Dec 13, 2023
10b29ce
add validate_kwargs to each function that use **kwargs in organizatio…
Dec 13, 2023
1055668
add validate_kwargs to each function that use **kwargs in sensor service
Dec 13, 2023
4dae5f7
add validate_kwargs to each function that use **kwargs in sm service
Dec 13, 2023
78ba537
add validate_kwargs to each function that use **kwargs in switch service
Dec 13, 2023
d1639e6
add validate_kwargs to each function that use **kwargs in wireless se…
Dec 13, 2023
74919da
add validate_kwargs to each function that use **kwargs in appliance b…
Dec 13, 2023
0bcb354
add validate_kwargs to each function that use **kwargs in camera batc…
Dec 13, 2023
2057cb3
add validate_kwargs to each function that use **kwargs in cellularGat…
Dec 13, 2023
00c98c5
add validate_kwargs to each function that use **kwargs in camera batc…
Dec 13, 2023
cda7dcd
add validate_kwargs to each function that use **kwargs in camera batc…
Dec 13, 2023
2836d68
add validate_kwargs to each function that use **kwargs in camera batc…
Dec 13, 2023
8e93c7d
add validate_kwargs to each function that use **kwargs in camera batc…
Dec 13, 2023
82967e0
add validate_kwargs to each function that use **kwargs in camera batc…
Dec 13, 2023
d7ef1bc
add validate_kwargs to each function that use **kwargs in switch batch
martialo12 Dec 13, 2023
91fb08b
add validate_kwargs to each function that use **kwargs in wireless ba…
martialo12 Dec 13, 2023
c7dfd71
add validate_kwargs method to jinja templates
martialo12 Dec 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions generator/batch_function_template.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

{% if query_params|length > 0 %}
query_params = [{% for param in query_params %}'{{ param }}', {% endfor %}]
validate_kwargs(query_params)
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}

{% endif %}
Expand All @@ -44,6 +45,7 @@
{% endif %}
{% if body_params|length > 0 %}
body_params = [{% for param in body_params %}'{{ param }}', {% endfor %}]
validate_kwargs(body_params)
{% if batch_operation != 'destroy'%}
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
{% endif %}
Expand Down
2 changes: 2 additions & 0 deletions generator/function_template.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

{% if query_params|length > 0 %}
query_params = [{% for param in query_params %}'{{ param }}', {% endfor %}]
validate_kwargs(query_params)
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}

{% endif %}
Expand All @@ -44,6 +45,7 @@
{% endif %}
{% if body_params|length > 0 %}
body_params = [{% for param in body_params %}'{{ param }}', {% endfor %}]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}

{% endif %}
Expand Down
47 changes: 46 additions & 1 deletion meraki/api/appliance.py

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions meraki/api/batch/appliance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib
from meraki.common import validate_kwargs


class ActionBatchAppliance(object):
Expand Down Expand Up @@ -27,6 +28,7 @@ def updateDeviceApplianceRadioSettings(self, serial: str, **kwargs):
resource = f'/devices/{serial}/appliance/radio/settings'

body_params = ['rfProfileId', 'twoFourGhzSettings', 'fiveGhzSettings', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -114,6 +116,7 @@ def updateNetworkApplianceConnectivityMonitoringDestinations(self, networkId: st
resource = f'/networks/{networkId}/appliance/connectivityMonitoringDestinations'

body_params = ['destinations', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -145,6 +148,7 @@ def updateNetworkApplianceFirewallL7FirewallRules(self, networkId: str, **kwargs
resource = f'/networks/{networkId}/appliance/firewall/l7FirewallRules'

body_params = ['rules', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -182,6 +186,7 @@ def updateNetworkAppliancePort(self, networkId: str, portId: str, **kwargs):
resource = f'/networks/{networkId}/appliance/ports/{portId}'

body_params = ['enabled', 'dropUntaggedTraffic', 'type', 'vlan', 'allowedVlans', 'accessPolicy', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -215,6 +220,7 @@ def createNetworkAppliancePrefixesDelegatedStatic(self, networkId: str, prefix:
resource = f'/networks/{networkId}/appliance/prefixes/delegated/statics'

body_params = ['prefix', 'origin', 'description', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -249,6 +255,7 @@ def updateNetworkAppliancePrefixesDelegatedStatic(self, networkId: str, staticDe
resource = f'/networks/{networkId}/appliance/prefixes/delegated/statics/{staticDelegatedPrefixId}'

body_params = ['prefix', 'origin', 'description', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -309,6 +316,7 @@ def createNetworkApplianceRfProfile(self, networkId: str, name: str, **kwargs):
resource = f'/networks/{networkId}/appliance/rfProfiles'

body_params = ['name', 'twoFourGhzSettings', 'fiveGhzSettings', 'perSsidSettings', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -344,6 +352,7 @@ def updateNetworkApplianceRfProfile(self, networkId: str, rfProfileId: str, **kw
resource = f'/networks/{networkId}/appliance/rfProfiles/{rfProfileId}'

body_params = ['name', 'twoFourGhzSettings', 'fiveGhzSettings', 'perSsidSettings', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -410,6 +419,7 @@ def updateNetworkApplianceSettings(self, networkId: str, **kwargs):
resource = f'/networks/{networkId}/appliance/settings'

body_params = ['clientTrackingMethod', 'deploymentMode', 'dynamicDns', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -444,6 +454,7 @@ def updateNetworkApplianceSingleLan(self, networkId: str, **kwargs):
resource = f'/networks/{networkId}/appliance/singleLan'

body_params = ['subnet', 'applianceIp', 'ipv6', 'mandatoryDhcp', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -496,6 +507,7 @@ def updateNetworkApplianceSsid(self, networkId: str, number: str, **kwargs):
resource = f'/networks/{networkId}/appliance/ssids/{number}'

body_params = ['name', 'enabled', 'defaultVlanId', 'authMode', 'psk', 'radiusServers', 'encryptionMode', 'wpaEncryptionMode', 'visible', 'dhcpEnforcedDeauthentication', 'dot11w', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -530,6 +542,7 @@ def createNetworkApplianceTrafficShapingCustomPerformanceClass(self, networkId:
resource = f'/networks/{networkId}/appliance/trafficShaping/customPerformanceClasses'

body_params = ['name', 'maxLatency', 'maxJitter', 'maxLossPercentage', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -565,6 +578,7 @@ def updateNetworkApplianceTrafficShapingCustomPerformanceClass(self, networkId:
resource = f'/networks/{networkId}/appliance/trafficShaping/customPerformanceClasses/{customPerformanceClassId}'

body_params = ['name', 'maxLatency', 'maxJitter', 'maxLossPercentage', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -626,6 +640,7 @@ def updateNetworkApplianceTrafficShapingRules(self, networkId: str, **kwargs):
resource = f'/networks/{networkId}/appliance/trafficShaping/rules'

body_params = ['defaultRulesEnabled', 'rules', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -657,6 +672,7 @@ def updateNetworkApplianceTrafficShapingUplinkBandwidth(self, networkId: str, **
resource = f'/networks/{networkId}/appliance/trafficShaping/uplinkBandwidth'

body_params = ['bandwidthLimits', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -697,6 +713,7 @@ def updateNetworkApplianceTrafficShapingUplinkSelection(self, networkId: str, **
resource = f'/networks/{networkId}/appliance/trafficShaping/uplinkSelection'

body_params = ['activeActiveAutoVpnEnabled', 'defaultUplink', 'loadBalancingEnabled', 'failoverAndFailback', 'wanTrafficUplinkPreferences', 'vpnTrafficUplinkPreferences', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -729,6 +746,7 @@ def updateNetworkApplianceTrafficShapingVpnExclusions(self, networkId: str, **kw
resource = f'/networks/{networkId}/appliance/trafficShaping/vpnExclusions'

body_params = ['custom', 'majorApplications', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -773,6 +791,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg
resource = f'/networks/{networkId}/appliance/vlans'

body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'mandatoryDhcp', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -804,6 +823,7 @@ def updateNetworkApplianceVlansSettings(self, networkId: str, **kwargs):
resource = f'/networks/{networkId}/appliance/vlans/settings'

body_params = ['vlansEnabled', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -865,6 +885,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs):
resource = f'/networks/{networkId}/appliance/vlans/{vlanId}'

body_params = ['name', 'subnet', 'applianceIp', 'groupPolicyId', 'vpnNatSubnet', 'dhcpHandling', 'dhcpRelayServerIps', 'dhcpLeaseTime', 'dhcpBootOptionsEnabled', 'dhcpBootNextServer', 'dhcpBootFilename', 'fixedIpAssignments', 'reservedIpRanges', 'dnsNameservers', 'dhcpOptions', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'mandatoryDhcp', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -925,6 +946,7 @@ def updateNetworkApplianceVpnBgp(self, networkId: str, enabled: bool, **kwargs):
resource = f'/networks/{networkId}/appliance/vpn/bgp'

body_params = ['enabled', 'asNumber', 'ibgpHoldTimer', 'neighbors', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -962,6 +984,7 @@ def updateNetworkApplianceVpnSiteToSiteVpn(self, networkId: str, mode: str, **kw
resource = f'/networks/{networkId}/appliance/vpn/siteToSiteVpn'

body_params = ['mode', 'hubs', 'subnets', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -997,6 +1020,7 @@ def updateNetworkApplianceWarmSpare(self, networkId: str, enabled: bool, **kwarg
resource = f'/networks/{networkId}/appliance/warmSpare'

body_params = ['enabled', 'spareSerial', 'uplinkMode', 'virtualIp1', 'virtualIp2', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down
5 changes: 5 additions & 0 deletions meraki/api/batch/camera.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib
from meraki.common import validate_kwargs


class ActionBatchCamera(object):
Expand Down Expand Up @@ -27,6 +28,7 @@ def updateDeviceCameraCustomAnalytics(self, serial: str, **kwargs):
resource = f'/devices/{serial}/camera/customAnalytics'

body_params = ['enabled', 'artifactId', 'parameters', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -74,6 +76,7 @@ def updateDeviceCameraQualityAndRetention(self, serial: str, **kwargs):
resource = f'/devices/{serial}/camera/qualityAndRetention'

body_params = ['profileId', 'motionBasedRetentionEnabled', 'audioRecordingEnabled', 'restrictedBandwidthModeEnabled', 'quality', 'resolution', 'motionDetectorVersion', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -108,6 +111,7 @@ def updateDeviceCameraSense(self, serial: str, **kwargs):
resource = f'/devices/{serial}/camera/sense'

body_params = ['senseEnabled', 'mqttBrokerId', 'audioDetection', 'detectionModelId', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -139,6 +143,7 @@ def updateDeviceCameraVideoSettings(self, serial: str, **kwargs):
resource = f'/devices/{serial}/camera/video/settings'

body_params = ['externalRtspEnabled', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down
7 changes: 7 additions & 0 deletions meraki/api/batch/cellularGateway.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib
from meraki.common import validate_kwargs


class ActionBatchCellularGateway(object):
Expand Down Expand Up @@ -26,6 +27,7 @@ def updateDeviceCellularGatewayLan(self, serial: str, **kwargs):
resource = f'/devices/{serial}/cellularGateway/lan'

body_params = ['reservedIpRanges', 'fixedIpAssignments', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -57,6 +59,7 @@ def updateDeviceCellularGatewayPortForwardingRules(self, serial: str, **kwargs):
resource = f'/devices/{serial}/cellularGateway/portForwardingRules'

body_params = ['rules', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -88,6 +91,7 @@ def updateNetworkCellularGatewayConnectivityMonitoringDestinations(self, network
resource = f'/networks/{networkId}/cellularGateway/connectivityMonitoringDestinations'

body_params = ['destinations', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -121,6 +125,7 @@ def updateNetworkCellularGatewayDhcp(self, networkId: str, **kwargs):
resource = f'/networks/{networkId}/cellularGateway/dhcp'

body_params = ['dhcpLeaseTime', 'dnsNameservers', 'dnsCustomNameservers', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -153,6 +158,7 @@ def updateNetworkCellularGatewaySubnetPool(self, networkId: str, **kwargs):
resource = f'/networks/{networkId}/cellularGateway/subnetPool'

body_params = ['mask', 'cidr', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -184,6 +190,7 @@ def updateNetworkCellularGatewayUplink(self, networkId: str, **kwargs):
resource = f'/networks/{networkId}/cellularGateway/uplink'

body_params = ['bandwidthLimits', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down
3 changes: 3 additions & 0 deletions meraki/api/batch/devices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib
from meraki.common import validate_kwargs


class ActionBatchDevices(object):
Expand Down Expand Up @@ -33,6 +34,7 @@ def updateDevice(self, serial: str, **kwargs):
resource = f'/devices/{serial}'

body_params = ['name', 'tags', 'lat', 'lng', 'address', 'notes', 'moveMapMarker', 'switchProfileId', 'floorPlanId', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -65,6 +67,7 @@ def updateDeviceManagementInterface(self, serial: str, **kwargs):
resource = f'/devices/{serial}/managementInterface'

body_params = ['wan1', 'wan2', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down
3 changes: 3 additions & 0 deletions meraki/api/batch/insight.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib
from meraki.common import validate_kwargs


class ActionBatchInsight(object):
Expand Down Expand Up @@ -27,6 +28,7 @@ def createOrganizationInsightMonitoredMediaServer(self, organizationId: str, nam
resource = f'/organizations/{organizationId}/insight/monitoredMediaServers'

body_params = ['name', 'address', 'bestEffortMonitoringEnabled', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down Expand Up @@ -61,6 +63,7 @@ def updateOrganizationInsightMonitoredMediaServer(self, organizationId: str, mon
resource = f'/organizations/{organizationId}/insight/monitoredMediaServers/{monitoredMediaServerId}'

body_params = ['name', 'address', 'bestEffortMonitoringEnabled', ]
validate_kwargs(body_params)
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
Expand Down
Loading