Documentation
¶
Index ¶
- func WritePrettyJSONBytesToFile(body []byte, file string) error
- func WritePrettyJSONStringsToFile(strings []string, filename string) error
- type APIError
- type Client
- func (c *Client) AfterResponseWriteBodyToFile(filename string)
- func (c *Client) AfterResponseWritePrettyJSONBodyToFile(filename string)
- func (c *Client) EnableTrace() *Client
- func (c *Client) GetApp(app string) string
- func (c *Client) GetAppStatus() (*resty.Response, error)
- func (c *Client) GetBaseURL() string
- func (c *Client) GetConfig() (*resty.Response, error)
- func (c *Client) GetHeaders() http.Header
- func (c *Client) GetRestyClient() *resty.Client
- func (c *Client) IsAuthenticated() bool
- func (c *Client) PatchConfigFromBody(body interface{}, apply bool) (*resty.Response, error)
- func (c *Client) RestartApp() (*resty.Response, error)
- func (c *Client) SetApp(app string) *Client
- func (c *Client) SetAuthToken(token string) *Client
- func (c *Client) SetBaseURL(URL string) *Client
- func (c *Client) SetConfigFromBody(body interface{}, apply bool) (*resty.Response, error)
- func (c *Client) SetDebug(enabled bool) *Client
- func (c *Client) SetOutputDirectory(dir string)
- func (c *Client) StartApp() (*resty.Response, error)
- func (c *Client) StopApp() (*resty.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WritePrettyJSONBytesToFile ¶
WritePrettyJSONBytesToFile writes an array of unformmated JSON bytes in pretty printed formatted to the target file
func WritePrettyJSONStringsToFile ¶
WritePrettyJSONStringsToFile writes an array of unformatted JSON strings in pretty printed formatted to the target file
Types ¶
type APIError ¶
type APIError struct { Status string `json:"status"` Message string `json:"message"` Traceback string `json:"traceback"` Version string `json:"version"` }
APIError represents an error returned by the Opsani API
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a high level interface to the Opsani API
func NewWithHTTPClient ¶
NewWithHTTPClient creates a new Opsani client with given `http.Client`.
func NewWithRestyClient ¶
func NewWithRestyClient(rc *resty.Client) *Client
NewWithRestyClient creates a new Opsani client with given `http.Client`.
func (*Client) AfterResponseWriteBodyToFile ¶
AfterResponseWriteBodyToFile configures a request handler to write responses to the specified file
func (*Client) AfterResponseWritePrettyJSONBodyToFile ¶
AfterResponseWritePrettyJSONBodyToFile appends response middleware to write pretty JSON responses to the specified file
func (*Client) EnableTrace ¶
EnableTrace enables tracing information for all requests
func (*Client) GetAppStatus ¶
GetAppStatus retrieves the status of the Opsani app from the API
func (*Client) GetBaseURL ¶
GetBaseURL method returns the base URL against which all requests are executed
func (*Client) GetHeaders ¶
GetHeaders returns the HTTP headers set on the client
func (*Client) GetRestyClient ¶
func (c *Client) GetRestyClient() *resty.Client
GetRestyClient returns the current `resty.Client` used by the opsani client.
func (*Client) IsAuthenticated ¶
IsAuthenticated returns true if an authentication token has been set.
func (*Client) PatchConfigFromBody ¶
PatchConfigFromBody patches the existing app configuration from the given body producing a merged configuration
func (*Client) RestartApp ¶
RestartApp stops a running Opsani app
func (*Client) SetAuthToken ¶
SetAuthToken method sets the auth token of the `Authorization` header for all API requests.
func (*Client) SetBaseURL ¶
SetBaseURL method sets the base URL against which all requests are executed
func (*Client) SetConfigFromBody ¶
SetConfigFromBody sets the app configuration from the given body, overwriting the existing configuration
func (*Client) SetOutputDirectory ¶
SetOutputDirectory sets the output directory for saving API responses