Documentation ¶
Index ¶
- type APIClient
- func Connect(config ClientConfig) (c *APIClient, err error)
- func ConnectContext(ctx context.Context, config ClientConfig) (c *APIClient, err error)
- func ConnectDefault(endpoint string) (c *APIClient, err error)
- func ConnectDefaultContext(ctx context.Context, endpoint string) (c *APIClient, err error)
- func (c *APIClient) CloneWithSession() (*APIClient, error)
- func (c *APIClient) Delete(url string) (*http.Response, error)
- func (c *APIClient) DeleteWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Get(url string) (*http.Response, error)
- func (c *APIClient) GetSession() (*Session, error)
- func (c *APIClient) GetWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Logout()
- func (c *APIClient) Patch(url string, payload interface{}) (*http.Response, error)
- func (c *APIClient) PatchWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Post(url string, payload interface{}) (*http.Response, error)
- func (c *APIClient) PostMultipart(url string, payload map[string]io.Reader) (*http.Response, error)
- func (c *APIClient) PostMultipartWithHeaders(url string, payload map[string]io.Reader, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) PostWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Put(url string, payload interface{}) (*http.Response, error)
- func (c *APIClient) PutWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) SetDumpWriter(writer io.Writer)
- type ClientConfig
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct { // HTTPClient is for direct http actions HTTPClient *http.Client // Service is the ServiceRoot of this Redfish instance Service *redfishapi.Service // contains filtered or unexported fields }
APIClient represents a connection to a Redfish/Swordfish enabled service or device.
func Connect ¶
func Connect(config ClientConfig) (c *APIClient, err error)
Connect creates a new client connection to a Redfish service.
func ConnectContext ¶
func ConnectContext(ctx context.Context, config ClientConfig) (c *APIClient, err error)
ConnectContext is the same as Connect, but sets the ctx.
func ConnectDefault ¶
ConnectDefault creates an unauthenticated connection to a Redfish service.
func ConnectDefaultContext ¶
ConnectDefaultContext is the same as ConnectDefault, but sets the ctx.
func (*APIClient) CloneWithSession ¶
CloneWithSession will create a new Client with a session instead of basic auth.
func (*APIClient) DeleteWithHeaders ¶
func (c *APIClient) DeleteWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
DeleteWithHeaders performs a Delete request against the Redfish service but allowing custom headers
func (*APIClient) GetSession ¶
GetSession retrieves the session data from an initialized APIClient. An error is returned if the client is not authenticated.
func (*APIClient) GetWithHeaders ¶
func (c *APIClient) GetWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
GetWithHeaders performs a GET request against the Redfish service but allowing custom headers
func (*APIClient) Logout ¶
func (c *APIClient) Logout()
Logout will delete any active session. Useful to defer logout when creating a new connection.
func (*APIClient) PatchWithHeaders ¶
func (c *APIClient) PatchWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
PatchWithHeaders performs a Patch request against the Redfish service but allowing custom headers
func (*APIClient) PostMultipart ¶
PostMultipart performs a Post request against the Redfish service with multipart payload.
func (*APIClient) PostMultipartWithHeaders ¶
func (c *APIClient) PostMultipartWithHeaders(url string, payload map[string]io.Reader, customHeaders map[string]string) (*http.Response, error)
PostMultipartWithHeadersperforms a Post request against the Redfish service with multipart payload but allowing custom headers
func (*APIClient) PostWithHeaders ¶
func (c *APIClient) PostWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
PostWithHeaders performs a Post request against the Redfish service but allowing custom headers
func (*APIClient) PutWithHeaders ¶
func (c *APIClient) PutWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
PutWithHeaders performs a Put request against the Redfish service but allowing custom headers
func (*APIClient) SetDumpWriter ¶
SetDumpWriter sets the client the DumpWriter dynamically
type ClientConfig ¶
type ClientConfig struct { // Endpoint is the URL of the redfish service Endpoint string // Username is the optional user name to authenticate with. Username string // Password is the password to use for authentication. Password string // Session is an optional session ID+token obtained from a previous session // If this is set, it is preferred over Username and Password Session *Session // Insecure controls whether to enforce SSL certificate validity. Insecure bool // Controls TLS handshake timeout TLSHandshakeTimeout int // HTTPClient is the optional client to connect with. HTTPClient *http.Client // DumpWriter is an optional io.Writer to receive dumps of HTTP // requests and responses. DumpWriter io.Writer // BasicAuth tells the APIClient if basic auth should be used (true) or token based auth must be used (false) BasicAuth bool }
ClientConfig holds the settings for establishing a connection.