util

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrGetProviderConfig is the error of getting provider config
	ErrGetProviderConfig = "failed to get ProviderConfig"
	// ErrGetCredentials is the error of getting credentials
	ErrGetCredentials = "cannot get credentials"

	// ErrAccessKeyNotComplete is the error of not existing of AccessKeyID or AccessKeySecret
	ErrAccessKeyNotComplete = "AccessKeyID or AccessKeySecret not existed"
)
View Source
const (
	// ErrPrepareClientEstablishmentInfo is the error of failing to prepare all the information for establishing an SDK client
	ErrPrepareClientEstablishmentInfo string = "failed to prepare all the information for establishing an SDK client"
)

Variables

View Source
var Domain = "aliyuncs.com"

Domain is Alibaba Cloud Domain

Functions

func GetEndpoint

func GetEndpoint(res runtime.Object, region string) (string, error)

GetEndpoint gets endpoints for all cloud resources

func GetProviderConfig

func GetProviderConfig(ctx context.Context, k8sClient client.Client, providerConfigName string) (*aliv1beta1.ProviderConfig, error)

GetProviderConfig gets ProviderConfig

func GetRegion

func GetRegion(ctx context.Context, client client.Client, providerConfigName string) (string, error)

GetRegion gets regions from ProviderConfig

Types

type AlibabaCredentials

type AlibabaCredentials struct {
	AccessKeyID     string `yaml:"accessKeyId"`
	AccessKeySecret string `yaml:"accessKeySecret"`
	SecurityToken   string `yaml:"securityToken"`
}

AlibabaCredentials represents ak/sk, stsToken(maybe) information

func GetCredentials

func GetCredentials(ctx context.Context, client client.Client, providerConfigName string) (*AlibabaCredentials, error)

GetCredentials gets Alibaba credentials from ProviderConfig

type ClientEstablishmentInfo

type ClientEstablishmentInfo struct {
	AlibabaCredentials `json:",inline"`
	Region             string `json:"region"`
	Endpoint           string `json:"endpoint"`
}

ClientEstablishmentInfo represents all the information for establishing an SDK client

func PrepareClient

func PrepareClient(ctx context.Context, mg resource.Managed, res runtime.Object, c client.Client, usage resource.Tracker, providerConfigName string) (*ClientEstablishmentInfo, error)

PrepareClient will prepare all information to establish an Alibaba Cloud resource SDK client

Jump to

Keyboard shortcuts

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