Documentation ¶
Overview ¶
Package credentials is a generated GoMock package.
Package credentials is a generated GoMock package.
Index ¶
- type AWSS3Source
- type AWSSecretsManagerSource
- type AmazonWebServicesCredentials
- type Base
- func (credBase *Base) BaseToString() string
- func (credBase *Base) BaseValidate() error
- func (credBase *Base) GetDescriptionOrID() string
- func (credBase *Base) GetID() string
- func (credBase *Base) GetTargetID() string
- func (credBase *Base) ShouldSync(targetName string, targetTags map[string]string) bool
- type Credentials
- type GithubAppCredentials
- type LocalSource
- type MockCredentials
- func (m *MockCredentials) BaseValidate() error
- func (m *MockCredentials) EXPECT() *MockCredentialsMockRecorder
- func (m *MockCredentials) GetID() string
- func (m *MockCredentials) GetTargetID() string
- func (m *MockCredentials) ShouldSync(targetName string, targetTags map[string]string) bool
- func (m *MockCredentials) ToString(arg0 bool) string
- func (m *MockCredentials) Validate() error
- type MockCredentialsMockRecorder
- func (mr *MockCredentialsMockRecorder) BaseValidate() *gomock.Call
- func (mr *MockCredentialsMockRecorder) GetID() *gomock.Call
- func (mr *MockCredentialsMockRecorder) GetTargetID() *gomock.Call
- func (mr *MockCredentialsMockRecorder) ShouldSync(targetName, targetTags interface{}) *gomock.Call
- func (mr *MockCredentialsMockRecorder) ToString(arg0 interface{}) *gomock.Call
- func (mr *MockCredentialsMockRecorder) Validate() *gomock.Call
- type MockSource
- type MockSourceCollection
- type MockSourceCollectionMockRecorder
- type MockSourceMockRecorder
- type SSHCredentials
- type SecretTextCredentials
- type Source
- type SourceCollection
- type SourcesConfiguration
- type UsernamePasswordCredentials
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSS3Source ¶
AWSS3Source represents s3 objects containing credentials
func (*AWSS3Source) Credentials ¶
func (source *AWSS3Source) Credentials() ([]Credentials, error)
Credentials extracts credentials from the source
func (*AWSS3Source) Type ¶
func (source *AWSS3Source) Type() string
Type returns the type of the source
func (*AWSS3Source) ValidateConfiguration ¶
func (source *AWSS3Source) ValidateConfiguration() error
ValidateConfiguration verifies that the source's attributes are valid
type AWSSecretsManagerSource ¶
type AWSSecretsManagerSource struct { SecretPrefix string `mapstructure:"secret_prefix"` SecretID string `mapstructure:"secret_id"` // contains filtered or unexported fields }
AWSSecretsManagerSource represents AWS SecretsManager secrets containing credentials
func (*AWSSecretsManagerSource) Credentials ¶
func (source *AWSSecretsManagerSource) Credentials() ([]Credentials, error)
Credentials extracts credentials from the source
func (*AWSSecretsManagerSource) Type ¶
func (source *AWSSecretsManagerSource) Type() string
Type returns the type of the source
func (*AWSSecretsManagerSource) ValidateConfiguration ¶
func (source *AWSSecretsManagerSource) ValidateConfiguration() error
ValidateConfiguration verifies that the source's attributes are valid
type AmazonWebServicesCredentials ¶
type AmazonWebServicesCredentials struct { Base `mapstructure:",squash"` AccessKey string `mapstructure:"access_key"` SecretKey string `mapstructure:"secret_key"` RoleARN string `mapstructure:"role_arn"` MFASerialNumber string `mapstructure:"mfa_serial"` }
AmazonWebServicesCredentials represents an access key id and a secret access key from AWS. A role to assume can also be defined
func NewAmazonWebServicesCredentials ¶
func NewAmazonWebServicesCredentials() *AmazonWebServicesCredentials
NewAmazonWebServicesCredentials instantiates an AmazonWebServicesCredentials struct
func (*AmazonWebServicesCredentials) ToString ¶
func (cred *AmazonWebServicesCredentials) ToString(showSensitive bool) string
ToString prints out the content of a AmazonWebServicesCredentials struct. If showSensitive is true, the secret access key will be shown
func (*AmazonWebServicesCredentials) Validate ¶
func (cred *AmazonWebServicesCredentials) Validate() error
Validate verifies that the credentials is valid. A AmazonWebServicesCredentials must define an access key and a secret access key
type Base ¶
type Base struct { ID string Description string NoSync bool `mapstructure:"no_sync"` TargetName string `mapstructure:"target"` TargetTags targetTagsMatcher `mapstructure:"target_tags"` TargetID string `mapstructure:"target_id"` // Field set by constructor CredType string // For multi-value fields. Such as SSM Value string }
Base defines that fields that are common to all types of credentials
func (*Base) BaseToString ¶
BaseToString prints out the credentials fields common to all types of credentials
func (*Base) BaseValidate ¶
BaseValidate verifies that the credentials fields common to all types of credentials contain valid values
func (*Base) GetDescriptionOrID ¶
GetDescriptionOrID returns the description if it set, otherwise it returns the ID
func (*Base) GetTargetID ¶ added in v0.4.0
GetTargetID returns a credentials' Target ID (Essentially, the name that the credentials should have on a target) This is helpful to have different credentials with the same target ID (on different targets)
func (*Base) ShouldSync ¶
ShouldSync returns, given a target's name and tags, if a credentials should be synced to that target This is based on various credentials attributes such as the TargetTags DoMatch and DontMatch attributes
type Credentials ¶
type Credentials interface { BaseValidate() error GetID() string GetTargetID() string ShouldSync(targetName string, targetTags map[string]string) bool ToString(bool) string Validate() error }
Credentials defines the methods that can be called by all types of credentials
func ParseCredentials ¶
func ParseCredentials(credentialsMaps []map[string]interface{}) ([]Credentials, error)
ParseCredentials transforms a list of maps into a list of Credentials The credentials type is determined by the `type` attribute
func ParseSingleCredentials ¶
func ParseSingleCredentials(credentialsMap map[string]interface{}) (Credentials, error)
ParseSingleCredentials transforms a map into a Credentials struct The credentials type is determined by the `type` attribute
type GithubAppCredentials ¶ added in v0.5.0
type GithubAppCredentials struct { Base `mapstructure:",squash"` AppID int `mapstructure:"app_id"` PrivateKey string `mapstructure:"private_key"` Owner string `mapstructure:"owner"` }
GithubAppCredentials represents credentials composed of an App ID, private key, and owner
func NewGithubAppCredentials ¶ added in v0.5.0
func NewGithubAppCredentials() *GithubAppCredentials
NewGithubAppCredentials instantiates a GithubAppCredentials struct
func (*GithubAppCredentials) ToString ¶ added in v0.5.0
func (cred *GithubAppCredentials) ToString(showSensitive bool) string
ToString prints out the content of a GithubAppCredentials struct.
func (*GithubAppCredentials) Validate ¶ added in v0.5.0
func (cred *GithubAppCredentials) Validate() error
Validate verifies that the credentials is valid. A GithubAppCredentials must have an app id and a private key. Owner is optional.
type LocalSource ¶
type LocalSource struct {
File string
}
LocalSource represents local files containing credentials
func (*LocalSource) Credentials ¶
func (source *LocalSource) Credentials() ([]Credentials, error)
Credentials extracts credentials from the source
func (*LocalSource) Type ¶
func (source *LocalSource) Type() string
Type returns the type of the source
func (*LocalSource) ValidateConfiguration ¶
func (source *LocalSource) ValidateConfiguration() error
ValidateConfiguration verifies that the source's attributes are valid
type MockCredentials ¶ added in v0.2.0
type MockCredentials struct {
// contains filtered or unexported fields
}
MockCredentials is a mock of Credentials interface
func NewMockCredentials ¶ added in v0.2.0
func NewMockCredentials(ctrl *gomock.Controller) *MockCredentials
NewMockCredentials creates a new mock instance
func (*MockCredentials) BaseValidate ¶ added in v0.2.0
func (m *MockCredentials) BaseValidate() error
BaseValidate mocks base method
func (*MockCredentials) EXPECT ¶ added in v0.2.0
func (m *MockCredentials) EXPECT() *MockCredentialsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockCredentials) GetID ¶ added in v0.2.0
func (m *MockCredentials) GetID() string
GetID mocks base method
func (*MockCredentials) GetTargetID ¶ added in v0.4.0
func (m *MockCredentials) GetTargetID() string
GetTargetID mocks base method
func (*MockCredentials) ShouldSync ¶ added in v0.2.0
func (m *MockCredentials) ShouldSync(targetName string, targetTags map[string]string) bool
ShouldSync mocks base method
func (*MockCredentials) ToString ¶ added in v0.2.0
func (m *MockCredentials) ToString(arg0 bool) string
ToString mocks base method
func (*MockCredentials) Validate ¶ added in v0.2.0
func (m *MockCredentials) Validate() error
Validate mocks base method
type MockCredentialsMockRecorder ¶ added in v0.2.0
type MockCredentialsMockRecorder struct {
// contains filtered or unexported fields
}
MockCredentialsMockRecorder is the mock recorder for MockCredentials
func (*MockCredentialsMockRecorder) BaseValidate ¶ added in v0.2.0
func (mr *MockCredentialsMockRecorder) BaseValidate() *gomock.Call
BaseValidate indicates an expected call of BaseValidate
func (*MockCredentialsMockRecorder) GetID ¶ added in v0.2.0
func (mr *MockCredentialsMockRecorder) GetID() *gomock.Call
GetID indicates an expected call of GetID
func (*MockCredentialsMockRecorder) GetTargetID ¶ added in v0.4.0
func (mr *MockCredentialsMockRecorder) GetTargetID() *gomock.Call
GetTargetID indicates an expected call of GetTargetID
func (*MockCredentialsMockRecorder) ShouldSync ¶ added in v0.2.0
func (mr *MockCredentialsMockRecorder) ShouldSync(targetName, targetTags interface{}) *gomock.Call
ShouldSync indicates an expected call of ShouldSync
func (*MockCredentialsMockRecorder) ToString ¶ added in v0.2.0
func (mr *MockCredentialsMockRecorder) ToString(arg0 interface{}) *gomock.Call
ToString indicates an expected call of ToString
func (*MockCredentialsMockRecorder) Validate ¶ added in v0.2.0
func (mr *MockCredentialsMockRecorder) Validate() *gomock.Call
Validate indicates an expected call of Validate
type MockSource ¶ added in v0.2.0
type MockSource struct {
// contains filtered or unexported fields
}
MockSource is a mock of Source interface
func NewMockSource ¶ added in v0.2.0
func NewMockSource(ctrl *gomock.Controller) *MockSource
NewMockSource creates a new mock instance
func (*MockSource) Credentials ¶ added in v0.2.0
func (m *MockSource) Credentials() ([]Credentials, error)
Credentials mocks base method
func (*MockSource) EXPECT ¶ added in v0.2.0
func (m *MockSource) EXPECT() *MockSourceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockSource) ValidateConfiguration ¶ added in v0.2.0
func (m *MockSource) ValidateConfiguration() error
ValidateConfiguration mocks base method
type MockSourceCollection ¶ added in v0.2.0
type MockSourceCollection struct {
// contains filtered or unexported fields
}
MockSourceCollection is a mock of SourceCollection interface
func NewMockSourceCollection ¶ added in v0.2.0
func NewMockSourceCollection(ctrl *gomock.Controller) *MockSourceCollection
NewMockSourceCollection creates a new mock instance
func (*MockSourceCollection) AllSources ¶ added in v0.2.0
func (m *MockSourceCollection) AllSources() []Source
AllSources mocks base method
func (*MockSourceCollection) Credentials ¶ added in v0.2.0
func (m *MockSourceCollection) Credentials() ([]Credentials, error)
Credentials mocks base method
func (*MockSourceCollection) EXPECT ¶ added in v0.2.0
func (m *MockSourceCollection) EXPECT() *MockSourceCollectionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockSourceCollection) ValidateConfiguration ¶ added in v0.2.0
func (m *MockSourceCollection) ValidateConfiguration() error
ValidateConfiguration mocks base method
type MockSourceCollectionMockRecorder ¶ added in v0.2.0
type MockSourceCollectionMockRecorder struct {
// contains filtered or unexported fields
}
MockSourceCollectionMockRecorder is the mock recorder for MockSourceCollection
func (*MockSourceCollectionMockRecorder) AllSources ¶ added in v0.2.0
func (mr *MockSourceCollectionMockRecorder) AllSources() *gomock.Call
AllSources indicates an expected call of AllSources
func (*MockSourceCollectionMockRecorder) Credentials ¶ added in v0.2.0
func (mr *MockSourceCollectionMockRecorder) Credentials() *gomock.Call
Credentials indicates an expected call of Credentials
func (*MockSourceCollectionMockRecorder) ValidateConfiguration ¶ added in v0.2.0
func (mr *MockSourceCollectionMockRecorder) ValidateConfiguration() *gomock.Call
ValidateConfiguration indicates an expected call of ValidateConfiguration
type MockSourceMockRecorder ¶ added in v0.2.0
type MockSourceMockRecorder struct {
// contains filtered or unexported fields
}
MockSourceMockRecorder is the mock recorder for MockSource
func (*MockSourceMockRecorder) Credentials ¶ added in v0.2.0
func (mr *MockSourceMockRecorder) Credentials() *gomock.Call
Credentials indicates an expected call of Credentials
func (*MockSourceMockRecorder) Type ¶ added in v0.2.0
func (mr *MockSourceMockRecorder) Type() *gomock.Call
Type indicates an expected call of Type
func (*MockSourceMockRecorder) ValidateConfiguration ¶ added in v0.2.0
func (mr *MockSourceMockRecorder) ValidateConfiguration() *gomock.Call
ValidateConfiguration indicates an expected call of ValidateConfiguration
type SSHCredentials ¶
type SSHCredentials struct { Base `mapstructure:",squash"` Username string Passphrase string PrivateKey string `mapstructure:"private_key"` }
SSHCredentials represents credentials composed of a private key, username and passphrase
func NewSSHCredentials ¶
func NewSSHCredentials() *SSHCredentials
NewSSHCredentials instantiates a SSHCredentials struct
func (*SSHCredentials) ToString ¶
func (cred *SSHCredentials) ToString(showSensitive bool) string
ToString prints out the content of a UsernamePasswordCredentials struct. If showSensitive is true, the passphrase will be shown
func (*SSHCredentials) Validate ¶
func (cred *SSHCredentials) Validate() error
Validate verifies that the credentials is valid. A SSHCredentials must have a private key, the username and passphrase are optional
type SecretTextCredentials ¶
SecretTextCredentials represents credentials composed of a single string value
func NewSecretText ¶
func NewSecretText() *SecretTextCredentials
NewSecretText instantiates a SecretTextCredentials struct
func (*SecretTextCredentials) ToString ¶
func (cred *SecretTextCredentials) ToString(showSensitive bool) string
ToString prints out the content of a SecretTextCredentials struct. If showSensitive is true, the secret text will be shown
func (*SecretTextCredentials) Validate ¶
func (cred *SecretTextCredentials) Validate() error
Validate verifies that the credentials is valid. A SecretTextCredentials is always considered valid, as empty values are accepted.
type Source ¶
type Source interface { Credentials() ([]Credentials, error) Type() string ValidateConfiguration() error }
Source represents a location to fetch credentials
type SourceCollection ¶ added in v0.2.0
type SourceCollection interface { AllSources() []Source Credentials() ([]Credentials, error) ValidateConfiguration() error }
SourceCollection represents a collection of sources from which credentials can be fetched
type SourcesConfiguration ¶
type SourcesConfiguration struct { AWSS3Sources []*AWSS3Source `mapstructure:"aws_s3"` AWSSecretsManagerSource []*AWSSecretsManagerSource `mapstructure:"aws_secretsmanager"` LocalSources []*LocalSource `mapstructure:"local"` // contains filtered or unexported fields }
SourcesConfiguration contains all configured sources
func (*SourcesConfiguration) AllSources ¶
func (sc *SourcesConfiguration) AllSources() []Source
AllSources returns all configured sources in a single list
func (*SourcesConfiguration) Credentials ¶
func (sc *SourcesConfiguration) Credentials() ([]Credentials, error)
Credentials extracts credentials from all configured sources
func (*SourcesConfiguration) ValidateConfiguration ¶
func (sc *SourcesConfiguration) ValidateConfiguration() error
ValidateConfiguration verifies that all configured sources are correctly configured
type UsernamePasswordCredentials ¶
type UsernamePasswordCredentials struct { Base `mapstructure:",squash"` Username string Password string }
UsernamePasswordCredentials represents credentials composed of a username and a password
func NewUsernamePassword ¶
func NewUsernamePassword() *UsernamePasswordCredentials
NewUsernamePassword instantiates a UsernamePasswordCredentials struct
func (*UsernamePasswordCredentials) ToString ¶
func (cred *UsernamePasswordCredentials) ToString(showSensitive bool) string
ToString prints out the content of a UsernamePasswordCredentials struct. If showSensitive is true, the password will be shown
func (*UsernamePasswordCredentials) Validate ¶
func (cred *UsernamePasswordCredentials) Validate() error
Validate verifies that the credentials is valid. A UsernamePasswordCredentials is always considered valid, as empty values are accepted.