Documentation ¶
Index ¶
- Constants
- func ErrExit(msg interface{})
- func GetJSONEntityFromAtomGetRequest(client *YorcClient, atomLink rest.AtomLink, entity interface{}) error
- func HandleHTTPStatusCode(response *http.Response, resourceID string, resourceType string, ...)
- func HandleHTTPStatusCodeWithCustomizedErrorMessage(response *http.Response, resourceID string, resourceType string, ...)
- func PrintErrors(body io.Reader)
- type YorcClient
- func (c *YorcClient) Get(path string) (*http.Response, error)
- func (c *YorcClient) Head(path string) (*http.Response, error)
- func (c *YorcClient) NewRequest(method, path string, body io.Reader) (*http.Request, error)
- func (c *YorcClient) Post(path string, contentType string, body io.Reader) (*http.Response, error)
- func (c *YorcClient) PostForm(path string, data url.Values) (*http.Response, error)
Constants ¶
const YorcAPIDefaultErrorMsg = "Failed to contact Yorc API"
YorcAPIDefaultErrorMsg is the default communication error message
Variables ¶
This section is empty.
Functions ¶
func ErrExit ¶
func ErrExit(msg interface{})
ErrExit allows to exit on error with exit code 1 after printing error message
func GetJSONEntityFromAtomGetRequest ¶
func GetJSONEntityFromAtomGetRequest(client *YorcClient, atomLink rest.AtomLink, entity interface{}) error
GetJSONEntityFromAtomGetRequest returns JSON entity from AtomLink request
func HandleHTTPStatusCode ¶
func HandleHTTPStatusCode(response *http.Response, resourceID string, resourceType string, expectedStatusCodes ...int)
HandleHTTPStatusCode handles Yorc HTTP status code and displays error if needed
func HandleHTTPStatusCodeWithCustomizedErrorMessage ¶
func HandleHTTPStatusCodeWithCustomizedErrorMessage( response *http.Response, resourceID string, resourceType string, customizedErrorMessages map[string]string, expectedStatusCodes ...int)
HandleHTTPStatusCodeWithCustomizedErrorMessage handles Yorc HTTP status code and in case of error, can display a customized error message instead of the source error if this source error contains a given string provided as key in the map argument customizedErrorMessages
Types ¶
type YorcClient ¶
YorcClient is the Yorc HTTP client structure
func GetClient ¶
func GetClient(cc config.Client) (*YorcClient, error)
GetClient returns a yorc HTTP Client
func (*YorcClient) Get ¶
func (c *YorcClient) Get(path string) (*http.Response, error)
Get returns a new HTTP request with GET method
func (*YorcClient) Head ¶
func (c *YorcClient) Head(path string) (*http.Response, error)
Head returns a new HTTP request with HEAD method
func (*YorcClient) NewRequest ¶
NewRequest returns a new HTTP request