images

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HwFirmwareTypeBios ImageHwFirmwareType = "bios"
	HwFirmwareTypeUefi ImageHwFirmwareType = "uefi"

	OsTypeLinux   ImageOsType = "linux"
	OsTypeWindows ImageOsType = "windows"

	SshKeyAllow    SshKeyType = "allow"
	SshKeyDeny     SshKeyType = "deny"
	SshKeyRequired SshKeyType = "required"
)

Variables

This section is empty.

Functions

func Delete

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

Delete deletes a GPU image by ID

func ExtractImageIDFromTask

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

func ExtractImagesInto

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

func ImageURL

func ImageURL(c *gcorecloud.ServiceClient, imageID string) string

ImageURL returns URL for specific GPU image operations

func ImagesURL

func ImagesURL(c *gcorecloud.ServiceClient) string

ImagesURL returns URL for GPU images operations

func List

List retrieves list of GPU images

func UploadImage

func UploadImage(client *gcorecloud.ServiceClient, opts ImageOpts) (r tasks.Result)

UploadImage uploads a new GPU image

Types

type CreateResult

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

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

func (CreateResult) Extract

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

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

func (CreateResult) ExtractInto

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

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, imageID string) (r GetResult)

Get retrieves a specific GPU image by 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"`
	Status         string                   `json:"status"`
	MinDisk        int                      `json:"min_disk"`
	MinRAM         int                      `json:"min_ram"`
	Size           int                      `json:"size"`
	Visibility     string                   `json:"visibility"`
	Architecture   string                   `json:"architecture"`
	CowFormat      bool                     `json:"cow_format"`
	HwFirmwareType *ImageHwFirmwareType     `json:"hw_firmware_type"`
	OsDistro       *string                  `json:"os_distro"`
	OsType         *ImageOsType             `json:"os_type"`
	OsVersion      *string                  `json:"os_version"`
	SshKey         SshKeyType               `json:"ssh_key"`
	URL            string                   `json:"url"`
	CreatedAt      gcorecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt      *gcorecloud.JSONRFC3339Z `json:"updated_at"`
	CreatorTaskID  *string                  `json:"creator_task_id"`
	TaskID         *string                  `json:"task_id"`
	Metadata       map[string]interface{}   `json:"metadata"`
}

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.

type ImageHwFirmwareType

type ImageHwFirmwareType string

type ImageOpts

type ImageOpts struct {
	// Image name
	Name string `json:"name" required:"true"`

	// Image URL
	URL string `json:"url" required:"true"`

	// Image architecture type: aarch64, x86_64
	Architecture *string `json:"architecture,omitempty"`

	// When True, image cannot be deleted unless all volumes, created from it, are deleted.
	CowFormat *bool `json:"cow_format,omitempty"`

	// Specifies the type of firmware with which to boot the guest.
	HwFirmwareType *ImageHwFirmwareType `json:"hw_firmware_type,omitempty"`

	// Create one or more metadata items for a cluster
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.
	OsDistro *string `json:"os_distro,omitempty"`

	// The operating system installed on the image.
	OsType *ImageOsType `json:"os_type,omitempty"`

	// OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian
	OsVersion *string `json:"os_version,omitempty"`

	// Permission to use a ssh key in instances
	SshKey *SshKeyType `json:"ssh_key,omitempty"`
}

ImageOpts represents common options for uploading GPU images.

func (ImageOpts) ToImageCreateMap

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

ToImageCreateMap builds a request body from ImageOpts.

type ImageOsType

type ImageOsType string

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 SshKeyType

type SshKeyType string

type UpdateResult

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

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

func (UpdateResult) Extract

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

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

func (UpdateResult) ExtractInto

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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