github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/ims/v1/others/CopyImageInRegion.go (about)

     1  package others
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type CopyImageInRegionOpts struct {
     9  	// Specifies the image ID.
    10  	ImageId string `json:"-" required:"true"`
    11  	// Specifies the image name.
    12  	Name string `json:"name" required:"true"`
    13  	// Specifies the encryption key. This parameter is left blank by default.
    14  	CmkId string `json:"cmk_id,omitempty"`
    15  	// 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.
    16  	Description string `json:"description,omitempty"`
    17  }
    18  
    19  func CopyImageInRegion(client *golangsdk.ServiceClient, opts CopyImageInRegionOpts) (*string, error) {
    20  	b, err := build.RequestBody(opts, "")
    21  	if err != nil {
    22  		return nil, err
    23  	}
    24  
    25  	// POST /v1/cloudimages/{image_id}/copy
    26  	raw, err := client.Post(client.ServiceURL("cloudimages", opts.ImageId, "copy"), b, nil, &golangsdk.RequestOpts{
    27  		OkCodes: []int{200},
    28  	})
    29  	return ExtractJobId(err, raw)
    30  }