credentials

package
v1.6.12 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserHomeDir

func UserHomeDir() string

Types

type ConfigFileProvider

type ConfigFileProvider struct {
	// Path to the ncloud configure file.
	// The default is the current user's home directory.
	// 	Linux/OSX: "$HOME/.ncloud/configure"
	// 	Windows:   "%USERPROFILE%\.ncloud\configure"
	Filename string
	// contains filtered or unexported fields
}

file example: $HOME/.ncloud/configure

func (*ConfigFileProvider) Name

func (p *ConfigFileProvider) Name() string

func (*ConfigFileProvider) Retrieve

func (p *ConfigFileProvider) Retrieve() (Value, error)

type Credentials

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

func LoadCredentials

func LoadCredentials(providers []Provider) *Credentials

func NewValueProviderCreds

func NewValueProviderCreds(accessKey, secretKey string) *Credentials

func (*Credentials) AccessKey

func (c *Credentials) AccessKey() string

func (*Credentials) IsExpired

func (c *Credentials) IsExpired() bool

IsExpired returns if the credentials are expired.

func (*Credentials) ProviderName

func (c *Credentials) ProviderName() string

func (*Credentials) Retrieve

func (c *Credentials) Retrieve() *Credentials

func (*Credentials) SecretKey

func (c *Credentials) SecretKey() string

func (*Credentials) Valid

func (c *Credentials) Valid() bool

type EnvProvider

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

func (*EnvProvider) IsExpired

func (p *EnvProvider) IsExpired() bool

IsExpired returns if the credentials have been retrieved.

func (*EnvProvider) Name

func (p *EnvProvider) Name() string

func (*EnvProvider) Retrieve

func (p *EnvProvider) Retrieve() (Value, error)

Retrieve retrieves the keys from the environment.

type Provider

type Provider interface {
	// Retrieve returns nil if it successfully retrieved the value.
	// Error is returned if the value were not obtainable, or empty.
	Retrieve() (Value, error)
	// Name provider name
	Name() string
}

func DefaultCredentialsChain

func DefaultCredentialsChain() []Provider

type ServerRoleProvider

type ServerRoleProvider struct {
	ApiClient *metadata.ApiClient
}

func (*ServerRoleProvider) Name

func (p *ServerRoleProvider) Name() string

func (*ServerRoleProvider) Retrieve

func (p *ServerRoleProvider) Retrieve() (Value, error)

type Value

type Value struct {
	AccessKey  string
	SecretKey  string
	Expiration time.Time
}

type ValueProvider

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

func NewValueProvider

func NewValueProvider(accessKey, secretKey string) *ValueProvider

func (*ValueProvider) Name

func (p *ValueProvider) Name() string

func (*ValueProvider) Retrieve

func (p *ValueProvider) Retrieve() (Value, error)

Jump to

Keyboard shortcuts

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