client

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultInternetChargeType = "PayByTraffic"

DefaultInternetChargeType is used for EIP

Variables

This section is empty.

Functions

func ComputeStorageEndpoint

func ComputeStorageEndpoint(region string) string

ComputeStorageEndpoint computes the OSS storage endpoint based on the given region.

Types

type ClientFactory

type ClientFactory interface {
	NewECSClient(ctx context.Context, region, accessKeyID, accessKeySecret string) (ECS, error)
	NewSTSClient(ctx context.Context, region, accessKeyID, accessKeySecret string) (STS, error)
}

ClientFactory is the new factory to instantiate Alicloud clients. TODO: move VPC to this new factory.

func NewClientFactory

func NewClientFactory() ClientFactory

NewClientFactory creates a new clientFactory instance that can be used to instantiate Alicloud clients

type ECS

type ECS interface {
	CheckIfImageExists(ctx context.Context, imageID string) (bool, error)
	ShareImageToAccount(ctx context.Context, regionID, imageID, accountID string) error
}

ECS is an interface which must be implemented by alicloud ecs clients.

type Factory

type Factory interface {
	// NewVPC creates a new VPC client from the given credentials and region.
	NewVPC(region, accessKeyID, accessKeySecret string) (VPC, error)
}

Factory is the factory to instantiate Alicloud clients.

func DefaultFactory

func DefaultFactory() Factory

DefaultFactory instantiates a default Factory.

type FactoryFunc

type FactoryFunc func(region, accessKeyID, accessKeySecret string) (*alicloudvpc.Client, error)

FactoryFunc is a function that implements the Factory interface. Used for consuming the `alicloudvpc.NewClientWithAccessKey` function.

func (FactoryFunc) NewVPC

func (f FactoryFunc) NewVPC(region, accessKeyID, accessKeySecret string) (VPC, error)

NewVPC implements Factory.

type STS

type STS interface {
	GetAccountIDFromCallerIdentity(ctx context.Context) (string, error)
}

STS is an interface which must be implemented by alicloud sts clients.

type Storage

type Storage interface {
	DeleteObjectsWithPrefix(ctx context.Context, bucketName, prefix string) error
	CreateBucketIfNotExists(ctx context.Context, bucketName string) error
	DeleteBucketIfExists(ctx context.Context, bucketName string) error
}

Storage is an interface which must be implemented by alicloud oss storage clients.

func NewStorageClientFromSecretRef

func NewStorageClientFromSecretRef(ctx context.Context, client client.Client, secretRef *corev1.SecretReference, region string) (Storage, error)

NewStorageClientFromSecretRef creates a new Alicloud storage Client using the credentials from <secretRef>.

type VPC

type VPC interface {
	// DescribeVpcs describes the VPCs for the request.
	DescribeVpcs(req *alicloudvpc.DescribeVpcsRequest) (*alicloudvpc.DescribeVpcsResponse, error)
	// DescribeNatGateways describes the NAT gateways for the request.
	DescribeNatGateways(req *alicloudvpc.DescribeNatGatewaysRequest) (*alicloudvpc.DescribeNatGatewaysResponse, error)
	// DescribeEipAddresses describes the EIP addresses for the request.
	DescribeEipAddresses(req *alicloudvpc.DescribeEipAddressesRequest) (*alicloudvpc.DescribeEipAddressesResponse, error)
}

VPC is the interface to the Alicloud VPC service.

Jump to

Keyboard shortcuts

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