Documentation ¶
Index ¶
- type Client
- func (c *Client) Checker(ctx context.Context, check *health.CheckState) error
- func (c *Client) GetDownloadVariant(ctx context.Context, ...) (m ImageDownload, err error)
- func (c *Client) GetDownloadVariants(ctx context.Context, ...) (m ImageDownloads, err error)
- func (c *Client) GetImage(ctx context.Context, ...) (m Image, err error)
- func (c *Client) GetImages(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string) (m Images, err error)
- func (c *Client) HealthClient() *healthcheck.Client
- func (c *Client) PostDownloadVariant(ctx context.Context, ...) (m ImageDownload, err error)
- func (c *Client) PostImage(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string, ...) (m Image, err error)
- func (c *Client) PublishImage(ctx context.Context, ...) (err error)
- func (c *Client) PutDownloadVariant(ctx context.Context, ...) (m ImageDownload, err error)
- func (c *Client) PutImage(ctx context.Context, ...) (m Image, err error)
- func (c *Client) URL() string
- type ErrInvalidImageAPIResponse
- type Image
- type ImageDownload
- type ImageDownloadLinks
- type ImageDownloads
- type ImageLinks
- type ImageUpload
- type Images
- type License
- type NewImage
- type NewImageDownload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an image api client which can be used to make requests to the server. It extends the generic healthcheck Client structure.
func NewAPIClient ¶
NewAPIClient creates a new instance of ImageAPI Client with a given image api url
func NewWithHealthClient ¶
func NewWithHealthClient(hcCli *healthcheck.Client) *Client
NewWithHealthClient creates a new instance of ImageAPI Client, reusing the URL and Clienter from the provided healthcheck client.
func (*Client) Checker ¶
Checker calls image api health endpoint and returns a check object to the caller.
func (*Client) GetDownloadVariant ¶
func (c *Client) GetDownloadVariant(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID, variant string) (m ImageDownload, err error)
GetDownloadVariant returns a requested download variant for an image
func (*Client) GetDownloadVariants ¶
func (c *Client) GetDownloadVariants(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID string) (m ImageDownloads, err error)
GetDownloadVariants returns the list of download variants for an image
func (*Client) GetImage ¶
func (c *Client) GetImage(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID string) (m Image, err error)
GetImage returns a requested image
func (*Client) GetImages ¶
func (c *Client) GetImages(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string) (m Images, err error)
GetImages returns the list of images
func (*Client) HealthClient ¶
func (c *Client) HealthClient() *healthcheck.Client
HealthClient returns the underlying Healthcheck Client for this image API client
func (*Client) PostDownloadVariant ¶
func (c *Client) PostDownloadVariant(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID string, data NewImageDownload) (m ImageDownload, err error)
PostDownloadVariant adds a new download variant to the specified image
func (*Client) PostImage ¶
func (c *Client) PostImage(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string, data NewImage) (m Image, err error)
PostImage performs a 'POST /images' with the provided NewImage
func (*Client) PublishImage ¶
func (c *Client) PublishImage(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID string) (err error)
PublishImage triggers an image publishing
func (*Client) PutDownloadVariant ¶
func (c *Client) PutDownloadVariant(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, imageID, variant string, data ImageDownload) (m ImageDownload, err error)
PutDownloadVariant updates the specified download variant for the specified image
type ErrInvalidImageAPIResponse ¶
type ErrInvalidImageAPIResponse struct {
// contains filtered or unexported fields
}
ErrInvalidImageAPIResponse is returned when the image api does not respond with a valid status
func NewImageAPIResponse ¶
func NewImageAPIResponse(resp *http.Response, uri string) (e *ErrInvalidImageAPIResponse)
NewImageAPIResponse creates an error response, optionally adding body to e when status is 404
func (ErrInvalidImageAPIResponse) Code ¶
func (e ErrInvalidImageAPIResponse) Code() int
Code returns the status code received from image api if an error is returned
func (ErrInvalidImageAPIResponse) Error ¶
func (e ErrInvalidImageAPIResponse) Error() string
Error should be called by the user to print out the stringified version of the error
type Image ¶
type Image struct { Id string `json:"id,omitempty"` CollectionId string `json:"collection_id,omitempty"` State string `json:"state,omitempty"` //enum: //- created //- uploaded //- importing //- imported //- published //- completed //- deleted //- failed_import //- failed_publish Error string `json:"error,omitempty"` Filename string `json:"filename,omitempty"` License License `json:"license,omitempty"` Links *ImageLinks `json:"links,omitempty"` Upload ImageUpload `json:"upload,omitempty"` Type string `json:"type,omitempty"` }
Image represents the fields for an Image
type ImageDownload ¶
type ImageDownload struct { Id string `json:"id,omitempty"` Height *int `json:"height,omitempty"` Href string `json:"href,omitempty"` Palette string `json:"palette,omitempty"` Private string `json:"private,omitempty"` Public bool `json:"public,omitempty"` Size int `json:"size,omitempty"` Type string `json:"type,omitempty"` Width *int `json:"width,omitempty"` Links *ImageDownloadLinks `json:"links,omitempty"` State string `json:"state,omitempty"` //enum: //- pending //- importing //- imported //- published //- completed //- failed Error string `json:"error,omitempty"` ImportStarted *time.Time `json:"import_started,omitempty"` ImportCompleted *time.Time `json:"import_completed,omitempty"` PublishStarted *time.Time `json:"publish_started,omitempty"` PublishCompleted *time.Time `json:"publish_completed,omitempty"` }
ImageDownload represents the fields for an Image Download
type ImageDownloadLinks ¶
ImageDownloadLinks represents the fields for the image download HATEOAS links
type ImageDownloads ¶
type ImageDownloads struct { Count int `json:"count"` Items []ImageDownload `json:"items"` Limit int `json:"limit"` Offset int `json:"offset"` TotalCount int `json:"total_count"` }
Images represents the fields for a group of image download variants as returned by Image API
type ImageLinks ¶
ImageLinks represents the fields for the image HATEOAS links
type ImageUpload ¶
type ImageUpload struct {
Path string `json:"path,omitempty"`
}
ImageUpload represents the fields for an Image Upload
type Images ¶
type Images struct { Count int `json:"count"` Items []Image `json:"items"` Limit int `json:"limit"` Offset int `json:"offset"` TotalCount int `json:"total_count"` }
Images represents the fields for a group of images as returned by Image API
type NewImage ¶
type NewImage struct { CollectionId string `json:"collection_id,omitempty"` State string `json:"state,omitempty"` Filename string `json:"filename,omitempty"` License License `json:"license,omitempty"` Type string `json:"type,omitempty"` }
NewImage represents the fields required to create a new Image
type NewImageDownload ¶
type NewImageDownload struct { Id string `json:"id,omitempty"` Height *int `json:"height,omitempty"` Palette string `json:"palette,omitempty"` Size int `json:"size,omitempty"` Type string `json:"type,omitempty"` Width *int `json:"width,omitempty"` State string `json:"state,omitempty"` //enum: //- importing ImportStarted *time.Time `json:"import_started,omitempty"` }
ImageDownload represents the fields for an Image Download