opsani

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WritePrettyJSONBytesToFile

func WritePrettyJSONBytesToFile(body []byte, file string) error

WritePrettyJSONBytesToFile writes an array of unformmated JSON bytes in pretty printed formatted to the target file

func WritePrettyJSONStringsToFile

func WritePrettyJSONStringsToFile(strings []string, filename string) error

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

func (APIError) Error added in v0.1.4

func (err APIError) Error() string

Error returns an error representation of the API error

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides a high level interface to the Opsani API

func NewClient

func NewClient() *Client

NewClient creates a new Opsani API client.

func NewWithHTTPClient

func NewWithHTTPClient(hc *http.Client) *Client

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

func (c *Client) AfterResponseWriteBodyToFile(filename string)

AfterResponseWriteBodyToFile configures a request handler to write responses to the specified file

func (*Client) AfterResponseWritePrettyJSONBodyToFile

func (c *Client) AfterResponseWritePrettyJSONBodyToFile(filename string)

AfterResponseWritePrettyJSONBodyToFile appends response middleware to write pretty JSON responses to the specified file

func (*Client) EnableTrace

func (c *Client) EnableTrace() *Client

EnableTrace enables tracing information for all requests

func (*Client) GetApp

func (c *Client) GetApp(app string) string

GetApp gets the Opsani app that the client is interacting with

func (*Client) GetAppStatus

func (c *Client) GetAppStatus() (*resty.Response, error)

GetAppStatus retrieves the status of the Opsani app from the API

func (*Client) GetBaseURL

func (c *Client) GetBaseURL() string

GetBaseURL method returns the base URL against which all requests are executed

func (*Client) GetConfig

func (c *Client) GetConfig() (*resty.Response, error)

GetConfig retrieves the Opsani app configuration from the API

func (*Client) GetHeaders

func (c *Client) GetHeaders() http.Header

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

func (c *Client) IsAuthenticated() bool

IsAuthenticated returns true if an authentication token has been set.

func (*Client) PatchConfigFromBody

func (c *Client) PatchConfigFromBody(body interface{}, apply bool) (*resty.Response, error)

PatchConfigFromBody patches the existing app configuration from the given body producing a merged configuration

func (*Client) RestartApp

func (c *Client) RestartApp() (*resty.Response, error)

RestartApp stops a running Opsani app

func (*Client) SetApp

func (c *Client) SetApp(app string) *Client

SetApp sets the Opsani app that the client is interacting with

func (*Client) SetAuthToken

func (c *Client) SetAuthToken(token string) *Client

SetAuthToken method sets the auth token of the `Authorization` header for all API requests.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(URL string) *Client

SetBaseURL method sets the base URL against which all requests are executed

func (*Client) SetConfigFromBody

func (c *Client) SetConfigFromBody(body interface{}, apply bool) (*resty.Response, error)

SetConfigFromBody sets the app configuration from the given body, overwriting the existing configuration

func (*Client) SetDebug

func (c *Client) SetDebug(enabled bool) *Client

SetDebug controls whether or not debugging is enabled on the API client

func (*Client) SetOutputDirectory

func (c *Client) SetOutputDirectory(dir string)

SetOutputDirectory sets the output directory for saving API responses

func (*Client) StartApp

func (c *Client) StartApp() (*resty.Response, error)

StartApp starts a stopped Opsani app

func (*Client) StopApp

func (c *Client) StopApp() (*resty.Response, error)

StopApp stops a running Opsani app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL