cloudimages

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJobEntity

func GetJobEntity(client *golangsdk.ServiceClient, jobId string, label string) (interface{}, error)

func List

func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager

List implements images list request

func WaitForJobSuccess

func WaitForJobSuccess(client *golangsdk.ServiceClient, secs int, jobID string) error

Types

type CreateByOBSOpts

type CreateByOBSOpts struct {
	// the name of the system disk image
	Name string `json:"name" required:"true"`
	// Description of image
	Description string `json:"description,omitempty"`
	// the OS version
	OsVersion string `json:"os_version,omitempty"`
	// the URL of the external image file in the OBS bucket
	ImageUrl string `json:"image_url" required:"true"`
	// the minimum size of the system disk in the unit of GB
	MinDisk int `json:"min_disk" required:"true"`
	// whether automatic configuration is enabled,the value can be true or false
	IsConfig bool `json:"is_config,omitempty"`
	// the master key used for encrypting an image
	CmkId string `json:"cmk_id,omitempty"`
	// image label "key.value"
	Tags []string `json:"tags,omitempty"`
	// One or more tag key and value pairs to associate with the image
	ImageTags []ImageTag `json:"image_tags,omitempty"`
	// the image type, the value can be ECS,BMS,FusionCompute, or Ironic
	Type string `json:"type,omitempty"`
	// the maximum memory of the image in the unit of MB
	MaxRam int `json:"max_ram,omitempty"`
	// the minimum memory of the image in the unit of MB
	MinRam int `json:"min_ram,omitempty"`
}

CreateOpts represents options used to create an image.

func (CreateByOBSOpts) ToImageCreateMap

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

type CreateByServerOpts

type CreateByServerOpts struct {
	// the name of the system disk image
	Name string `json:"name" required:"true"`
	// Description of the image
	Description string `json:"description,omitempty"`
	// server id to be converted
	InstanceId string `json:"instance_id" required:"true"`
	// the data disks to be converted
	DataImages []DataImage `json:"data_images,omitempty"`
	// image label "key.value"
	Tags []string `json:"tags,omitempty"`
	// One or more tag key and value pairs to associate with the image
	ImageTags []ImageTag `json:"image_tags,omitempty"`
	// the maximum memory of the image in the unit of MB
	MaxRam int `json:"max_ram,omitempty"`
	// the minimum memory of the image in the unit of MB
	MinRam int `json:"min_ram,omitempty"`
}

CreateOpts represents options used to create an image.

func (CreateByServerOpts) ToImageCreateMap

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

ToImageCreateMap assembles a request body based on the contents of a CreateByServerOpts.

type CreateDataImageByOBSOpts

type CreateDataImageByOBSOpts struct {
	// the name of the data disk image
	Name string `json:"name" required:"true"`
	// Description of image
	Description string `json:"description,omitempty"`
	// the OS type
	OsType string `json:"os_type" required:"true"`
	// the URL of the external image file in the OBS bucket
	ImageUrl string `json:"image_url" required:"true"`
	// the minimum size of the system disk in the unit of GB
	MinDisk int `json:"min_disk" required:"true"`
	// the master key used for encrypting an image
	CmkId string `json:"cmk_id,omitempty"`
}

CreateOpts represents options used to create an image.

func (CreateDataImageByOBSOpts) ToImageCreateMap

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

type CreateDataImageByServerOpts

type CreateDataImageByServerOpts struct {
	// the data disks to be converted
	DataImages []DataImage `json:"data_images" required:"true"`
}

CreateOpts represents options used to create an image.

func (CreateDataImageByServerOpts) ToImageCreateMap

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

type CreateOptsBuilder

type CreateOptsBuilder interface {
	// Returns value that can be passed to json.Marshal
	ToImageCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add parameters to the Create request.

type DataImage

type DataImage struct {
	// the data disk image name
	Name string `json:"name" required:"true"`
	// the data disk ID
	VolumeId string `json:"volume_id" required:"true"`
	// information about the data disk
	Description string `json:"description,omitempty"`
	// the data disk image tags
	Tags []string `json:"tags,omitempty"`
}

type Image

type Image struct {
	// the URL for uploading and downloading the image file
	File string `json:"file"`
	// the image owner
	Owner string `json:"owner"`
	// the image id
	ID string `json:"id"`
	// the image URL
	Self string `json:"self"`
	// the image schema
	Schema string `json:"schema"`
	// the image status, the value can be [queued, saving, deleted, killed,active]
	Status string `json:"status"`
	// the image tags
	Tags []string `json:"tags"`
	// whether the image can be seen by others
	Visibility string `json:"visibility"`
	// the image name
	Name string `json:"name"`
	// whether the image has been deleted
	Deleted bool `json:"deleted"`
	// whether the image is protected
	Protected bool `json:"protected"`
	// the container type
	ContainerFormat string `json:"container_format"`
	// the minimum memory size (MB) required for running the image
	MinRam int `json:"min_ram"`
	// the maximum memory of the image in the unit of MB, notice: string
	MaxRam string `json:"max_ram"`
	// the disk format, the value can be [vhd, raw, zvhd, qcow2]
	DiskFormat string `json:"disk_format"`
	// the minimum disk space (GB) required for running the image
	MinDisk int `json:"min_disk"`
	// the environment where the image is used
	VirtualEnvType string `json:"virtual_env_type"`
	// *size, virtual_size and checksum parameter are unavailable currently*
	Size        int64  `json:"size"`
	VirtualSize int    `json:"virtual_size"`
	Checksum    string `json:"checksum"`
	// created_at and updated_at are in UTC format
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
	DeletedAt string    `json:"deleted_at"`
	// the OS architecture: 32 or 64
	OsBit                  string `json:"__os_bit"`
	OsVersion              string `json:"__os_version"`
	Description            string `json:"__description"`
	OsType                 string `json:"__os_type"`
	Isregistered           string `json:"__isregistered"`
	Platform               string `json:"__platform"`
	ImageSourceType        string `json:"__image_source_type"`
	Imagetype              string `json:"__imagetype"`
	Originalimagename      string `json:"__originalimagename"`
	BackupID               string `json:"__backup_id"`
	Productcode            string `json:"__productcode"`
	ImageSize              string `json:"__image_size"`
	DataOrigin             string `json:"__data_origin"`
	SupportKvm             string `json:"__support_kvm"`
	SupportXen             string `json:"__support_xen"`
	SupportLargeMemory     string `json:"__support_largememory"`
	SupportDiskintensive   string `json:"__support_diskintensive"`
	SupportHighperformance string `json:"__support_highperformance"`
	SupportXenGpuType      string `json:"__support_xen_gpu_type"`
	SupportKvmGpuType      string `json:"__support_kvm_gpu_type"`
	SupportXenHana         string `json:"__support_xen_hana"`
	SupportKvmInfiniband   string `json:"__support_kvm_infiniband"`
	SystemSupportMarket    bool   `json:"__system_support_market"`
	RootOrigin             string `json:"__root_origin"`
	SequenceNum            string `json:"__sequence_num"`
}

Image represents an image found in the IMS.

func ExtractImages

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

ExtractImages interprets the results of a single page from a List() call, producing a slice of Image entities.

func (*Image) UnmarshalJSON

func (r *Image) UnmarshalJSON(b []byte) error

type ImageDateFilter

type ImageDateFilter string

ImageDateFilter represents a valid filter to use for filtering images by their date during a List.

const (
	FilterGT  ImageDateFilter = "gt"
	FilterGTE ImageDateFilter = "gte"
	FilterLT  ImageDateFilter = "lt"
	FilterLTE ImageDateFilter = "lte"
	FilterNEQ ImageDateFilter = "neq"
	FilterEQ  ImageDateFilter = "eq"
)

type ImageDateQuery

type ImageDateQuery struct {
	Date   time.Time
	Filter ImageDateFilter
}

ImageDateQuery represents a date field to be used for listing images. If no filter is specified, the query will act as though FilterEQ was set.

type ImagePage

type ImagePage struct {
	pagination.LinkedPageBase
	// contains filtered or unexported fields
}

ImagePage represents the results of a List request.

func (ImagePage) IsEmpty

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

IsEmpty returns true if an ImagePage contains no Images results.

func (ImagePage) NextPageURL

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

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

type ImageTag

type ImageTag struct {
	Key   string `json:"key" required:"true"`
	Value string `json:"value,omitempty"`
}

type JobEntity

type JobEntity struct {
	ImageID     string `json:"image_id"`
	DataImageID string `json:"__data_images"`
}

type JobResponse

type JobResponse struct {
	JobID string `json:"job_id"`
}

type JobResult

type JobResult struct {
	golangsdk.Result
}

func CreateDataImageByOBS

func CreateDataImageByOBS(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)

Create implements create image request.

func CreateDataImageByServer

func CreateDataImageByServer(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)

Create implements create image request.

func CreateImageByOBS

func CreateImageByOBS(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)

Create implements create image request.

func CreateImageByServer

func CreateImageByServer(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)

Create implements create image request.

func (JobResult) ExtractJobResponse

func (r JobResult) ExtractJobResponse() (*JobResponse, error)

func (JobResult) ExtractJobStatus

func (r JobResult) ExtractJobStatus() (*JobStatus, error)

type JobStatus

type JobStatus struct {
	Status     string    `json:"status"`
	Entities   JobEntity `json:"entities"`
	JobID      string    `json:"job_id"`
	JobType    string    `json:"job_type"`
	BeginTime  string    `json:"begin_time"`
	EndTime    string    `json:"end_time"`
	ErrorCode  string    `json:"error_code"`
	FailReason string    `json:"fail_reason"`
}

type ListOpts

type ListOpts struct {
	Isregistered           string `q:"__isregistered"`
	Imagetype              string `q:"__imagetype"`
	Protected              bool   `q:"protected"`
	Visibility             string `q:"visibility"`
	Owner                  string `q:"owner"`
	ID                     string `q:"id"`
	Status                 string `q:"status"`
	Name                   string `q:"name"`
	ContainerFormat        string `q:"container_format"`
	DiskFormat             string `q:"disk_format"`
	MinRam                 int    `q:"min_ram"`
	MinDisk                int    `q:"min_disk"`
	OsBit                  string `q:"__os_bit"`
	Platform               string `q:"__platform"`
	Marker                 string `q:"marker"`
	Limit                  int    `q:"limit"`
	SortKey                string `q:"sort_key"`
	SortDir                string `q:"sort_dir"`
	OsType                 string `q:"__os_type"`
	Tag                    string `q:"tag"`
	MemberStatus           string `q:"member_status"`
	SupportKvm             string `q:"__support_kvm"`
	SupportXen             string `q:"__support_xen"`
	SupportLargeMemory     string `q:"__support_largememory"`
	SupportDiskintensive   string `q:"__support_diskintensive"`
	SupportHighperformance string `q:"__support_highperformance"`
	SupportXenGpuType      string `q:"__support_xen_gpu_type"`
	SupportKvmGpuType      string `q:"__support_kvm_gpu_type"`
	SupportXenHana         string `q:"__support_xen_hana"`
	SupportKvmInfiniband   string `q:"__support_kvm_infiniband"`
	VirtualEnvType         string `q:"virtual_env_type"`
	// CreatedAtQuery filters images based on their creation date.
	CreatedAtQuery *ImageDateQuery
	// UpdatedAtQuery filters images based on their updated date.
	UpdatedAtQuery *ImageDateQuery
}

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)
}

Jump to

Keyboard shortcuts

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