images

package
v0.3.25 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(client *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)

Create an image.

func Delete

func Delete(client *gcorecloud.ServiceClient, imageID string) (r tasks.Result)

Delete an image.

func ExtractImageIDFromTask

func ExtractImageIDFromTask(task *tasks.Task) (string, error)

func ExtractImagesInto

func ExtractImagesInto(r pagination.Page, v interface{}) error

Types

type CreateOpts

type CreateOpts struct {
	URL        string             `json:"url" required:"true" validate:"required,url"`
	Name       string             `json:"name" required:"true" validate:"required"`
	CowFormat  bool               `json:"cow_format,omitempty"`
	Properties *map[string]string `json:"properties,omitempty"`
}

CreateOpts represents options used to create a image.

func (CreateOpts) ToImageCreateMap

func (opts CreateOpts) ToImageCreateMap() (map[string]interface{}, error)

ToImageCreateMap builds a request body from CreateOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

Validate

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToImageCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Image.

func Get

func Get(client *gcorecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific image based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Image, error)

Extract is a function that accepts a result and extracts a image resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type Image

type Image struct {
	ID            string                   `json:"id"`
	Name          string                   `json:"name"`
	Description   string                   `json:"description"`
	Status        string                   `json:"status"`
	Tags          []string                 `json:"tags"`
	Visibility    string                   `json:"visibility"`
	MinDisk       int                      `json:"min_disk"`
	MinRAM        int                      `json:"min_ram"`
	OsDistro      string                   `json:"os_distro"`
	OsVersion     string                   `json:"os_version"`
	DisplayOrder  int                      `json:"display_order"`
	CreatedAt     gcorecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt     *gcorecloud.JSONRFC3339Z `json:"updated_at"`
	Size          int                      `json:"size"`
	CreatorTaskID *string                  `json:"creator_task_id"`
	TaskID        *string                  `json:"task_id"`
	Region        string                   `json:"region"`
	DiskFormat    string                   `json:"disk_format"`
}

func ExtractImages

func ExtractImages(r pagination.Page) ([]Image, error)

ExtractImages accepts a Page struct, specifically a ImagePage struct, and extracts the elements into a slice of image structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(client *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]Image, error)

type ImagePage

type ImagePage struct {
	pagination.LinkedPageBase
}

ImagePage is the page returned by a pager when traversing over a collection of images.

func (ImagePage) IsEmpty

func (r ImagePage) IsEmpty() (bool, error)

IsEmpty checks whether a ImagePage struct is empty.

func (ImagePage) NextPageURL

func (r ImagePage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of images has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type ImageTaskResult

type ImageTaskResult struct {
	Images []string `json:"images"`
}

type ListOpts

type ListOpts struct {
	Private    bool             `q:"private"`
	Visibility types.Visibility `q:"visibility"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToImageListQuery

func (opts ListOpts) ToImageListQuery() (string, error)

ToImageListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToImageListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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