Documentation ¶
Overview ¶
Package intersight provides a simple to use client for the Intersight API. It handles signature authentication and supports both v2 and v3 keys.
Simple example to get NTP policies
func Example() { client, _ := intersight.NewClient() result, _ := client.Get("/api/v1/ntp/Policies") fmt.Printf("Result: \n%v", result) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles communication with the Intersight API. It holds credentials (API keys) and handles authentication for a single Intersight account.
func NewClient ¶
NewClient creates a new Client object. If called with no parameters, it will default to the Intersight SaaS instance and attempt to find the Key ID and Key File from the IS_KEYID and IS_KEYFILE environment variables. Alternatively, it can be passed a Config object to explicitly set the key details and other options.
func (*Client) Call ¶
Call will send a request to the Intersight API. The response will be JSON decoded automatically. Get will return an error if the HTTP request fails, if the API response code is not 2xx or if JSON decoding fails.
func (*Client) Delete ¶
Delete will send a DELETE request to the Intersight API. The response will be JSON decoded automatically. Delete will return an error if the HTTP request fails or if the API response code is not 2xx.
func (*Client) Get ¶
Get will send a GET request to the Intersight API. The response will be JSON decoded automatically. Get will return an error if the HTTP request fails, if the API response code is not 2xx or if JSON decoding fails.
func (*Client) Patch ¶
Patch will send a POST request to the Intersight API. The response will be JSON decoded automatically. Patch will return an error if the HTTP request fails, if the API response code is not 2xx or if JSON decoding fails.
type Config ¶
type Config struct { // KeyID is the Intersight API Key ID // If unset, the value of IS_KEYID environment variable will be used. KeyID string // KeyFile is the path to a file containing the Intersight API Key. // This cannot be set at the same time as KeyData. // If unset, the value of IS_KEYFILE environment variable will be used. KeyFile string // KeyData is the Intersight API key. This cannot be set at the same time as KeyFile. KeyData string // Host is the Intersight instance host name. Default "intersight.com" Host string // Logger is a logger object to send log messages to Logger Logger // BaseTransport is a http.RoundTripper for this client to use. If unset http.DefaultTransport will be used. BaseTransport http.RoundTripper }
Config holds configuration options for creating a new Client. Each field that is empty will be replaced with a default value when calling NewClient