Closed pvvcom closed 1 year ago
Hello @pvvcom -- when you say Meraki CLI, are you talking about this repo?
This is the repo for the Python library, so you might try making the call via the example Python library call on the interactive docs page.
If you're able to reproduce an issue with the library (e.g. sans Meraki CLI) then please let us know! For now it seems like the Meraki CLI repo would be the better place to raise this question.
Hi @TKIPisalegacycipher , you're right I was using the wrapper you linked. I have setup python and am testing it directly from example you linked but still getting an error on type.
import meraki
import os
import json
API_KEY = os.environ.get('MERAKI_DASHBOARD_API_KEY')
dashboard = meraki.DashboardAPI(
API_KEY,
#output_log=False,
#print_console=False
)
organization_id = 'ommited'
name = 'testapi'
category = 'network'
type = 'cidr'
cidr = '10.1.10.20/24'
response = meraki.Organizations.createOrganizationPolicyObject(
organization_id, name, category, type
)
2023-03-29 20:21:55 meraki: INFO > Meraki dashboard API session initialized with these parameters: {'version': '1.30.0', 'api_key': '****', 'base_url': 'https://api.meraki.com/api/v1', 'single_request_timeout': 60, 'certificate_path': '', 'requests_proxy': '', 'wait_on_rate_limit': True, 'nginx_429_retry_wait_time': 60, 'action_batch_retry_wait_time': 60, 'retry_4xx_error': False, 'retry_4xx_error_wait_time': 60, 'maximum_retries': 2, 'simulate': False, 'be_geo_id': None, 'caller': None, 'use_iterator_for_get_pages': False}
Traceback (most recent call last):
File "/home/pvickers/test.py", line 19, in
Thanks @pvvcom , I'm not able to reproduce this issue on my end, and all the CIDR policy objects were created successfully.
Console output: Dashboard showing created objects:
Here's a sample script you can reference:
import meraki
org = 'id-here'
d = meraki.DashboardAPI(suppress_logging=True)
type = 'cidr'
po_category = 'network'
po_name = 'new name'
cidr = '1.1.1.1/24'
response = d.organizations.createOrganizationPolicyObject(org, po_name, po_category, type, cidr=cidr)
I'm not seeing any sign that there is an issue with the library. You might try checking your library version, though, to make sure it's up to date.
I am having a problem with this command. I have tried specifying cidr via --cidr and with kwargs. I am not pipelining this from another command. When I run from the Merki API webpage as a test it is successful with these json parameters found below but the same wont work with Meraki CLI.
{ "name": "Web Servers - Datacenter 1022", "category": "network", "type": "cidr", "cidr": "10.10.10.0/24", }
meraki -ddd -j organizations createOrganizationPolicyObject --organizationId "ommitted" --type cidr --name test33 --category network --kwargs '{"cidr": "10.20.10.0/24"}'
2023-03-28 16:56:24,299 [DEBUG] Argument Settings: { "apiKey": null, "debug": 3, "logfile": null, "configFile": null, "jsonOutput": true, "columns": null, "filters": null, "and_logic": false, "translations": null, "output_commands": false, "type": "cidr", "command": "createOrganizationPolicyObject", "organizationId": "omitted", "name": "test33", "category": "network", "kwargs": "{\"cidr\": \"10.20.10.0/24\"}" } 2023-03-28 16:56:24,299 [DEBUG] Instantiating Meraki API with environment API key 2023-03-28 16:56:24,300 [INFO ] Target method is <bound method Organizations.createOrganizationPolicyObject of>
2023-03-28 16:56:24,300 [INFO ] No STDIN detected. No pipe behind this instance.
2023-03-28 16:56:24,300 [DEBUG] Cleaned Arguments: {'organizationId': 'omitted', 'name': 'test33', 'category': 'network'}
2023-03-28 16:56:24,300 [CRITI] ERROR. Cannot find "type". May need to be translated from an input key with the "-t" argument