base

package
v0.0.0-...-a1c3796 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubernetesCloudControllerManager = "ack.ccm"
	AgentClusterId                   = "ClusterId"
	TokenSyncPeriod                  = 10 * time.Minute

	AccessKeyID     = "ACCESS_KEY_ID"
	AccessKeySecret = "ACCESS_KEY_SECRET"
)
View Source
const (
	ENDPOINT = "http://100.100.100.200"

	META_VERSION_LATEST = "latest"

	RS_TYPE_META_DATA = "meta-data"
	RS_TYPE_USER_DATA = "user-data"

	DNS_NAMESERVERS    = "dns-conf/nameservers"
	EIPV4              = "eipv4"
	HOSTNAME           = "hostname"
	IMAGE_ID           = "image-id"
	INSTANCE_ID        = "instance-id"
	MAC                = "mac"
	NETWORK_TYPE       = "network-type"
	NTP_CONF_SERVERS   = "ntp-conf/ntp-servers"
	OWNER_ACCOUNT_ID   = "owner-account-id"
	PRIVATE_IPV4       = "private-ipv4"
	REGION             = "region-id"
	SERIAL_NUMBER      = "serial-number"
	SOURCE_ADDRESS     = "source-address"
	VPC_CIDR_BLOCK     = "vpc-cidr-block"
	VPC_ID             = "vpc-id"
	VSWITCH_CIDR_BLOCK = "vswitch-cidr-block"
	VSWITCH_ID         = "vswitch-id"
	ZONE               = "zone-id"
	RAM_SECURITY       = "ram/security-credentials"
)
View Source
const (
	AddonTokenFilePath = "/var/addon/token-config"
)

Variables

View Source
var CLUSTER_ID = "clusterid"

Functions

func Decrypt

func Decrypt(s string, keyring []byte) ([]byte, error)

func LoadAK

func LoadAK() (string, string, error)

func NewMetaData

func NewMetaData() prvd.IMetaData

NewMetaData return new metadata

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func RefreshToken

func RefreshToken(mgr *ClientMgr, token *DefaultToken) error

Types

type AddonToken

type AddonToken struct {
	Region string `json:"region,omitempty"`
}

func (*AddonToken) NextToken

func (f *AddonToken) NextToken() (*DefaultToken, error)

type AkAuthToken

type AkAuthToken struct {
	Region string
}

AkAuthToken implement ak auth

func (*AkAuthToken) NextToken

func (f *AkAuthToken) NextToken() (*DefaultToken, error)

type BaseMetaData

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

func NewBaseMetaData

func NewBaseMetaData(client *http.Client) *BaseMetaData

func (*BaseMetaData) ClusterID

func (m *BaseMetaData) ClusterID() string

func (*BaseMetaData) DNSNameServers

func (m *BaseMetaData) DNSNameServers() ([]string, error)

func (*BaseMetaData) EIPv4

func (m *BaseMetaData) EIPv4() (string, error)

func (*BaseMetaData) HostName

func (m *BaseMetaData) HostName() (string, error)

func (*BaseMetaData) ImageID

func (m *BaseMetaData) ImageID() (string, error)

func (*BaseMetaData) InstanceID

func (m *BaseMetaData) InstanceID() (string, error)

func (*BaseMetaData) Mac

func (m *BaseMetaData) Mac() (string, error)

func (*BaseMetaData) NTPConfigServers

func (m *BaseMetaData) NTPConfigServers() ([]string, error)

func (*BaseMetaData) NetworkType

func (m *BaseMetaData) NetworkType() (string, error)

func (*BaseMetaData) New

func (m *BaseMetaData) New() *MetaDataRequest

func (*BaseMetaData) OwnerAccountID

func (m *BaseMetaData) OwnerAccountID() (string, error)

func (*BaseMetaData) PrivateIPv4

func (m *BaseMetaData) PrivateIPv4() (string, error)

func (*BaseMetaData) RamRoleToken

func (m *BaseMetaData) RamRoleToken(role string) (prvd.RoleAuth, error)

func (*BaseMetaData) Region

func (m *BaseMetaData) Region() (string, error)

func (*BaseMetaData) RoleName

func (m *BaseMetaData) RoleName() (string, error)

func (*BaseMetaData) SerialNumber

func (m *BaseMetaData) SerialNumber() (string, error)

func (*BaseMetaData) SourceAddress

func (m *BaseMetaData) SourceAddress() (string, error)

func (*BaseMetaData) VpcCIDRBlock

func (m *BaseMetaData) VpcCIDRBlock() (string, error)

func (*BaseMetaData) VpcID

func (m *BaseMetaData) VpcID() (string, error)

func (*BaseMetaData) VswitchCIDRBlock

func (m *BaseMetaData) VswitchCIDRBlock() (string, error)

func (*BaseMetaData) VswitchID

func (m *BaseMetaData) VswitchID() (string, error)

func (*BaseMetaData) Zone

func (m *BaseMetaData) Zone() (string, error)

type CfgMetaData

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

func (*CfgMetaData) ClusterID

func (m *CfgMetaData) ClusterID() string

func (*CfgMetaData) DNSNameServers

func (m *CfgMetaData) DNSNameServers() ([]string, error)

func (*CfgMetaData) EIPv4

func (m *CfgMetaData) EIPv4() (string, error)

func (*CfgMetaData) HostName

func (m *CfgMetaData) HostName() (string, error)

func (*CfgMetaData) ImageID

func (m *CfgMetaData) ImageID() (string, error)

func (*CfgMetaData) InstanceID

func (m *CfgMetaData) InstanceID() (string, error)

func (*CfgMetaData) Mac

func (m *CfgMetaData) Mac() (string, error)

func (*CfgMetaData) NTPConfigServers

func (m *CfgMetaData) NTPConfigServers() ([]string, error)

func (*CfgMetaData) NetworkType

func (m *CfgMetaData) NetworkType() (string, error)

func (*CfgMetaData) OwnerAccountID

func (m *CfgMetaData) OwnerAccountID() (string, error)

func (*CfgMetaData) PrivateIPv4

func (m *CfgMetaData) PrivateIPv4() (string, error)

func (*CfgMetaData) RamRoleToken

func (m *CfgMetaData) RamRoleToken(role string) (prvd.RoleAuth, error)

func (*CfgMetaData) Region

func (m *CfgMetaData) Region() (string, error)

func (*CfgMetaData) RoleName

func (m *CfgMetaData) RoleName() (string, error)

func (*CfgMetaData) SerialNumber

func (m *CfgMetaData) SerialNumber() (string, error)

func (*CfgMetaData) SourceAddress

func (m *CfgMetaData) SourceAddress() (string, error)

func (*CfgMetaData) VpcCIDRBlock

func (m *CfgMetaData) VpcCIDRBlock() (string, error)

func (*CfgMetaData) VpcID

func (m *CfgMetaData) VpcID() (string, error)

func (*CfgMetaData) VswitchCIDRBlock

func (m *CfgMetaData) VswitchCIDRBlock() (string, error)

func (*CfgMetaData) VswitchID

func (m *CfgMetaData) VswitchID() (string, error)

zone1:vswitchid1,zone2:vswitch2

func (*CfgMetaData) Zone

func (m *CfgMetaData) Zone() (string, error)

type ClientMgr

type ClientMgr struct {
	Region string

	Meta prvd.IMetaData
	ECS  *ecs.Client
	VPC  *vpc.Client
	SLB  *slb.Client
	PVTZ *pvtz.Client
	ALB  *alb.Client
	NLB  *nlb.Client
	SLS  *sls.Client
	CAS  *cas.Client
	ESS  *ess.Client
	// contains filtered or unexported fields
}

ClientMgr client manager for aliyun sdk

func NewClientMgr

func NewClientMgr() (*ClientMgr, error)

NewClientMgr return a new client manager

func (*ClientMgr) GetTokenAuth

func (mgr *ClientMgr) GetTokenAuth() TokenAuth

func (*ClientMgr) Start

func (mgr *ClientMgr) Start(
	settoken func(mgr *ClientMgr, token *DefaultToken) error,
) error

type DefaultToken

type DefaultToken struct {
	Region          string
	AccessKeyId     string
	AccessKeySecret string
	SecurityToken   string
}

type IMetaDataRequest

type IMetaDataRequest interface {
	Version(version string) IMetaDataRequest
	ResourceType(rtype string) IMetaDataRequest
	Resource(resource string) IMetaDataRequest
	SubResource(sub string) IMetaDataRequest
	Url() (string, error)
	Do(api interface{}) error
}

type MetaDataRequest

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

func (*MetaDataRequest) Decode

func (vpc *MetaDataRequest) Decode(data string, api interface{}) error

func (*MetaDataRequest) Do

func (vpc *MetaDataRequest) Do(api interface{}) (err error)

func (*MetaDataRequest) Resource

func (vpc *MetaDataRequest) Resource(resource string) IMetaDataRequest

func (*MetaDataRequest) ResourceType

func (vpc *MetaDataRequest) ResourceType(rtype string) IMetaDataRequest

func (*MetaDataRequest) SubResource

func (vpc *MetaDataRequest) SubResource(sub string) IMetaDataRequest

func (*MetaDataRequest) Url

func (vpc *MetaDataRequest) Url() (string, error)

func (*MetaDataRequest) Version

func (vpc *MetaDataRequest) Version(version string) IMetaDataRequest

type RamRoleToken

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

func (*RamRoleToken) NextToken

func (f *RamRoleToken) NextToken() (*DefaultToken, error)

type ResultList

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

type ServiceToken

type ServiceToken struct {
	Region   string
	ExecPath string
}

ServiceToken is an implementation of service account auth

func (*ServiceToken) NextToken

func (f *ServiceToken) NextToken() (*DefaultToken, error)

type TimeoutError

type TimeoutError interface {
	error
	Timeout() bool // Is the error a timeout?
}

type TokenAuth

type TokenAuth interface {
	NextToken() (*DefaultToken, error)
}

TokenAuth is an interface of Token auth method

Jump to

Keyboard shortcuts

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