service

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultMonitorPeriod = 30 * 60 * 1000
	DefaultSendPeriod    = 120 * 60 * 1000
)
View Source
const (
	DefaultDelayInterval          = 5 * 60 * 1000
	DefaultRandomDisturbanceRange = 10 * 60 * 1000
)

Variables

This section is empty.

Functions

func GenerateCredentialsBySecret

func GenerateCredentialsBySecret(secretData string) (*auth.SecretsManagerPluginCredentials, error)

func GenerateSecretInfoByCredentials

func GenerateSecretInfoByCredentials(securityCredentials *auth.SecretsManagerPluginCredentials, secretName string) (*cmodels.SecretInfo, error)

func ParseTTL

func ParseTTL(secretInfo *cmodels.SecretInfo, defaultRotationInterval int64) int64

Types

type AKExpireHandler

type AKExpireHandler interface {
	// 判断异常是否由AK过期引起
	JudgeAKExpire(err error) bool
}

type CustomerTask

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

func NewCustomerTask

func NewCustomerTask(blockingQueue *models.BlockingQueue) *CustomerTask

func (*CustomerTask) Run

func (st *CustomerTask) Run()

type DefaultPluginCredentialsLoader

type DefaultPluginCredentialsLoader struct {
}

func (*DefaultPluginCredentialsLoader) Load

type DefaultSecretExchange

type DefaultSecretExchange struct {
}

func NewDefaultSecretExchange

func NewDefaultSecretExchange() *DefaultSecretExchange

func (*DefaultSecretExchange) ExchangeSecretName

func (dse *DefaultSecretExchange) ExchangeSecretName(userSecretName string) (string, error)

type DefaultSecretRecoveryStrategy

type DefaultSecretRecoveryStrategy struct {
}

func NewDefaultSecretRecoveryStrategy

func NewDefaultSecretRecoveryStrategy() *DefaultSecretRecoveryStrategy

func (*DefaultSecretRecoveryStrategy) RecoverGetSecret

func (d *DefaultSecretRecoveryStrategy) RecoverGetSecret(secretName string) (*models.SecretInfo, error)

type DefaultSecretsManagerPluginCacheHook

type DefaultSecretsManagerPluginCacheHook struct {
	PluginUpdaterMap map[string][]SecretsManagerPluginCredentialUpdater

	BlockingQueue          *models.BlockingQueue
	SecretRecoveryStrategy SecretRecoveryStrategy
	// contains filtered or unexported fields
}

func NewDefaultSecretsManagerPluginCacheHook

func NewDefaultSecretsManagerPluginCacheHook(blockingQueue *models.BlockingQueue, secretRecoveryStrategy SecretRecoveryStrategy) *DefaultSecretsManagerPluginCacheHook

func (*DefaultSecretsManagerPluginCacheHook) Close

func (*DefaultSecretsManagerPluginCacheHook) CloseSecurityUpdaterAndClientByClient

func (dsmpch *DefaultSecretsManagerPluginCacheHook) CloseSecurityUpdaterAndClientByClient(secretName string, client interface{}) error

func (*DefaultSecretsManagerPluginCacheHook) CloseSecurityUpdaterAndClientByTypeName

func (dsmpch *DefaultSecretsManagerPluginCacheHook) CloseSecurityUpdaterAndClientByTypeName(updaterClasses map[string]struct{}) error

func (*DefaultSecretsManagerPluginCacheHook) Get

func (*DefaultSecretsManagerPluginCacheHook) Init

func (*DefaultSecretsManagerPluginCacheHook) Put

func (*DefaultSecretsManagerPluginCacheHook) RecoveryGetSecret

func (dsmpch *DefaultSecretsManagerPluginCacheHook) RecoveryGetSecret(secretName string) (*cmodels.SecretInfo, error)

func (*DefaultSecretsManagerPluginCacheHook) RegisterSecretsManagerUpdater

func (dsmpch *DefaultSecretsManagerPluginCacheHook) RegisterSecretsManagerUpdater(secretName string, securityUpdater SecretsManagerPluginCredentialUpdater) error

type MonitorCacheSecretStoreStrategy

type MonitorCacheSecretStoreStrategy interface {
	cache.SecretCacheStoreStrategy
	AddRefreshHook(client *secretsmanagerclient.SecretManagerCacheClient)
}

type MonitorMemoryCacheSecretStoreStrategy

type MonitorMemoryCacheSecretStoreStrategy struct {
	BlockingQueue               *models.BlockingQueue
	MonitorPeriodMilliseconds   int64
	MonitorCustomerMilliseconds int64
	// contains filtered or unexported fields
}

func NewMonitorMemoryCacheSecretStoreStrategy

func NewMonitorMemoryCacheSecretStoreStrategy(blockingQueue *models.BlockingQueue, monitorPeriodMilliseconds, monitorCustomerMilliseconds int64) *MonitorMemoryCacheSecretStoreStrategy

func (*MonitorMemoryCacheSecretStoreStrategy) AddRefreshHook

func (*MonitorMemoryCacheSecretStoreStrategy) Close

func (*MonitorMemoryCacheSecretStoreStrategy) GetCacheSecretInfo

func (m *MonitorMemoryCacheSecretStoreStrategy) GetCacheSecretInfo(secretName string) (*cmodels.CacheSecretInfo, error)

func (*MonitorMemoryCacheSecretStoreStrategy) Init

func (*MonitorMemoryCacheSecretStoreStrategy) StoreSecret

func (m *MonitorMemoryCacheSecretStoreStrategy) StoreSecret(cacheSecretInfo *cmodels.CacheSecretInfo) error

type MonitorTask

type MonitorTask struct {
	*MonitorMemoryCacheSecretStoreStrategy
	// contains filtered or unexported fields
}

func NewMonitorTask

func NewMonitorTask(monitorMemoryCacheSecretStoreStrategy *MonitorMemoryCacheSecretStoreStrategy, monitorPeriod int64, blockingQueue *models.BlockingQueue) *MonitorTask

func (*MonitorTask) Run

func (mt *MonitorTask) Run()

type RotateAKSecretRefreshSecretStrategy

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

func NewRotateAKSecretRefreshSecretStrategy

func NewRotateAKSecretRefreshSecretStrategy(rotationInterval, delayInterval int64) *RotateAKSecretRefreshSecretStrategy

func (*RotateAKSecretRefreshSecretStrategy) Close

func (*RotateAKSecretRefreshSecretStrategy) GetNextExecuteTime

func (rrs *RotateAKSecretRefreshSecretStrategy) GetNextExecuteTime(secretName string, ttl, offsetTimestamp int64) int64

func (*RotateAKSecretRefreshSecretStrategy) Init

func (*RotateAKSecretRefreshSecretStrategy) ParseNextExecuteTime

func (rrs *RotateAKSecretRefreshSecretStrategy) ParseNextExecuteTime(cacheSecretInfo *cmodels.CacheSecretInfo) int64

func (*RotateAKSecretRefreshSecretStrategy) ParseTTL

func (rrs *RotateAKSecretRefreshSecretStrategy) ParseTTL(secretInfo *cmodels.SecretInfo) int64

type SecretExchange

type SecretExchange interface {
	ExchangeSecretName(userSecretName string) (string, error)
}

type SecretRecoveryStrategy

type SecretRecoveryStrategy interface {
	RecoverGetSecret(secretName string) (*models.SecretInfo, error)
}

type SecretsManagerPluginCacheHook

type SecretsManagerPluginCacheHook interface {
	cache.SecretCacheHook
	RegisterSecretsManagerUpdater(secretName string, securityUpdater SecretsManagerPluginCredentialUpdater) error
	CloseSecurityUpdaterAndClientByClient(secretName string, client interface{}) error
	CloseSecurityUpdaterAndClientByTypeName(updaterClasses map[string]struct{}) error
}

type SecretsManagerPluginCredentialUpdater

type SecretsManagerPluginCredentialUpdater interface {
	// 获取云产品Client
	GetClient() interface{}

	// 更新TmpAK信息
	UpdateCredential(secretInfo *cmodels.SecretInfo) error

	// 获取类型名称
	GetTypeName() string

	// 关闭,释放资源
	Close() error
}

type SecretsManagerPluginCredentialsLoader

type SecretsManagerPluginCredentialsLoader interface {
	Load() (*SecretsManagerPluginCredentialsProvider, error)
}

type SecretsManagerPluginCredentialsProvider

type SecretsManagerPluginCredentialsProvider struct {
	Credentials              auth.Credential
	RegionInfos              []*cmodels.RegionInfo
	SecretNames              []string
	SecretExchange           SecretExchange
	CacheSecretStoreStrategy MonitorCacheSecretStoreStrategy
	CacheHook                SecretsManagerPluginCacheHook
	BackOffStrategy          cservice.BackoffStrategy
	RefreshSecretStrategy    cservice.RefreshSecretStrategy
}

func NewSecretsManagerPluginCredentialsProvider

func NewSecretsManagerPluginCredentialsProvider(credentials auth.Credential, regionInfos []*cmodels.RegionInfo, secretNames []string, secretExchange SecretExchange, cacheSecretStoreStrategy MonitorCacheSecretStoreStrategy, cacheHook SecretsManagerPluginCacheHook, backOffStrategy cservice.BackoffStrategy, refreshSecretStrategy cservice.RefreshSecretStrategy) *SecretsManagerPluginCredentialsProvider

Jump to

Keyboard shortcuts

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