Documentation
¶
Index ¶
- func GetJobEntity(client *golangsdk.ServiceClient, jobId string, label string) (interface{}, error)
- func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func WaitForJobSuccess(client *golangsdk.ServiceClient, secs int, jobID string) error
- type CreateByOBSOpts
- type CreateByServerOpts
- type CreateByVolumeOpts
- type CreateDataImageByOBSOpts
- type CreateDataImageByServerOpts
- type CreateOptsBuilder
- type DataImage
- type Image
- type ImageDateFilter
- type ImageDateQuery
- type ImagePage
- type ImageTag
- type JobEntity
- type JobResponse
- type JobResult
- func CreateDataImageByOBS(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
- func CreateDataImageByServer(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
- func CreateImageByOBS(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
- func CreateImageByServer(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
- func CreateImageByVolume(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
- type JobStatus
- type ListOpts
- type ListOptsBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJobEntity ¶
func List ¶
func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
List implements images list request
func WaitForJobSuccess ¶
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"`
}
CreateByOBSOpts 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"`
}
CreateByServerOpts 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 CreateByVolumeOpts ¶ added in v0.6.0
type CreateByVolumeOpts struct {
// the name of the system disk image
Name string `json:"name" required:"true"`
// Description of the image
Description string `json:"description,omitempty"`
// Specifies the data disk ID
VolumeId string `json:"volume_id" required:"true"`
// Specifies the OS version
OsVersion string `json:"os_version" required:"true"`
// Specifies the image type. The value can be ECS, BMS, FusionCompute, or Ironic.
Type string `json:"type,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"`
}
CreateByVolumeOpts represents options used to create an image.
func (CreateByVolumeOpts) ToImageCreateMap ¶ added in v0.6.0
func (opts CreateByVolumeOpts) ToImageCreateMap() (map[string]interface{}, error)
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"`
}
CreateDataImageByOBSOpts 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"`
}
CreateDataImageByServerOpts 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 ¶
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) NextPageURL ¶
NextPageURL uses the response's embedded link reference to navigate to the next page of results.
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)
CreateDataImageByOBS implements create image request.
func CreateDataImageByServer ¶
func CreateDataImageByServer(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
CreateDataImageByServer implements create image request.
func CreateImageByOBS ¶
func CreateImageByOBS(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
CreateImageByOBS implements create image request.
func CreateImageByServer ¶
func CreateImageByServer(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
CreateImageByServer implements create image request.
func CreateImageByVolume ¶ added in v0.6.0
func CreateImageByVolume(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)
CreateImageByVolume implements create image request.
func (JobResult) ExtractJobResponse ¶
func (r JobResult) ExtractJobResponse() (*JobResponse, error)
func (JobResult) ExtractJobStatus ¶
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 ¶
ToImageListQuery formats a ListOpts into a query string.