Documentation ¶
Index ¶
- Constants
- func CredentialsWithAccessKey(accessKeyId, accessKeySecret string) auth.Credential
- func CredentialsWithEcsRamRole(roleName string) auth.Credential
- func CredentialsWithRamRoleArnOrSts(accessKeyId, accessKeySecret, roleSessionName, roleArn, policy string) auth.Credential
- func CredentialsWithToken(tokenId, token string) auth.Credential
- func DecryptAes256Cbc(data, secret, iv, salt []byte) (string, error)
- func EncryptAes256Cbc(data, secret, iv, salt []byte) ([]byte, error)
- func FileDelete(filePath, fileName string) error
- func FileExist(_path string) (bool, error)
- func FileExists(filePath, fileName string) bool
- func GetEndpoint(regionId string) string
- func GetPassword(configMap map[string]string, envVariableName string, filePathName string) (string, error)
- func GetVpcEndpoint(regionId string) string
- func JudgeNeedBackoff(err error) bool
- func JudgeNeedRecoveryException(err error) bool
- func LoadCredentialsProperties(fileName string) (*models.CredentialsProperties, error)
- func LoadProperties(fileName string) (map[string]string, error)
- func LoadRsaKeyPairCredentialAndClientKeySigner(clientKeyPath, password string) (*credentials.RsaKeyPairCredential, *auth.ClientKeySigner, error)
- func ParseBool(obj interface{}) (bool, error)
- func ParseString(obj interface{}) (string, error)
- func Ping(host string) float64
- func ReadJsonObject(filePath, fileName string, out interface{}) error
- func ReadPasswordFile(passwordFilePath string) (string, error)
- func TransferErrorToClientError(err error) error
- func WriteJsonObject(filePath, fileName string, in interface{}) error
Constants ¶
View Source
const ( IterationCount = 1000 KeyLength = 32 Aes256CbcModeKey = "001" )
View Source
const ( // KMS限流返回错误码 RejectedThrottling = "Rejected.Throttling" ServiceUnavailableTemporary = "ServiceUnavailableTemporary" // KMS服务内部错误返回错误码 InternalFailure = "InternalFailure" )
View Source
const ( // 凭据当前stage StageAcsCurrent = "ACSCurrent" // 随机IV字节长度 IvLength = 16 // 随机密钥字节长度 RandomKeyLength = 32 // 默认最大重试次数 DefaultRetryMaxAttempts = 5 // 默认重试间隔时间 DefaultRetryInitialIntervalMills = 2000 // 默认最大等待时间 DefaultCapacity = 10000 // 环境变量cache_client_region_id key EnvCacheClientRegionIdKey = "cache_client_region_id" // 环境变量credentials_type key EnvCredentialsTypeKey = "credentials_type" // 环境变量credentials_access_key_id key EnvCredentialsAccessKeyIdKey = "credentials_access_key_id" // 环境变量credentials_access_secret key EnvCredentialsAccessSecretKey = "credentials_access_secret" // 环境变量credentials_access_token_id key EnvCredentialsAccessTokenIdKey = "credentials_access_token_id" // 环境变量credentials_access_token key EnvCredentialsAccessTokenKey = "credentials_access_token" // 环境变量credentials_role_session_name key EnvCredentialsRoleSessionNameKey = "credentials_role_session_name" // 环境变量credentials_role_arn key EnvCredentialsRoleArnKey = "credentials_role_arn" // 环境变量credentials_policy key EnvCredentialsPolicyKey = "credentials_policy" // 环境变量credentials_role_name key EnvCredentialsRoleNameKey = "credentials_role_name" // 欠费errorCode ErrorCodeForbiddenInDebtOverDue = "Forbidden.InDebtOverdue" // 欠费errorCode ErrorCodeForbiddenInDebt = "Forbidden.InDebt" // 模块名称 ModeName = "CacheClient" // 凭据文本数据类型 TextDataType = "text" // 凭据二进制数据类型 BinaryDataType = "binary" // 项目版本 ProjectVersion = "1.1.5" // the user agent of secrets manager golang UserAgentOfSecretsManagerGolang = "aliyun-secretsmanager-client-go" // 环境变量region中endPoint key EnvRegionEndpointNameKey = "endpoint" // 环境变量region中regionId key EnvRegionRegionIdNameKey = "regionId" // 环境变量region中regionId key EnvRegionVpcNameKey = "vpc" // KMS服务Socket连接超时错误码 SdkReadTimeout = "SDK.ReadTimeout" SdkTimeoutError = "SDK.TimeoutError" // KMS服务无法连接错误码 SdkServerUnreachable = "SDK.ServerUnreachable" //环境变量client_key_password key EnvClientKeyPasswordNameKey = "client_key_password" // 环境变量credentials_client_key_private_key_path key EnvClientKeyPrivateKeyPathNameKey = "client_key_private_key_path" // 环境变量 client_key_password_from_env_variable key EnvClientKeyPasswordFromEnvVariableNameKey = "client_key_password_from_env_variable" // 配置文件 client_key_password_from_file_path key PropertiesClientKeyPasswordFromFilePathName = "client_key_password_from_file_path" // 默认的 credentials配置文件 DefaultConfigName = "secretsmanager.properties" // 配置文件 secret_names key PropertiesSecretNamesKey = "secret_names" // 环境变量cache_client_dkms_config_info key CacheClientDkmsConfigInfoKey = "cache_client_dkms_config_info" // 环境变量 ignoreSSLCerts key ENV_IGNORE_SSL_CERTS_KEY = "ignoreSSLCerts" // 虚假的AKSK PretendAk = "PRETEND_AK" PretendSk = "PRETEND_SK" // KMS类型 DkmsType = 1 KmsType = 0 )
Variables ¶
This section is empty.
Functions ¶
func CredentialsWithAccessKey ¶
func CredentialsWithAccessKey(accessKeyId, accessKeySecret string) auth.Credential
func CredentialsWithEcsRamRole ¶
func CredentialsWithEcsRamRole(roleName string) auth.Credential
func CredentialsWithRamRoleArnOrSts ¶
func CredentialsWithRamRoleArnOrSts(accessKeyId, accessKeySecret, roleSessionName, roleArn, policy string) auth.Credential
func CredentialsWithToken ¶
func CredentialsWithToken(tokenId, token string) auth.Credential
func DecryptAes256Cbc ¶
DecryptAes256Cbc 解密data, 使用aes256-cbc算法,填充方式为pkcs5, aes密钥通过pbkdf2-hmac-sha256算法派生
func EncryptAes256Cbc ¶
EncryptAes256Cbc 加密data,使用aes256-cbc算法,填充方式为pkcs5, aes密钥通过pbkdf2-hmac-sha256算法派生
func FileDelete ¶
func FileExists ¶
func GetEndpoint ¶
func GetPassword ¶ added in v1.0.1
func GetVpcEndpoint ¶
func JudgeNeedRecoveryException ¶
根据Client异常判断是否进行容灾重试
func LoadCredentialsProperties ¶ added in v1.0.1
func LoadCredentialsProperties(fileName string) (*models.CredentialsProperties, error)
func LoadProperties ¶ added in v1.0.1
func LoadRsaKeyPairCredentialAndClientKeySigner ¶ added in v1.0.1
func LoadRsaKeyPairCredentialAndClientKeySigner(clientKeyPath, password string) (*credentials.RsaKeyPairCredential, *auth.ClientKeySigner, error)
func ParseString ¶
func ReadJsonObject ¶
func ReadPasswordFile ¶ added in v1.1.1
func TransferErrorToClientError ¶ added in v1.1.0
func WriteJsonObject ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.