cloud

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedCloudProvider   = fmt.Errorf("unsupported provider, only support %s, %s and %s", AWSProvider, TencentCloudProvider, StandaloneRedisProvider)
	ErrProviderNotTencentCloud    = errors.New("provider is not tencentcloud")
	ErrProviderNotAWS             = errors.New("provider is not aws")
	ErrProviderNotStandaloneRedis = errors.New("provider is not standalone redis")
	ErrProviderNotClusterRedis    = errors.New("provider is not cluster redis")
	ErrEmptySecretID              = errors.New("secret_id is empty")
	ErrEmptySecretKey             = errors.New("secret_key is empty")
	ErrEmptyRegion                = errors.New("region is empty")
)

Functions

func AwsNewSession added in v1.1.3

func AwsNewSession(option Option) (*session.Session, *aws.Config, error)

AwsNewSession

Types

type CommonOption

type CommonOption struct {
	Provider      Provider
	SecretID      string
	SecretKey     string
	AssumeRoleArn string
	Region        string
	AssumeRegion  string
}

func (CommonOption) CheckAWS

func (option CommonOption) CheckAWS() error

func (CommonOption) CheckClusterRedis added in v1.2.0

func (option CommonOption) CheckClusterRedis() error

func (CommonOption) CheckStandaloneRedis added in v1.2.0

func (option CommonOption) CheckStandaloneRedis() error

func (CommonOption) CheckTencentCloud

func (option CommonOption) CheckTencentCloud() error

func (CommonOption) GetAssumeRegion added in v1.1.3

func (option CommonOption) GetAssumeRegion() string

GetAssumeRegion 多数情况 region 和 assume region 是同一个region,全球区可能出现不一致的场景

func (CommonOption) GetAssumeRoleArn added in v1.1.3

func (option CommonOption) GetAssumeRoleArn() string

func (CommonOption) GetProvider

func (option CommonOption) GetProvider() Provider

func (CommonOption) GetRegion

func (option CommonOption) GetRegion() string

func (CommonOption) GetSecretID

func (option CommonOption) GetSecretID() string

func (CommonOption) GetSecretKey

func (option CommonOption) GetSecretKey() string

type Option

type Option interface {
	GetProvider() Provider
	GetSecretID() string
	GetSecretKey() string
	GetAssumeRoleArn() string
	GetRegion() string
	GetAssumeRegion() string
	CheckAWS() error
	CheckTencentCloud() error
	CheckStandaloneRedis() error
	CheckClusterRedis() error
}

type Provider

type Provider string
const (
	AWSProvider             Provider = "aws"
	TencentCloudProvider    Provider = "tencentcloud"
	StandaloneRedisProvider Provider = "standalone_redis"
	ClusterRedisProvider    Provider = "cluster_redis"
)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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