Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 11 additions & 5 deletions generator/generate_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ID as inputs, a specific dashboard org's OpenAPI spec.

=== USAGE ===
python[3] generate_library.py [-o <org_id>] [-k <api_key>] [-v <version_number>]
python[3] generate_library.py [-o <org_id>] [-k <api_key>] [-v <version_number>] [-p <base_tag_count>]
API key can, and is recommended to, be set as an environment variable named MERAKI_DASHBOARD_API_KEY.
"""

Expand Down Expand Up @@ -123,13 +123,13 @@ def parse_params(operation, parameters, param_filters=[]):
return ret


def generate_library(spec, version_number):
def generate_library(spec, version_number, parm_count):
# Only care about the first 10 tags, which are the 10 scopes for organizations, networks, devices, & 7 products
# scopes = ['organizations', 'networks', 'devices',
# 'appliance', 'camera', 'cellularGateway', 'insight', 'sm', 'switch', 'wireless']
tags = spec['tags']
paths = spec['paths']
scopes = {tag['name']: {} for tag in tags[:10]}
scopes = {tag['name']: {} for tag in tags[:parm_count]}
batchable_action_summaries = [action['summary'] for action in spec['x-batchable-actions']]

# Check paths and create sub-directories if needed
Expand Down Expand Up @@ -452,9 +452,10 @@ def main(inputs):
api_key = os.environ.get('MERAKI_DASHBOARD_API_KEY')
org_id = None
version_number = 'custom'
parm_count = 10

try:
opts, args = getopt.getopt(inputs, 'ho:k:v:')
opts, args = getopt.getopt(inputs, 'ho:k:v:p:')
except getopt.GetoptError:
print_help()
sys.exit(2)
Expand All @@ -468,6 +469,11 @@ def main(inputs):
api_key = arg
elif opt == '-v':
version_number = arg
elif opt == '-p':
try:
parm_count = int(arg)
except Exception:
pass

# Retrieve latest OpenAPI specification
if org_id:
Expand All @@ -485,7 +491,7 @@ def main(inputs):
else:
spec = requests.get('https://api.meraki.com/api/v1/openapiSpec').json()

generate_library(spec, version_number)
generate_library(spec, version_number, parm_count)


if __name__ == '__main__':
Expand Down
50 changes: 25 additions & 25 deletions meraki/api/batch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
from .organizations import ActionBatchOrganizations
from .networks import ActionBatchNetworks
from .devices import ActionBatchDevices
from .appliance import ActionBatchAppliance
from .camera import ActionBatchCamera
from .cellularGateway import ActionBatchCellularGateway
from .insight import ActionBatchInsight
from .sm import ActionBatchSm
from .switch import ActionBatchSwitch
from .wireless import ActionBatchWireless
# Batch class
class Batch:
def __init__(self):
# Action Batch API endpoints by section
self.organizations = ActionBatchOrganizations()
self.networks = ActionBatchNetworks()
self.devices = ActionBatchDevices()
self.appliance = ActionBatchAppliance()
self.camera = ActionBatchCamera()
self.cellularGateway = ActionBatchCellularGateway()
self.insight = ActionBatchInsight()
self.sm = ActionBatchSm()
self.switch = ActionBatchSwitch()
from .organizations import ActionBatchOrganizations
from .networks import ActionBatchNetworks
from .devices import ActionBatchDevices
from .appliance import ActionBatchAppliance
from .camera import ActionBatchCamera
from .cellularGateway import ActionBatchCellularGateway
from .insight import ActionBatchInsight
from .sm import ActionBatchSm
from .switch import ActionBatchSwitch
from .wireless import ActionBatchWireless


# Batch class
class Batch:
def __init__(self):
# Action Batch API endpoints by section
self.organizations = ActionBatchOrganizations()
self.networks = ActionBatchNetworks()
self.devices = ActionBatchDevices()
self.appliance = ActionBatchAppliance()
self.camera = ActionBatchCamera()
self.cellularGateway = ActionBatchCellularGateway()
self.insight = ActionBatchInsight()
self.sm = ActionBatchSm()
self.switch = ActionBatchSwitch()
self.wireless = ActionBatchWireless()