github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/ims/v2/images/ImportImageQuick.go (about) 1 package images 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack/common/tags" 7 "github.com/opentelekomcloud/gophertelekomcloud/openstack/ims/v1/others" 8 ) 9 10 type ImportImageQuickOpts struct { 11 // Specifies the image name. 12 Name string `json:"name" required:"true"` 13 // Provides supplementary information about the image. For detailed description, see Image Attributes. The value contains a maximum of 1024 characters and consists of only letters and digits. Carriage returns and angle brackets (< >) are not allowed. This parameter is left blank by default. 14 Description string `json:"description,omitempty"` 15 // Specifies the OS version. 16 // This parameter is valid if an external image file uploaded to the OBS bucket is used to create an image. For its value, see Values of Related Parameters. 17 // When a data disk image created, the value can be Linux or Windows. The default is Linux. 18 OsVersion string `json:"os_version,omitempty"` 19 // Specifies the URL of the external image file in the OBS bucket. 20 // 21 // This parameter is mandatory if an external image file in the OBS bucket is used to create an image. The format is OBS bucket name:Image file name. 22 // 23 // NOTE: 24 // The storage class of the OBS bucket must be Standard. 25 ImageUrl string `json:"image_url" required:"true"` 26 // Specifies the minimum size of the system disk in the unit of GB. 27 // 28 // This parameter is mandatory if an external image file in the OBS bucket is used to create an image. The value ranges from 1 to 1024. 29 MinDisk int `json:"min_disk" required:"true"` 30 // Lists the image tags. This parameter is left blank by default. 31 // 32 // Set either tags or image_tags. 33 Tags []string `json:"tags,omitempty"` 34 // Lists the image tags. The value is left blank by default. 35 // 36 // Set either tags or image_tags. 37 ImageTags []tags.ResourceTag `json:"image_tags,omitempty"` 38 // Specifies the image type. 39 // The parameter value is ECS/BMS for system disk images. The default value is ECS. 40 // The parameter value is DataImage for data disk images. 41 Type string `json:"type,omitempty"` 42 } 43 44 func ImportImageQuick(client *golangsdk.ServiceClient, opts ImportImageQuickOpts) (*string, error) { 45 b, err := build.RequestBody(opts, "") 46 if err != nil { 47 return nil, err 48 } 49 50 // POST /v2/cloudimages/quickimport/action 51 raw, err2 := client.Post(client.ServiceURL("cloudimages", "quickimport", "action"), b, nil, &golangsdk.RequestOpts{ 52 OkCodes: []int{200}, 53 }) 54 return others.ExtractJobId(err2, raw) 55 }