Skip to content

Experimental CLI for Meraki API, code-generated by go-swagger

License

Notifications You must be signed in to change notification settings

cisco-sso/meraki-cli

 
 

Repository files navigation

meraki-cli

Experimental CLI for Meraki API, using API client libraries code-generated by go-swagger

Summary

This golang project demonstrates the ability generate source files for a Meraki API client by running the go-swagger tool against the swagger file downloaded from Cisco Meraki. This project also demonstrates the creation of a CLI client using the Kingpin library by connecting CLI actions to Meraki API calls, using minimal code. Only a few CLI->API calls have been implemented, since this project is meant to serve as an example of a general pattern.

Usage

$ ./meraki-cli --help
usage: meraki [<flags>] <command> [<args> ...]

The Meraki CLI command.

Flags:
  --help              Show context-sensitive help (also try --help-long and --help-man).
  --auth-token=""     Auth token. Export env var MERAKI_AUTH_TOKEN as an alternative
  --log-level="info"  Set log-level (trace|debug|info|warn|error|fatal|panic).
  --server-host="api.meraki.com"
                      Server host.
  --server-port=443   Server port.

Commands:
  help [<command>...]
    Show help.

  devices list --organization-id=ORGANIZATION-ID
    List all devices.

  events list --network-id=NETWORK-ID --product-type=PRODUCT-TYPE
    List all events for a network.

  events types --network-id=NETWORK-ID
    List all events for a network.

  networks list --organization-id=ORGANIZATION-ID
    List all networks for an organization.

  networks get --network-id=NETWORK-ID
    Get a network.

  networks clients list --network-id=NETWORK-ID
    List all Clients for a network.

  networks ssids list --network-id=NETWORK-ID
    List all SSIDs for a network.

  organizations list
    List all organizations.

  organizations get --organization-id=ORGANIZATION-ID
    Get a organization.

  version
    Display version information.

Demo

Animated Image of Terminal

Installing

go get github.com/cisco-sso/meraki-cli

Building

make all

Running

# Set your authentication token
export MERAKI_AUTH_TOKEN=<secret_token>

# Execute a command
meraki-cli organizations list

Debugging

# Enable debugging via environment variable
export DEBUG=1

# Execute the command with a flag
meraki-cli --log-level=debug ...

About

Experimental CLI for Meraki API, code-generated by go-swagger

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 73.2%
  • Makefile 17.2%
  • Shell 9.6%