aliyun

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func New

func New(opts *Options) (*API, error)

New creates a new aliyun API wrapper. It uses credentials from any of the standard credentials sources, including the environment and the profile configured in ~/.aliyun.

func (*API) ChangeVisibility

func (a *API) ChangeVisibility(region string, id string, public bool) error

ChangeVisibility modifies an image uploaded to Aliyun as either public or private. NOTE: only us-east-1 and us-west-1 support making images public unless your account has been allowlisted by Aliyun to operate on all regions

func (*API) CopyImage

func (a *API) CopyImage(source_id, dest_name, dest_region, dest_description, kms_key_id string, encrypted bool, wait_for_ready bool) (string, error)

CopyImage replicates an image to a new region

func (*API) DeleteFile

func (a *API) DeleteFile(bucket, path string) error

DeleteFile deletes a file from an OSS bucket

func (*API) DeleteImage

func (a *API) DeleteImage(id string, force bool) error

DeleteImage deletes an image and it's underlying snapshots

func (*API) DeleteSnapshot

func (a *API) DeleteSnapshot(id string, force bool) error

DeleteSnapshot deletes a snapshot

func (*API) GetImages

func (a *API) GetImages(name string) (*ecs.DescribeImagesResponse, error)

GetImages retrieves a list of images by ImageName

func (*API) GetImagesByID

func (a *API) GetImagesByID(id string, region string) (*ecs.DescribeImagesResponse, error)

GetImagesByID retrieves a list of images by ImageId

func (*API) ImportImage

func (a *API) ImportImage(format, bucket, object, image_size, device, name, description, architecture string, force bool) (string, error)

ImportImage attempts to import an image from OSS returning the image_id & error

NOTE: this function will re-use existing images that share the same final name if the name is not unique then provide force to pre-remove any images with the specified name

func (*API) ListRegions

func (a *API) ListRegions() ([]string, error)

ListRegions lists the enabled regions in aliyun implicitly by the Profile and Region options.

func (*API) PutObject

func (a *API) PutObject(r io.Reader, bucket, path string, force bool) error

PutObject performs a singlepart upload into an OSS bucket

func (*API) UploadFile

func (a *API) UploadFile(filepath, bucket, path string, force bool) error

UploadFile is a multipart upload, use for larger files

NOTE: this function will return early if an object already exists at the specified path, if it might not be unique provide the force option to skip these checks

func (*API) WaitForImageReady

func (a *API) WaitForImageReady(region_id string, image_id string) error

WaitForImageReady checks that an image in a region is available to be operated on. i.e. when you want to modify attributes of an image

type Options

type Options struct {
	*platform.Options
	// The aliyun region regional api calls should use
	Region string

	// Config file. Defaults to ~/.aliyun/config.json
	ConfigPath string
	// The profile to use when resolving credentials, if applicable
	Profile string

	// AccessKeyID is the optional access key to use. It will override all other sources
	AccessKeyID string
	// SecretKey is the optional secret key to use. It will override all other sources
	SecretKey string
}

Jump to

Keyboard shortcuts

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