diff --git a/generator/generate_library.py b/generator/generate_library.py index d5f0e934..30f76bf9 100644 --- a/generator/generate_library.py +++ b/generator/generate_library.py @@ -8,7 +8,7 @@ ID as inputs, a specific dashboard org's OpenAPI spec. === USAGE === -python[3] generate_library.py [-o ] [-k ] [-v ] +python[3] generate_library.py [-o ] [-k ] [-v ] [-p ] API key can, and is recommended to, be set as an environment variable named MERAKI_DASHBOARD_API_KEY. """ @@ -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 @@ -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) @@ -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: @@ -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__': diff --git a/meraki/api/batch/__init__.py b/meraki/api/batch/__init__.py index 7ec023fd..70511150 100644 --- a/meraki/api/batch/__init__.py +++ b/meraki/api/batch/__init__.py @@ -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() \ No newline at end of file