Documentation ¶
Index ¶
- Constants
- Variables
- func IsOTPRequired(err error) bool
- func IsRequestFailedError(err error) bool
- func NewRequestFailedError(res *http.Response, req *APIRequest) error
- type APIConfig
- type APIError
- type APIRequest
- type APITokenGenerator
- type AdddonTokenExchanger
- type AddonTokenGenerator
- type BadRequestError
- type Client
- type ClientConfig
- type ForbiddenError
- type NotFoundError
- type PaymentRequiredError
- type RequestFailedError
- type Statuses
- type TokenGenerator
- type TokensService
- type TooManyRequestsError
- type UnprocessableEntity
Constants ¶
View Source
const ( AuthAPI = "AUTHENTICATION_API" ScalingoAPI = "SCALINGO_API" DBAPI = "DATABASES_API" )
Variables ¶
View Source
var ErrOTPRequired = errors.New("OTP Required")
Functions ¶
func IsOTPRequired ¶
IsOTPRequired tests if the authentication backend return an OTP Required error
func IsRequestFailedError ¶
func NewRequestFailedError ¶
func NewRequestFailedError(res *http.Response, req *APIRequest) error
Types ¶
type APIRequest ¶
type APIRequest struct { NoAuth bool URL string Method string Endpoint string Expected Statuses Params interface{} HTTPRequest *http.Request Token string // Directly use a Bearer token Username string // Username for the OAuth generator (nil if you use a token) Password string // Password for the OAuth generator OTP string // OTP value }
func (*APIRequest) BuildQueryFromParams ¶
func (req *APIRequest) BuildQueryFromParams() (url.Values, error)
type APITokenGenerator ¶
type APITokenGenerator struct { APIToken string TokensService TokensService // contains filtered or unexported fields }
func NewAPITokenGenerator ¶
func NewAPITokenGenerator(tokensService TokensService, apiToken string) *APITokenGenerator
func (*APITokenGenerator) GetAccessToken ¶
func (t *APITokenGenerator) GetAccessToken(ctx context.Context) (string, error)
type AdddonTokenExchanger ¶
type AddonTokenGenerator ¶
type AddonTokenGenerator struct {
// contains filtered or unexported fields
}
func (*AddonTokenGenerator) GetAccessToken ¶
func (c *AddonTokenGenerator) GetAccessToken(ctx context.Context) (string, error)
type BadRequestError ¶
func (BadRequestError) Error ¶
func (err BadRequestError) Error() string
type Client ¶
type Client interface { ResourceList(ctx context.Context, resource string, payload, data interface{}) error ResourceAdd(ctx context.Context, resource string, payload, data interface{}) error ResourceGet(ctx context.Context, resource, resourceID string, payload, data interface{}) error ResourceUpdate(ctx context.Context, resource, resourceID string, payload, data interface{}) error ResourceDelete(ctx context.Context, resource, resourceID string) error SubresourceList(ctx context.Context, resource, resourceID, subresource string, payload, data interface{}) error SubresourceAdd(ctx context.Context, resource, resourceID, subresource string, payload, data interface{}) error SubresourceGet(ctx context.Context, resource, resourceID, subresource, id string, payload, data interface{}) error SubresourceUpdate(rctx context.Context, esource, resourceID, subresource, id string, payload, data interface{}) error SubresourceDelete(ctx context.Context, resource, resourceID, subresource, id string) error DoRequest(ctx context.Context, req *APIRequest, data interface{}) error Do(context.Context, *APIRequest) (*http.Response, error) TokenGenerator() TokenGenerator IsAuthenticatedClient() bool BaseURL() string HTTPClient() *http.Client }
func NewClient ¶
func NewClient(api string, cfg ClientConfig) Client
type ClientConfig ¶
type ForbiddenError ¶
func (ForbiddenError) Error ¶
func (err ForbiddenError) Error() string
type NotFoundError ¶
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type PaymentRequiredError ¶
type PaymentRequiredError struct { Name string `json:"name"` ErrMessage string `json:"error"` URL string `json:"url"` }
func (PaymentRequiredError) Error ¶
func (err PaymentRequiredError) Error() string
type RequestFailedError ¶
type RequestFailedError struct { Code int APIError error Req *APIRequest Message string }
func (*RequestFailedError) Error ¶
func (err *RequestFailedError) Error() string
func (*RequestFailedError) String ¶
func (err *RequestFailedError) String() string
type TokenGenerator ¶
func NewAddonTokenGenerator ¶
func NewAddonTokenGenerator(app, addon string, exchanger AdddonTokenExchanger) TokenGenerator
type TokensService ¶
type TooManyRequestsError ¶ added in v6.2.0
func (TooManyRequestsError) Error ¶ added in v6.2.0
func (err TooManyRequestsError) Error() string
type UnprocessableEntity ¶
func (UnprocessableEntity) Error ¶
func (err UnprocessableEntity) Error() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package httpmock is a generated GoMock package.
|
Package httpmock is a generated GoMock package. |
Package tokensservicemock is a generated GoMock package.
|
Package tokensservicemock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.