Documentation
¶
Overview ¶
Package profile contains runtime profile domain models.
Index ¶
- Variables
- func IsInheritedStorageName(name string) bool
- func IsWorkspaceInheritedStorageName(name string) bool
- func SecretRef(profileName, key string) string
- func SecretRefForProfileName(profileName, key string) string
- func ValidateKey(key string) error
- func ValidateName(name string) error
- type CreateInput
- type Entry
- type EntryKind
- type InheritedCreateInput
- type InheritedRef
- type Manager
- func (m *Manager) DeleteEntry(ctx context.Context, p *Profile, key, actor string) error
- func (m *Manager) EnsureRunnable(ctx context.Context, name string) (*Profile, error)
- func (m *Manager) Resolve(ctx context.Context, name string) (*Resolved, error)
- func (m *Manager) SetSecret(ctx context.Context, p *Profile, key, value, actor string) (*Profile, error)
- func (m *Manager) SetVariable(ctx context.Context, p *Profile, key, value, actor string) (*Profile, error)
- type Profile
- func (p *Profile) ApplyUpdate(input UpdateInput, now time.Time)
- func (p *Profile) Clone() *Profile
- func (p *Profile) DeleteEntry(key, actor string, now time.Time) error
- func (p *Profile) SetSecret(key, secretID, actor string, now time.Time) error
- func (p *Profile) SetStatus(status Status, actor string, now time.Time) error
- func (p *Profile) SetVariable(key, value, actor string, now time.Time) error
- type Resolved
- type ResolvedEntry
- type Resolver
- type Status
- type Store
- type UpdateInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("profile already exists") ErrDisabled = errors.New("profile is disabled") ErrDuplicateKey = errors.New("profile key already exists") ErrInvalidKey = errors.New("invalid profile key") ErrInvalidName = errors.New("invalid profile name") ErrInvalidStatus = errors.New("invalid profile status") ErrNotFound = errors.New("profile not found") ErrReservedKey = errors.New("profile key is reserved") )
Functions ¶
func IsInheritedStorageName ¶
func SecretRef ¶
SecretRef returns the deterministic managed-secret reference for a profile entry. The format is "runtime-profiles/<profileName>/key-<hexEncodedKey>".
func SecretRefForProfileName ¶
func ValidateKey ¶
func ValidateName ¶
Types ¶
type CreateInput ¶
type InheritedCreateInput ¶
type InheritedRef ¶
type InheritedRef struct {
// contains filtered or unexported fields
}
InheritedRef identifies a non-selectable profile layer inherited by a run.
func GlobalInheritedRef ¶
func GlobalInheritedRef() InheritedRef
func WorkspaceInheritedRef ¶
func WorkspaceInheritedRef(name string) (InheritedRef, error)
func (InheritedRef) PublicName ¶
func (r InheritedRef) PublicName() string
func (InheritedRef) SecretRef ¶
func (r InheritedRef) SecretRef(key string) string
func (InheritedRef) StorageName ¶
func (r InheritedRef) StorageName() string
func (InheritedRef) Valid ¶
func (r InheritedRef) Valid() bool
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates profile mutations that span the profile and secret stores.
func (*Manager) DeleteEntry ¶
func (*Manager) EnsureRunnable ¶
type Profile ¶
type Profile struct {
ID string
Name string
Description string
Status Status
Protected bool
DefaultProfile string `json:"defaultProfile,omitempty"`
Entries []Entry
CreatedBy string
CreatedAt time.Time
UpdatedBy string
UpdatedAt time.Time
}
func NewInherited ¶
func NewInherited(ref InheritedRef, input InheritedCreateInput, now time.Time) (*Profile, error)
func (*Profile) ApplyUpdate ¶
func (p *Profile) ApplyUpdate(input UpdateInput, now time.Time)
type Resolved ¶
type Resolved struct {
Name string
Variables map[string]string
Secrets map[string]string
Entries []ResolvedEntry
}
func MergeResolved ¶
type ResolvedEntry ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func (*Resolver) ResolveInherited ¶
type Store ¶
type Store interface {
// Create persists a new Profile and returns ErrAlreadyExists when the name is already used.
Create(ctx context.Context, profile *Profile) error
// GetByName returns the Profile with the given name or ErrNotFound.
GetByName(ctx context.Context, name string) (*Profile, error)
// GetInherited returns the inherited profile layer identified by ref or ErrNotFound.
GetInherited(ctx context.Context, ref InheritedRef) (*Profile, error)
// List returns all stored profiles.
List(ctx context.Context) ([]*Profile, error)
// Update replaces an existing Profile and returns ErrNotFound when it does not exist.
Update(ctx context.Context, profile *Profile) error
// Delete removes the named Profile and returns ErrNotFound when it does not exist.
Delete(ctx context.Context, name string) error
}
Store persists runtime profiles by name. Implementations must be safe for concurrent use and enforce profile name uniqueness. GetByName and Delete return ErrNotFound when the named profile does not exist. Create and Update validate stored profile data before persisting it.
type UpdateInput ¶
Click to show internal directories.
Click to hide internal directories.