Documentation ¶
Index ¶
- func Create(client *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)
- func Delete(client *gcorecloud.ServiceClient, imageID string) (r tasks.Result)
- func ExtractImageIDFromTask(task *tasks.Task) (string, error)
- func ExtractImagesInto(r pagination.Page, v interface{}) error
- func List(client *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func Upload(client *gcorecloud.ServiceClient, opts UploadOptsBuilder) (r tasks.Result)
- type CreateOpts
- type CreateOptsBuilder
- type GetResult
- type Image
- type ImagePage
- type ImageTaskResult
- type ListOpts
- type ListOptsBuilder
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
- type UploadOpts
- type UploadOptsBuilder
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 ExtractImagesInto ¶
func ExtractImagesInto(r pagination.Page, v interface{}) error
func List ¶
func List(client *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
func Upload ¶ added in v0.4.29
func Upload(client *gcorecloud.ServiceClient, opts UploadOptsBuilder) (r tasks.Result)
Upload accepts a UploadOpts struct and upload an image using the values provided.
Types ¶
type CreateOpts ¶
type CreateOpts struct { Name string `json:"name" required:"true" validate:"required"` HwMachineType types.HwMachineType `json:"hw_machine_type" validate:"required,enum"` SshKey types.SshKeyType `json:"ssh_key" validate:"required,enum"` OSType types.OSType `json:"os_type" validate:"required,enum"` IsBaremetal *bool `json:"is_baremetal,omitempty"` HwFirmwareType types.HwFirmwareType `json:"hw_firmware_type" validate:"required,enum"` Source types.ImageSourceType `json:"source" validate:"required,enum"` VolumeID string `json:"volume_id" required:"true" validate:"required"` }
CreateOpts represents options used to create an 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
"cow_format": False, "hw_firmware_type": "bios", "hw_machine_type": "q35", "is_baremetal": False, "name": "image_name", "os_type": "linux", "ssh_key": "allow", "url": "http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", "metadata": {"key": "value"}, }
Validate
type CreateOptsBuilder ¶
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 ¶
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"` Metadata []metadata.Metadata `json:"metadata_detailed"` }
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) NextPageURL ¶
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" validate:"omitempty"` Visibility types.Visibility `q:"visibility" validate:"omitempty"` MetadataK string `q:"metadata_k" validate:"omitempty"` MetadataKV map[string]string `q:"metadata_kv" validate:"omitempty"` }
ListOpts allows the filtering and sorting of paginated collections through the API.
func (ListOpts) ToImageListQuery ¶
ToImageListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type UpdateOpts ¶ added in v0.4.29
type UpdateOpts struct { HwMachineType types.HwMachineType `json:"hw_machine_type" validate:"required,enum"` SshKey types.SshKeyType `json:"ssh_key" validate:"required,enum"` Name string `json:"name" required:"true"` OSType types.OSType `json:"os_type" validate:"required,enum"` IsBaremetal *bool `json:"is_baremetal,omitempty"` HwFirmwareType types.HwFirmwareType `json:"hw_firmware_type" validate:"required,enum"` }
UpdateOpts represents options used to create an image.
func (UpdateOpts) ToImageUpdateMap ¶ added in v0.4.29
func (opts UpdateOpts) ToImageUpdateMap() (map[string]interface{}, error)
ToImageUpdateMap builds a request body from UpdateOpts.
type UpdateOptsBuilder ¶ added in v0.4.29
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶ added in v0.4.29
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdatyResult represents the result of a update operation. Call its Extract method to interpret it as a Image.
func Update ¶ added in v0.4.29
func Update(client *gcorecloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates an existing image using the values provided.
func (UpdateResult) Extract ¶ added in v0.4.29
Extract is a function that accepts a result and extracts a image resource.
func (UpdateResult) ExtractInto ¶ added in v0.4.29
func (r UpdateResult) ExtractInto(v interface{}) error
type UploadOpts ¶ added in v0.4.29
type UploadOpts struct { OsVersion string `json:"os_version,omitempty"` HwMachineType types.HwMachineType `json:"hw_machine_type" validate:"required,enum"` SshKey types.SshKeyType `json:"ssh_key" validate:"required,enum"` Name string `json:"name" required:"true" validate:"required"` OsDistro string `json:"os_distro,omitempty"` OSType types.OSType `json:"os_type" validate:"required,enum"` URL string `json:"url" required:"true" validate:"required,url"` IsBaremetal *bool `json:"is_baremetal,omitempty"` HwFirmwareType types.HwFirmwareType `json:"hw_firmware_type" validate:"required,enum"` CowFormat bool `json:"cow_format"` Metadata map[string]string `json:"metadata,omitempty"` }
UploadOpts represents options used to upload an image.
func (UploadOpts) ToImageUploadMap ¶ added in v0.4.29
func (opts UploadOpts) ToImageUploadMap() (map[string]interface{}, error)
ToImageUploadMap builds a request body from UploadOpts.
type UploadOptsBuilder ¶ added in v0.4.29
UploadOptsBuilder allows extensions to add additional parameters to the Upload request.