api

package
v0.24.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package api provides access to the platform API, in all forms supported by the config context (aka access profile)

Package api provides access to the platform API, in all forms supported by the config context (aka access profile)

Index

Constants

View Source
const RESOLVER_HOST = "observe-tenant-lookup-api"

Variables

This section is empty.

Functions

func HTTPGet

func HTTPGet(path string, out any, options *Options) error

HTTPGet performs a GET request with HTTP command and response - Accept and Content-Type headers are provided by the caller

func HTTPPost

func HTTPPost(path string, body []byte, out any, options *Options) error

HTTPPost performs a POST request with HTTP command and response - Accept and Content-Type headers are provided by the caller

func JSONDelete

func JSONDelete(path string, out any, options *Options) error

JSONGet performs a GET request and parses the response as JSON

func JSONGet

func JSONGet(path string, out any, options *Options) error

JSONGet performs a GET request and parses the response as JSON

func JSONGetCollection

func JSONGetCollection(path string, out any, options *Options) error

JSONGetCollection performs a GET request and parses the response as JSON, handling pagination per https://www.rfc-editor.org/rfc/rfc5988, https://developer.cisco.com/api-guidelines/#rest-style/API.REST.STYLE.25 and https://developer.cisco.com/api-guidelines/#rest-style/API.REST.STYLE.24

func JSONPatch

func JSONPatch(path string, body any, out any, options *Options) error

JSONPatch performs a PATCH request and parses the response as JSON

func JSONPost

func JSONPost(path string, body any, out any, options *Options) error

JSONPost performs a POST request with JSON command and response

func JSONPut

func JSONPut(path string, body any, out any, options *Options) error

JSONPost performs a POST request with JSON command and response

func JSONRequest

func JSONRequest(method string, path string, body any, out any, options *Options) error

JSONPatch performs a http request and parses the response as JSON, allowing the http method to be specified

func Login

func Login() error

Login performs a login into the platform API and saves the provided access token. Login respects different access profile types (when supported) to provide the correct login mechanism for each. Currently, only service principal is supported; in the future we expect to support no-auth (for development environments) and SSO/OAuth login using the same user credentials as the browser login.

Types

type Options

type Options struct {
	Headers         map[string]string
	ResponseHeaders map[string][]string // headers as returned by the call
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL