cloudimages

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, 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"`
	// the minimum memory of the image in the unit of MB
	MinRam int `json:"min_ram,omitempty"`
	// whether automatic configuration is enabled,the value can be true or false
	IsConfig bool `json:"is_config,omitempty"`
	// whether the initial configuration is complete
	IsConfigInit bool `json:"is_config_init,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"`
}

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"`
	// Enterprise project ID
	EnterpriseProjectID string `json:"enterprise_project_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 CreateWholeImageOpts

type CreateWholeImageOpts struct {
	// the name of the system disk image
	Name string `json:"name" required:"true"`
	// Description of image
	Description string `json:"description,omitempty"`
	// the ID of the instance
	InstanceId string `json:"instance_id,omitempty"`
	// the ID of the CBR backup
	BackupId string `json:"backup_id,omitempty"`
	// image label "key.value"
	Tags []string `json:"tags,omitempty"`
	// the minimum memory of the image in the unit of MB
	MinRam int `json:"min_ram,omitempty"`
	// Enterprise project ID
	EnterpriseProjectID string `json:"enterprise_project_id,omitempty"`
	// the method of creating a full-ECS image
	WholeImageType string `json:"whole_image_type,omitempty"`
}

CreateWholeImageOpts represents options used to create an image.

func (CreateWholeImageOpts) ToImageCreateMap

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

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 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"`
	WholeImage             string `json:"__whole_image"`
	Originalimagename      string `json:"__originalimagename"`
	Productcode            string `json:"__productcode"`
	ImageSize              string `json:"__image_size"`
	DataOrigin             string `json:"__data_origin"`
	LazyLoading            string `json:"__lazyloading"`
	OsFeatureList          string `json:"__os_feature_list"`
	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"`
	IsOffshelved           string `json:"__is_offshelved"`
	RootOrigin             string `json:"__root_origin"`
	SequenceNum            string `json:"__sequence_num"`
	SupportFcInject        string `json:"__support_fc_inject"`
	HwDiskBus              string `q:"hw_disk_bus"`
	HwFirmwareType         string `json:"hw_firmware_type"`
	HwVifMultiqueueEnabled string `json:"hw_vif_multiqueue_enabled"`
	SupportArm             string `json:"__support_arm"`
	SupportAgentList       string `json:"__support_agent_list"`
	SystemCmkid            string `json:"__system__cmkid"`
	AccountCode            string `json:"__account_code"`
	SupportAmd             string `json:"__support_amd"`
}

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 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 CreateWholeImageByBackup

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

Create implements create image request.

func CreateWholeImageByServer

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

Create implements create whole 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"`
	WholeImage             bool   `q:"__whole_image"`
	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"`
	Marker                 string `q:"marker"`
	Limit                  int    `q:"limit"`
	SortKey                string `q:"sort_key"`
	SortDir                string `q:"sort_dir"`
	OsType                 string `q:"__os_type"`
	Platform               string `q:"__platform"`
	OsVersion              string `q:"__os_version"`
	OsBit                  string `q:"__os_bit"`
	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"`
	Architecture           string `q:"architecture"`
	HwDiskBus              string `q:"hw_disk_bus"`
	HwFirmwareType         string `q:"hw_firmware_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)
}

type Patch

type Patch interface {
	ToImagePatchMap() map[string]interface{}
}

Patch represents a single update to an existing image. Multiple updates to an image can be submitted at the same time.

type UpdateImageProperty

type UpdateImageProperty struct {
	Op    UpdateOp
	Name  string
	Value interface{}
}

UpdateImageProperty represents an update property request.

func (UpdateImageProperty) ToImagePatchMap

func (r UpdateImageProperty) ToImagePatchMap() map[string]interface{}

ToImagePatchMap assembles a request body based on UpdateImageProperty.

type UpdateOp

type UpdateOp string

UpdateOp represents a valid update operation.

const (
	AddOp     UpdateOp = "add"
	ReplaceOp UpdateOp = "replace"
	RemoveOp  UpdateOp = "remove"
)

type UpdateOpts

type UpdateOpts []Patch

UpdateOpts implements UpdateOpts

func (UpdateOpts) ToImageUpdateMap

func (opts UpdateOpts) ToImageUpdateMap() ([]interface{}, error)

ToImageUpdateMap assembles a request body based on the contents of UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToImageUpdateMap() ([]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

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

func Update

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update implements image updated request.

func (UpdateResult) Extract

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

Extract will get the Image object out of the commonResult object.

func (UpdateResult) ExtractInto

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

ExtractInto converts our response data into a volume struct

Jump to

Keyboard shortcuts

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