Giter Club home page Giter Club logo

dnacenter-go-sdk's Introduction

dnacenter-go-sdk

dnacenter-go-sdk is a Go client library for DNA Center Platform.

Usage

import dnac "github.com/cisco-en-programmability/dnacenter-go-sdk/v5/sdk"

Introduction

The dnacenter-go-sdk makes it easier to work with the Cisco DNA Center Platform RESTFul APIs from Go.

It supports version 2.3.5.3, but it is backward compatible with other versions as long as those versions use the same URLs and options as version 2.3.5.3.

Getting started

The first think you need to do is to generate an API client. There are two options to do it:

  1. Parameters
  2. Environment variables

Parameters

The client could be generated with the following parameters:

  • baseURL: The base URL, FQDN or IP, of the DNA instance.
  • username: The username for the API authentication and authorization.
  • password: The password for the API authentication and authorization.
  • debug: Boolean to enable debugging
  • sslVerify: Boolean to enable or disable SSL certificate verification.
  • waitTimeToManyRequest: Time in minutes SDK will wait after API responds with 429 status code (to many requests) it defaults is in 1 minute.
Client, err = dnac.NewClientWithOptions("https://sandboxdnac.cisco.com",
    "devnetuser", "Cisco123!",
    "false", "false", nil)
devicesCount, _, err := Client.Devices.GetDeviceCount()

Using environment variables

The client can be configured with the following environment variables:

  • DNAC_BASE_URL: The base URL, FQDN or IP, of the DNA instance.
  • DNAC_USERNAME: The username for the API authentication and authorization.
  • DNAC_PASSWORD: The password for the API authentication and authorization.
  • DNAC_DEBUG: Boolean to enable debugging
  • DNAC_SSL_VERIFY: Boolean to enable or disable SSL certificate verification.
  • DNAC_WAIT_TIME: Time in minutes SDK will wait after API responds with 429 status code (to many requests) it defaults is in 1 minute.
Client, err = dnac.NewClient()
devicesCount, _, err := Client.Devices.GetDeviceCount()

Examples

Here is an example of how we can generate a client, get a device count and then a list of devices filtering them using query params.

Client, err = dnac.NewClientWithOptions("https://sandboxdnac.cisco.com",
    "devnetuser", "Cisco123!",
    "false", "false",nil)
devicesCount, _, err := Client.Devices.GetDeviceCount()
if err != nil {
    fmt.Println(err)
}
fmt.Println("Device Count:", devicesCount.Response)
getDeviceListQueryParams = &dnac.GetDeviceListQueryParams{
    PlatformID: []string{"C9300-24UX"},
}
fmt.Println("Printing device list  ... PlatformID is C9300-24UX")
devices, _, err = Client.Devices.GetDeviceList(getDeviceListQueryParams)
if err != nil {
    fmt.Println(err)
}
if devices.Response != nil {
    for id, device := range *devices.Response {
        fmt.Println("GET:", id, device.ID, device.MacAddress, device.ManagementIPAddress, device.PlatformID)
    }
}

Documentation

dnacenter-go-sdk/v5

PkgGoDev

dnacenter-go-sdk/v4

PkgGoDev

dnacenter-go-sdk/v3

PkgGoDev

dnacenter-go-sdk/v2

PkgGoDev

dnacenter-go-sdk

PkgGoDev

Compatibility matrix

SDK versions Cisco DNA Center version supported
0.y.z 2.1.2
1.y.z 2.1.2
2.y.z 2.2.2.3
3.y.z 2.2.3.3
4.y.z 2.3.3.0
5.y.z 2.3.5.3

Changelog

All notable changes to this project will be documented in the CHANGELOG file.

The development team may make additional name changes as the library evolves with the Cisco DNA Center APIs.

License

This library is distributed under the MIT license found in the LICENSE file.

dnacenter-go-sdk's People

Contributors

fmunozmiranda avatar jbogarin avatar wastorga avatar bvargasre avatar jeremypng avatar dbarrantese avatar robertcsapo avatar tybruno avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.