cloudimages

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddImageMembersOpts

type AddImageMembersOpts struct {
	// Images is the image list to operating
	Images []string `json:"images"`
	// Projects is the member list
	Projects []string `json:"projects"`
}

// CopyImage copy an existed image to another one func CopyImage(client *gophercloud.ServiceClient, imageID string, opts CopyImageOpts) (r ImageCopyResult) {

	b, err := opts.ToImageCopyMap()
	if err != nil {
		r.Err = err
		return
	}

	_, r.Err = client.Post(
		copyImageURL(client, imageID),
		b,
		&r.Body,
		&gophercloud.RequestOpts{OkCodes: []int{200}},
	)
	return
}

AddImageMembersOpts is the request body of image members adding operation

func (AddImageMembersOpts) ToImageMemberAddMap

func (opts AddImageMembersOpts) ToImageMemberAddMap() (map[string]interface{}, error)

ToImageMemberAddMap assembles a request body

type AddImageMembersResult

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

AddImageMembersResult represents the result of image members adding operation

func (AddImageMembersResult) ExtractJob

func (r AddImageMembersResult) ExtractJob() (*OperationJob, error)

type CopyImageOpts

type CopyImageOpts struct {
	// Name is the image name
	Name string `json:"name"`
	// Description is the description of the image
	Description string `json:"description,omitempty"`
	// CmkID is the key of encryption, default is empty
	CmkID string `json:"cmk_id,omitempty"`
}

// SetImageTag set a tag to an image func SetImageTag(client *gophercloud.ServiceClient, opts SetImageTagOpts) (r SetImageTagResult) {

	b, err := opts.ToImageTagSetMap()
	if err != nil {
		r.Err = err
		return
	}

	_, r.Err = client.Put(putImageTagsURL(client), b, nil, &gophercloud.RequestOpts{
		OkCodes: []int{204}})
	return
}
//ImportImage import an image from OBS bucket to the huawei cloud
func ImportImage(client *gophercloud.ServiceClient, imageID, imageURL string) (r ImportResult) {
	_, r.Err = client.Put(importImageURL(client, imageID), map[string]string{
		"image_url": imageURL,
	}, nil, &gophercloud.RequestOpts{OkCodes: []int{200}})
	return
}

// ExportImage export an image from huawei cloud to OBS bucket

func ExportImage(client *gophercloud.ServiceClient, imageID, bucketURL, fileFormat string) (r ExportResult) {
	_, r.Err = client.Post(exportImageURL(client, imageID), map[string]string{
		"bucket_url":  bucketURL,
		"file_format": fileFormat,
	}, nil, &gophercloud.RequestOpts{OkCodes: []int{200}})
	return
}

CopyImageOpts represents the request body struct of copy image operation

func (CopyImageOpts) ToImageCopyMap

func (opts CopyImageOpts) ToImageCopyMap() (map[string]interface{}, error)

ToImageCopyMap assembles a request body

type DeleteImageMembersOpts

type DeleteImageMembersOpts struct {
	// Images is the image list to operating
	Images []string `json:"images"`
	// Projects is the member list
	Projects []string `json:"projects"`
}

DeleteImageMembersOpts is the request body of image members adding operation

func (DeleteImageMembersOpts) ToImageMembersDeleteMap

func (opts DeleteImageMembersOpts) ToImageMembersDeleteMap() (map[string]interface{}, error)

ToImageMemberUpdateMap assembles a request body

type DeleteImageMembersResult

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

DeleteImageMembersResult represents the result of image members deleting operation

func (DeleteImageMembersResult) ExtractJob

func (r DeleteImageMembersResult) ExtractJob() (*OperationJob, error)

type ExportResult

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

ExportResult represents the result of the image exporting

func (ExportResult) ExtractJob

func (r ExportResult) ExtractJob() (*OperationJob, error)

type ImageCopyResult

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

CopyResult represents the result of the image copying

func (ImageCopyResult) ExtractJob

func (r ImageCopyResult) ExtractJob() (*OperationJob, error)

type ImageTags

type ImageTags struct {
	Tags []string `json:"tags"`
}

ImageTags is the golang struct of ImageTagsResult

type ImageTagsResult

type ImageTagsResult struct {
	gophercloud.Result
}

ImageTagsResult represents the result of image tags query

func (ImageTagsResult) Extract

func (r ImageTagsResult) Extract() (*ImageTags, error)

Extract extracts ImageTagsResult to struct

type ImagesQuota

type ImagesQuota struct {
	// Type is the resource type
	Type string `json:"type"`
	// Used is the amount of used resource
	Used int `json:"used"`
	// Quota is the amount of all resource
	Quota int `json:"quota"`
	// Min is the minimum of resource
	Min int `json:"min"`
	// Max is the maximum of resource
	Max int `json:"max"`
}

ImagesQuota represents the quota of cloud images

type ImportResult

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

ImportResult represents the result of the image importing

func (ImportResult) ExtractJob

func (r ImportResult) ExtractJob() (*OperationJob, error)

type ListImageTagsOpts

type ListImageTagsOpts struct {
	// Limit is Integer value for the limit of values to return
	Limit int `q:"limit"`

	// Page represents the page number listing
	Page int `q:"page"`
}

ListImageTagsOpts is the options for list image tags operation

func (ListImageTagsOpts) ToImageTagsListQuery

func (opts ListImageTagsOpts) ToImageTagsListQuery() (string, error)

ToImageTagsListQuery builds the options to url query parameters

type OperationJob

type OperationJob struct {
	JobID string `json:"job_id"`
}

type Quota

type Quota struct {
	Quota Resources `json:"quotas"`
}

type QuotaResult

type QuotaResult struct {
	gophercloud.Result
}

CloudImagesQuotaResult represents the result of cloud image quota request

func (QuotaResult) Extract

func (r QuotaResult) Extract() (*Quota, error)

Extract extracts the result to CloudImagesQuota

type Resources

type Resources struct {
	Resources []ImagesQuota `json:"resources"`
}

type SetImageTagOpts

type SetImageTagOpts struct {
	// ImageID is the image id
	ImageID string `json:"image_id"`

	// Tag is the tag you wanna set
	Tag string `json:"tag"`
	// set map tag
	ImageTag map[string]interface{} `json:"image_tag"`
}

// ListImageTags list tags of an image func ListImageTags(client *gophercloud.ServiceClient, opts ListImageTagsOpts) (r ImageTagsResult) {

	b, err := opts.ToImageTagsListQuery()
	if err != nil {
		r.Err = err
		return
	}

	_, r.Err = client.Get(getImageTagsURL(client)+b, &r.Body, nil)
	return
}

SetImageTagOpts represents the request body of SetImageTag

func (SetImageTagOpts) ToImageTagSetMap

func (opts SetImageTagOpts) ToImageTagSetMap() (map[string]interface{}, error)

ToImageSetMap assembles a request body

type SetImageTagResult

type SetImageTagResult struct {
	gophercloud.Result
}

SetImageTagResult is the result of image tag setting operation

type UpdateImageMemberOpts

type UpdateImageMemberOpts struct {
	// Images is the image list to update
	Images []string `json:"images"`
	// ProjectiD is the project id used to set
	ProjectID string `json:"project_id"`
	// Status is the status of members, accepted means accept shared image,
	// otherwise rejected
	Status string `json:"status"`
}

UpdateImageMemberOpts is the request body for image member updating

func (UpdateImageMemberOpts) ToImageMemberUpdateMap

func (opts UpdateImageMemberOpts) ToImageMemberUpdateMap() (map[string]interface{}, error)

ToImageMemberUpdateMap assembles a request body

type UpdateImageMemberResult

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

UpdateImageMemberResult represent the result of image members updating operation

func (UpdateImageMemberResult) ExtractJob

func (r UpdateImageMemberResult) ExtractJob() (*OperationJob, error)

Jump to

Keyboard shortcuts

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