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)
Package api provides access to the platform API, in all forms supported by the config context (aka access profile)
Index ¶
- Constants
- Variables
- func AddLocalAuthReqHeaders(req *http.Request, opt *config.LocalAuthOptions)
- func HTTPGet(path string, out any, options *Options) error
- func HTTPPost(path string, body []byte, out any, options *Options) error
- func JSONDelete(path string, out any, options *Options) error
- func JSONGet(path string, out any, options *Options) error
- func JSONGetCollection[T any](path string, out *CollectionResult[T], options *Options) (err error)
- func JSONPatch(path string, body any, out any, options *Options) error
- func JSONPost(path string, body any, out any, options *Options) error
- func JSONPut(path string, body any, out any, options *Options) error
- func JSONRequest(method string, path string, body any, out any, options *Options) error
- func Login() error
- type CollectionResult
- type HttpStatusError
- type Options
- type Problem
- type Version
Constants ¶
const RESOLVER_HOST = "observe-tenant-lookup-api"
Variables ¶
var FlagCurlifyRequests bool
Functions ¶
func AddLocalAuthReqHeaders ¶ added in v0.50.0
func AddLocalAuthReqHeaders(req *http.Request, opt *config.LocalAuthOptions)
func HTTPGet ¶
HTTPGet performs a GET request with HTTP command and response - Accept and Content-Type headers are provided by the caller
func HTTPPost ¶
HTTPPost performs a POST request with HTTP command and response - Accept and Content-Type headers are provided by the caller
func JSONDelete ¶
JSONDelete performs a DELETE request and parses the response as JSON
func JSONGetCollection ¶
func JSONGetCollection[T any](path string, out *CollectionResult[T], options *Options) (err 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 JSONRequest ¶
JSONRequest performs an HTTP request and parses the response as JSON, allowing the http method to be specified
Types ¶
type CollectionResult ¶ added in v0.49.0
CollectionResult is a structure that wraps API collections of type T. See JSONGetCollection for reference to API collection RFC/standards
type HttpStatusError ¶ added in v0.57.1
type HttpStatusError struct { Message string // used only if WrappedError is nil StatusCode int WrappedErr error }
func (*HttpStatusError) Error ¶ added in v0.57.1
func (e *HttpStatusError) Error() string
func (*HttpStatusError) Unwrap ¶ added in v0.57.1
func (e *HttpStatusError) Unwrap() error
type Problem ¶ added in v0.25.0
type Problem struct { Type string `json:"type"` Title string `json:"title"` Detail string `json:"detail"` Status int `json:"status"` Extensions map[string]any }
Problem type is a json object returned for content-type application/problem+json according to the RFC-7807
func (*Problem) UnmarshalJSON ¶ added in v0.25.0
type Version ¶ added in v0.50.0
type Version string
Version defines an API version, as used in URI paths. Use NewVersion() to create/parse from a string value and String() to convert back to string
func NewVersion ¶ added in v0.50.0
NewVersion parses a string value into an API version, ensuring that the string matches the required pattern