Documentation ¶
Index ¶
- Constants
- Variables
- type Error
- type Provider
- func MustNewAPIKey(value ...string) *Provider
- func MustNewBase64(value ...string) *Provider
- func MustNewEnv(value ...string) *Provider
- func MustNewFile(value ...string) *Provider
- func MustNewHmac(value ...string) *Provider
- func NewAPIKey(value ...string) (*Provider, error)
- func NewBase64(value ...string) (*Provider, error)
- func NewEnv(_ ...string) (*Provider, error)
- func NewFile(value ...string) (*Provider, error)
- func NewHmac(value ...string) (*Provider, error)
- func Parse(cfg string) (*Provider, error)
Constants ¶
View Source
const ( // ProtocolHmac will hold access key and secret key credential. // // HMAC means hash-based message authentication code, it may be inaccurate to represent credential // protocol ak/sk(access key + secret key with hmac), but it's simple and no confuse with other // protocol, so just keep this. // // value = [Access Key, Secret Key] ProtocolHmac = "hmac" // ProtocolAPIKey will hold api key credential. // // value = [API Key] ProtocolAPIKey = "apikey" // ProtocolFile will hold file credential. // // value = [File Path], service decide how to use this file ProtocolFile = "file" // ProtocolEnv will represent credential from env. // // value = [], service retrieves credential value from env. ProtocolEnv = "env" // ProtocolBase64 will represents credential binary data in base64 // // Storage service like gcs will take token files as input, we provide base64 protocol so that user // can pass token binary data directly. ProtocolBase64 = "base64" )
Variables ¶
View Source
var ( // ErrUnsupportedProtocol means protocol is unsupported ErrUnsupportedProtocol = errors.New("unsupported protocol") // ErrInvalidValue means value is invalid. ErrInvalidValue = errors.New("invalid value") )
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider will provide credential protocol and values.
func MustNewAPIKey ¶ added in v0.5.0
MustNewAPIKey make sure Provider must be created if no panic happened.
func MustNewBase64 ¶ added in v1.2.0
MustNewBase64 make sure Provider must be created if no panic happened.
func MustNewEnv ¶ added in v0.5.0
MustNewEnv make sure Provider must be created if no panic happened.
func MustNewFile ¶ added in v0.5.0
MustNewFile make sure Provider must be created if no panic happened.
func MustNewHmac ¶ added in v0.5.0
MustNewHmac make sure Provider must be created if no panic happened.
Click to show internal directories.
Click to hide internal directories.