Documentation
¶
Index ¶
- func CheckResponse(r *http.Response) error
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) error
- func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) NewUploadRequest(ctx context.Context, method, urlStr string, body []byte) (*http.Request, error)
- func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
- type Credentials
- type ErrorResponse
- type MessageResource
- type RequestCompletionCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks errors if exist errors in request
Types ¶
type Client ¶
type Client struct {
Credentials *Credentials
// Base URL for API requests.
BaseURL *url.URL
// User agent for client
UserAgent string
Cookies []*http.Cookie
// absolutePath: for example api/nutanix/v3
AbsolutePath string
// contains filtered or unexported fields
}
Client Config Configuration of the client
func NewClient ¶
func NewClient(credentials *Credentials, userAgent string, absolutePath string) (*Client, error)
NewClient returns a new Nutanix API client.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
NewRequest creates a request
func (*Client) NewUploadRequest ¶
func (c *Client) NewUploadRequest(ctx context.Context, method, urlStr string, body []byte) (*http.Request, error)
NewUploadRequest Handles image uploads for image service
func (*Client) OnRequestCompleted ¶
func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the DO API request completion callback
type Credentials ¶
type Credentials struct {
URL string
Username string
Password string
Endpoint string
Port string
Insecure bool
SessionAuth bool
ProxyURL string
}
Credentials needed username and password
type ErrorResponse ¶
type ErrorResponse struct {
APIVersion string `json:"api_version,omitempty"`
Code int64 `json:"code,omitempty"`
Kind string `json:"kind,omitempty"`
MessageList []MessageResource `json:"message_list"`
State string `json:"state"`
}
ErrorResponse ...
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type MessageResource ¶
type MessageResource struct {
// Custom key-value details relevant to the status.
Details map[string]interface{} `json:"details,omitempty"`
// If state is ERROR, a message describing the error.
Message string `json:"message"`
// If state is ERROR, a machine-readable snake-cased *string.
Reason string `json:"reason"`
}
MessageResource ...
Click to show internal directories.
Click to hide internal directories.