cloudimages

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type CreateByFileOpts

type CreateByFileOpts struct {
	// Name is the name of the new image.
	Name string `json:"name" required:"true"`

	// Description of image.
	Description string `json:"description"`

	//OBS桶中外部镜像文件地址。
	ImageUrl string `json:"image_url"`

	//操作系统版本。
	OsVersion string `json:"os_version"`

	//是否自动配置,取值为true或false。
	IsConfig bool `json:"is_config"`

	//是否完成了初始化配置。取值为true或false。
	IsConfigInit bool `json:"is_config_init"`

	//最小系统盘大小。
	MinDisk int `json:"min_disk"`

	//创建加密镜像的用户主密钥
	CmkId string `json:"cmk_id"`

	//image label "key.value"
	Tags []string `json:"tags"`
}

CreateOpts represents options used to create an image.

func (CreateByFileOpts) ToImageCreateMap

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

type CreateByServerOpts

type CreateByServerOpts struct {
	// Name is the name of the new image.
	Name string `json:"name" required:"true"`

	// Description of image.
	Description string `json:"description"`

	// server id to be converse
	InstanceId string `json:"instance_id"`

	// image label "key.value"
	Tags []string `json:"tags"`
}

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 CreateOpts.

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 CreateResult

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

func CreateImageByFile

func CreateImageByFile(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create implements create image request.

func CreateImageByServer

func CreateImageByServer(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create implements create image request.

func (CreateResult) ExtractJob

func (r CreateResult) ExtractJob() (*Job, error)

func (CreateResult) ExtractJobResult

func (r CreateResult) ExtractJobResult() (*JobResult, error)

type Entity

type Entity struct {
	ImageId string `json:"image_id"`
}

type Image

type Image struct {
	File                   string   `json:"file"`
	Owner                  string   `json:"owner"`
	ID                     string   `json:"id"`
	Size                   int64    `json:"size"`
	Self                   string   `json:"self"`
	Schema                 string   `json:"schema"`
	Status                 string   `json:"status"`
	Tags                   []string `json:"tags"`
	Visibility             string   `json:"visibility"`
	Name                   string   `json:"name"`
	Checksum               string   `json:"checksum"`
	Deleted                bool     `json:"deleted"`
	Protected              bool     `json:"protected"`
	ContainerFormat        string   `json:"container_format"`
	MinRam                 int      `json:"min_ram"`
	UpdatedAt              string   `json:"updated_at"`
	OsBit                  string   `json:"__os_bit"`
	OsVersion              string   `json:"__os_version"`
	Description            string   `json:"__description"`
	DiskFormat             string   `json:"disk_format"`
	Isregistered           string   `json:"__isregistered"`
	Platform               string   `json:"__platform"`
	OsType                 string   `json:"__os_type"`
	MinDisk                int      `json:"min_disk"`
	VirtualEnvType         string   `json:"virtual_env_type"`
	ImageSourceType        string   `json:"__image_source_type"`
	Imagetype              string   `json:"__imagetype"`
	CreatedAt              string   `json:"created_at"`
	VirtualSize            int      `json:"virtual_size"`
	DeletedAt              string   `json:"deleted_at"`
	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"`
	SupportDiskintensive   string   `json:"__support_diskintensive"`
	SupportHighperformance string   `json:"__support_highperformance"`
	SupportXenGpuType      string   `json:"__support_xen_gpu_type"`
	IsConfigInit           string   `json:"__is_config_init"`
	SystemSupportMarket    bool     `json:"__system_support_market"`
}

Image represents an image found in the OpenStack Image service.

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.

type ImagePage

type ImagePage struct {
	pagination.LinkedPageBase
}

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 Job

type Job struct {
	// job id of create image
	Id string `json:"job_id"`
}

执行创建image异步接口时返回的jobid结构

type JobExecResult

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

func GetJobResult

func GetJobResult(client *gophercloud.ServiceClient, id string) (r JobExecResult)

Get job result.

func (JobExecResult) ExtractJob

func (r JobExecResult) ExtractJob() (*Job, error)

func (JobExecResult) ExtractJobResult

func (r JobExecResult) ExtractJobResult() (*JobResult, error)

type JobResult

type JobResult struct {
	//任务ID
	Id string `json:"job_id"`

	//任务类型
	Type string `json:"job_type"`

	/*任务状态,目前取值如下:
	  SUCCESS:表示该任务执行已经结束,任务执行成功。
	  FAIL:表示该任务执行已经结束,任务执行失败。
	  RUNNING:表示该任务正在执行。
	  INIT:表示给任务还未执行,正在初始化。*/
	Status string `json:"status"`

	//任务开始时间
	BeginTime string `json:"begin_time"`

	//任务结束时间
	EndTime string `json:"end_time"`

	//错误码
	ErrorCode string `json:"error_code"`

	//失败原因
	FailReason string `json:"fail_reason"`

	//任务自定义属性。任务正常时,会返回镜像的ID。
	Entities Entity `json:"entities"`
}

根据jobId查询job的结构

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"`
	SupportDiskintensive   string `q:"__support_diskintensive"`
	SupportHighperformance string `q:"__support_highperformance"`
	SupportXenGpuType      string `q:"__support_xen_gpu_type"`
	VirtualEnvType         string `q:"virtual_env_type"`
}

func (ListOpts) ToImageListQuery

func (opts ListOpts) ToImageListQuery() (string, error)

type ListOptsBuilder

type ListOptsBuilder interface {
	ToImageListQuery() (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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