Documentation
¶
Index ¶
- Constants
- type Cloneable
- type CredentialLibrary
- type CredentialSource
- type HostSource
- type Option
- func WithCredentialSources(cl []string) Option
- func WithDefaultPort(p uint32) Option
- func WithDescription(desc string) Option
- func WithHostSources(hs []string) Option
- func WithLimit(limit int) Option
- func WithName(name string) Option
- func WithPublicId(id string) Option
- func WithScopeId(scopeId string) Option
- func WithScopeIds(scopeIds []string) Option
- func WithScopeName(scopeName string) Option
- func WithSessionConnectionLimit(limit int32) Option
- func WithSessionMaxSeconds(dur uint32) Option
- func WithTargetType(t TargetType) Option
- func WithUserId(userId string) Option
- func WithWorkerFilter(filter string) Option
- type Repository
- func (r *Repository) AddTargetCredentialSources(ctx context.Context, targetId string, targetVersion uint32, cIds []string, ...) (Target, []HostSource, []CredentialSource, error)
- func (r *Repository) AddTargetHostSources(ctx context.Context, targetId string, targetVersion uint32, ...) (Target, []HostSource, []CredentialSource, error)
- func (r *Repository) CreateTcpTarget(ctx context.Context, target *TcpTarget, opt ...Option) (Target, []HostSource, []CredentialSource, error)
- func (r *Repository) DeleteTarget(ctx context.Context, publicId string, _ ...Option) (int, error)
- func (r *Repository) DeleteTargetCredentialSources(ctx context.Context, targetId string, targetVersion uint32, csIds []string, ...) (int, error)
- func (r *Repository) DeleteTargetHostSources(ctx context.Context, targetId string, targetVersion uint32, ...) (int, error)
- func (r *Repository) ListTargets(ctx context.Context, opt ...Option) ([]Target, error)
- func (r *Repository) LookupTarget(ctx context.Context, publicIdOrName string, opt ...Option) (Target, []HostSource, []CredentialSource, error)
- func (r *Repository) SetTargetCredentialSources(ctx context.Context, targetId string, targetVersion uint32, csIds []string, ...) ([]HostSource, []CredentialSource, int, error)
- func (r *Repository) SetTargetHostSources(ctx context.Context, targetId string, targetVersion uint32, ...) ([]HostSource, []CredentialSource, int, error)
- func (r *Repository) UpdateTcpTarget(ctx context.Context, target *TcpTarget, version uint32, ...) (Target, []HostSource, []CredentialSource, int, error)
- type Subtype
- type Target
- type TargetHostSet
- type TargetLibrary
- type TargetSet
- type TargetType
- type TcpTarget
Constants ¶
const (
DefaultTargetHostSetTableName = "target_host_set"
)
const (
DefaultTcpTableName = "target_tcp"
)
const (
TcpTargetPrefix = "ttcp"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cloneable ¶
type Cloneable interface {
Clone() interface{}
}
Cloneable provides a cloning interface
type CredentialLibrary ¶ added in v0.4.0
type CredentialLibrary struct { *store.CredentialLibrary // contains filtered or unexported fields }
A CredentialLibrary is a CredentialSource that represents the relationship between a target and a credential library.
func NewCredentialLibrary ¶ added in v0.4.0
func NewCredentialLibrary(targetId, credentialLibraryId string, _ ...Option) (*CredentialLibrary, error)
NewCredentialLibrary creates a new in memory CredentialLibrary representing the relationship between targetId and credentialLibraryId.
func TestCredentialLibrary ¶ added in v0.4.0
func TestCredentialLibrary(t *testing.T, conn *gorm.DB, targetId, libraryId string) *CredentialLibrary
TestCredentialLibrary creates a CredentialLibrary for targetId and libraryId.
func (*CredentialLibrary) SetTableName ¶ added in v0.4.0
func (t *CredentialLibrary) SetTableName(n string)
SetTableName sets the table name.
func (*CredentialLibrary) TableName ¶ added in v0.4.0
func (t *CredentialLibrary) TableName() string
TableName returns the table name.
type CredentialSource ¶ added in v0.5.0
type CredentialSource interface { CredentialStoreId() string Id() string CredentialPurpose() credential.Purpose TargetId() string }
CredentialSource is an interface that can be implemented by both a library and a singular credential.
type HostSource ¶ added in v0.5.0
HostSource is an interface that can be implemented by both a set and a singular host.
type Option ¶
type Option func(*options)
Option - how Options are passed as arguments
func WithCredentialSources ¶ added in v0.5.0
WithCredentialSources provides an option for providing a list of credential source ids
func WithDefaultPort ¶
WithDefaultPort provides an option to specify the default target port.
func WithDescription ¶
WithDescription provides an optional description
func WithHostSources ¶ added in v0.5.0
WithHostSources provides an option for providing a list of host source ids
func WithLimit ¶
WithLimit provides an option to provide a limit. Intentionally allowing negative integers. If WithLimit < 0, then unlimited results are returned. If WithLimit == 0, then default limits are used for results.
func WithScopeId ¶
WithScopeId provides an option to search by a scope id
func WithScopeIds ¶ added in v0.1.5
WithScopeId provides an option to search by multiple scope id
func WithScopeName ¶ added in v0.1.1
WithScopeId provides an option to search by a scope name
func WithSessionMaxSeconds ¶
func WithTargetType ¶
func WithTargetType(t TargetType) Option
WithTargetType provides an option to search by a target type
func WithUserId ¶
WithUserId provides an option to search by a user public id
func WithWorkerFilter ¶ added in v0.1.5
WithWorkerFilter provides an optional worker filter
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is the target database repository
func NewRepository ¶
NewRepository creates a new target Repository. Supports the options: WithLimit which sets a default limit on results returned by repo operations.
func (*Repository) AddTargetCredentialSources ¶ added in v0.5.0
func (r *Repository) AddTargetCredentialSources(ctx context.Context, targetId string, targetVersion uint32, cIds []string, _ ...Option) (Target, []HostSource, []CredentialSource, error)
AddTargetCredentialSources adds the cIds to the targetId in the repository. The target and the list of credential sources attached to the target, after cIds are added, will be returned on success. The targetVersion must match the current version of the targetId in the repository.
func (*Repository) AddTargetHostSources ¶ added in v0.5.0
func (r *Repository) AddTargetHostSources(ctx context.Context, targetId string, targetVersion uint32, hostSourceIds []string, _ ...Option) (Target, []HostSource, []CredentialSource, error)
AddTargetHostSources provides the ability to add host sources (hostSourceIds) to a target (targetId). The target's current db version must match the targetVersion or an error will be returned. The target and a list of current host source ids will be returned on success. Zero is not a valid value for the WithVersion option and will return an error.
func (*Repository) CreateTcpTarget ¶
func (r *Repository) CreateTcpTarget(ctx context.Context, target *TcpTarget, opt ...Option) (Target, []HostSource, []CredentialSource, error)
CreateTcpTarget inserts into the repository and returns the new Target with its list of host sets and credential libraries. WithHostSources and WithCredentialSources are the only supported option.
func (*Repository) DeleteTarget ¶
DeleteTarget will delete a target from the repository.
func (*Repository) DeleteTargetCredentialSources ¶ added in v0.5.0
func (r *Repository) DeleteTargetCredentialSources(ctx context.Context, targetId string, targetVersion uint32, csIds []string, _ ...Option) (int, error)
DeleteTargetCredentialSources deletes credential sources from a target in the repository. The target's current db version must match the targetVersion or an error will be returned.
func (*Repository) DeleteTargetHostSources ¶ added in v0.5.0
func (r *Repository) DeleteTargetHostSources(ctx context.Context, targetId string, targetVersion uint32, hostSourceIds []string, _ ...Option) (int, error)
DeleteTargeHostSources deletes host sources from a target (targetId). The target's current db version must match the targetVersion or an error will be returned. Zero is not a valid value for the WithVersion option and will return an error.
func (*Repository) ListTargets ¶
ListTargets in targets in a scope. Supports the WithScopeId, WithLimit, WithTargetType options.
func (*Repository) LookupTarget ¶
func (r *Repository) LookupTarget(ctx context.Context, publicIdOrName string, opt ...Option) (Target, []HostSource, []CredentialSource, error)
LookupTarget will look up a target in the repository and return the target with its host source ids and credential source ids. If the target is not found, it will return nil, nil, nil, nil. No options are currently supported.
func (*Repository) SetTargetCredentialSources ¶ added in v0.5.0
func (r *Repository) SetTargetCredentialSources(ctx context.Context, targetId string, targetVersion uint32, csIds []string, _ ...Option) ([]HostSource, []CredentialSource, int, error)
SetTargetCredentialSources will set the target's credential sources. Set will add and/or delete credential sources as need to reconcile the existing credential sources with the request. If clIds is empty, all the credential sources will be cleared from the target.
func (*Repository) SetTargetHostSources ¶ added in v0.5.0
func (r *Repository) SetTargetHostSources(ctx context.Context, targetId string, targetVersion uint32, hostSourceIds []string, _ ...Option) ([]HostSource, []CredentialSource, int, error)
SetTargetHostSources will set the target's host sources. Set add and/or delete target host sources as need to reconcile the existing sets with the sets requested. If hostSourceIds is empty, the target host sources will be cleared. Zero is not a valid value for the WithVersion option and will return an error.
func (*Repository) UpdateTcpTarget ¶
func (r *Repository) UpdateTcpTarget(ctx context.Context, target *TcpTarget, version uint32, fieldMaskPaths []string, _ ...Option) (Target, []HostSource, []CredentialSource, int, error)
UpdateTcpTarget will update a target in the repository and return the written target. fieldMaskPaths provides field_mask.proto paths for fields that should be updated. Fields will be set to NULL if the field is a zero value and included in fieldMask. Name, Description, and WorkerFilter are the only updatable fields. If no updatable fields are included in the fieldMaskPaths, then an error is returned.
type Subtype ¶ added in v0.2.2
type Subtype int
func SubtypeFromId ¶
SubtypeFromId takes any public id in the target subsystem and uses the prefix to determine what subtype the id is for. Returns UnknownSubtype if no Subtype with this id's prefix is found.
func SubtypeFromType ¶
SubtypeFromType converts a string to a Subtype. returns UnknownSubtype if no Subtype with that name is found.
type Target ¶
type Target interface { GetPublicId() string GetScopeId() string GetDefaultPort() uint32 GetName() string GetDescription() string GetVersion() uint32 GetType() string GetCreateTime() *timestamp.Timestamp GetUpdateTime() *timestamp.Timestamp GetSessionMaxSeconds() uint32 GetSessionConnectionLimit() int32 GetWorkerFilter() string // contains filtered or unexported methods }
Target is a commmon interface for all target subtypes
type TargetHostSet ¶
type TargetHostSet struct { *store.TargetHostSet // contains filtered or unexported fields }
func NewTargetHostSet ¶
func NewTargetHostSet(targetId, hostSetId string, _ ...Option) (*TargetHostSet, error)
NewTargetHostSet creates a new in memory target host set. No options are currently supported.
func (*TargetHostSet) Clone ¶
func (t *TargetHostSet) Clone() interface{}
Clone creates a clone of the target host set
func (*TargetHostSet) SetTableName ¶
func (t *TargetHostSet) SetTableName(n string)
SetTableName sets the tablename and satisfies the ReplayableMessage interface. If the caller attempts to set the name to "" the name will be reset to the default name.
func (*TargetHostSet) TableName ¶
func (t *TargetHostSet) TableName() string
TableName returns the tablename to override the default gorm table name
type TargetLibrary ¶ added in v0.4.0
type TargetLibrary struct { *store.CredentialLibrary StoreId string }
A TargetLibrary represents the relationship between a target and a credential library and includes the id of the credential store that the library is a part of and the library's name and description.
It implements the target.CredentialSource interface.
func (*TargetLibrary) CredentialPurpose ¶ added in v0.5.0
func (ts *TargetLibrary) CredentialPurpose() credential.Purpose
CredentialPurpose returns the purpose of the credential
func (*TargetLibrary) CredentialStoreId ¶ added in v0.5.0
func (ts *TargetLibrary) CredentialStoreId() string
CredentialStoreId returns the ID of the store containing the library
func (*TargetLibrary) Id ¶ added in v0.5.0
func (ts *TargetLibrary) Id() string
Id returns the ID of the library
func (*TargetLibrary) TableName ¶ added in v0.4.0
func (ts *TargetLibrary) TableName() string
TableName returns the tablename to override the default gorm table name
func (*TargetLibrary) TargetId ¶ added in v0.5.0
func (ts *TargetLibrary) TargetId() string
TargetId returns the target linked to this credential source
type TargetSet ¶
TargetSet is returned from most repo operations as the target's host set.
func (*TargetSet) HostCatalogId ¶ added in v0.5.0
HostCatalogId returns the ID of the catalog containing the set
type TargetType ¶
type TargetType uint32
TargetType defines the possible types for targets.
const ( UnknownTargetType TargetType = 0 TcpTargetType TargetType = 1 )
func (TargetType) String ¶
func (t TargetType) String() string
String returns a string representation of the target type.
type TcpTarget ¶
func NewTcpTarget ¶
NewTcpTarget creates a new in memory tcp target. WithName, WithDescription and WithDefaultPort options are supported
func TestTcpTarget ¶
func (*TcpTarget) Clone ¶
func (t *TcpTarget) Clone() interface{}
Clone creates a clone of the TcpTarget
func (*TcpTarget) SetTableName ¶
SetTableName sets the tablename and satisfies the ReplayableMessage interface. If the caller attempts to set the name to "" the name will be reset to the default name.