secret

package
v0.0.0-...-1592773 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ApplicationOwner = secrets.ApplicationOwner
	UnitOwner        = secrets.UnitOwner
	ModelOwner       = secrets.ModelOwner
)

These represent the kinds of secret owner.

Variables

View Source
var (
	NilLabels            = Labels(nil)
	NilApplicationOwners = ApplicationOwners(nil)
	NilUnitOwners        = UnitOwners(nil)
	NilRevision          = (*int)(nil)
	NilSecretURI         = (*secrets.URI)(nil)
)

These consts are used to specify nil filter terms.

Functions

This section is empty.

Types

type AccessParams

type AccessParams struct {
	SubjectTypeID GrantSubjectType
	SubjectID     string
}

AccessParams are used when querying secret access.

type AccessScope

type AccessScope struct {
	ScopeTypeID GrantScopeType
	ScopeID     string
}

AccessScope are used when querying secret access scopes.

type ApplicationOwners

type ApplicationOwners []string

These type aliases are used to specify filter terms.

type ConsumerInfo

type ConsumerInfo struct {
	SubjectTypeID   GrantSubjectType
	SubjectID       string
	Label           string
	CurrentRevision int
}

ConsumerInfo holds information about a secret consumer.

type ExpiryInfo

type ExpiryInfo struct {
	URI             *secrets.URI
	Revision        int
	RevisionID      string
	NextTriggerTime time.Time
}

ExpiryInfo holds information about the expiry of a secret revision.

type GrantParams

type GrantParams struct {
	ScopeTypeID GrantScopeType
	ScopeID     string

	SubjectTypeID GrantSubjectType
	SubjectID     string

	RoleID Role
}

GrantParams are used when granting access to a secret.

type GrantScopeType

type GrantScopeType int

GrantScopeType represents the type of a subject granted access to a secret as recorded in the secret_grant_subject_type lookup table.

const (
	ScopeUnit GrantScopeType = iota
	ScopeApplication
	ScopeModel
	ScopeRelation
)

func (GrantScopeType) String

func (s GrantScopeType) String() string

String implements fmt.Stringer.

type GrantSubjectType

type GrantSubjectType int

GrantSubjectType represents the type of the scope of a secret access grant as recorded in the secret_grant_scope_type lookup table.

const (
	SubjectUnit GrantSubjectType = iota
	SubjectApplication
	SubjectModel
	SubjectRemoteApplication
)

func (GrantSubjectType) String

func (s GrantSubjectType) String() string

String implements fmt.Stringer.

type Labels

type Labels []string

These type aliases are used to specify filter terms.

type Owner

type Owner struct {
	Kind secrets.OwnerKind
	UUID string
}

Owner is the owner of a secret.

type RemoteSecretInfo

type RemoteSecretInfo struct {
	URI             *secrets.URI
	SubjectTypeID   GrantSubjectType
	SubjectID       string
	Label           string
	CurrentRevision int
	LatestRevision  int
}

RemoteSecretInfo holds information about a remote secret for a given consumer.

type Role

type Role int

Role represents the role of a secret access grant as recorded in the secret_role lookup table.

const (
	RoleNone Role = iota
	RoleView
	RoleManage
)

func MarshallRole

func MarshallRole(role coresecrets.SecretRole) Role

MarshallRole converts a secret role to a db role id.

func (Role) String

func (r Role) String() string

String implements fmt.Stringer.

type RotatePolicy

type RotatePolicy int

RotatePolicy represents the rotate policy of a secret. as recorded in the secret_rotate_policy lookup table.

const (
	RotateNever RotatePolicy = iota
	RotateHourly
	RotateDaily
	RotateWeekly
	RotateMonthly
	RotateQuarterly
	RotateYearly
)

func MarshallRotatePolicy

func MarshallRotatePolicy(policy *coresecrets.RotatePolicy) RotatePolicy

MarshallRotatePolicy converts a secret rotate policy to a db rotate policy id.

type RotationExpiryInfo

type RotationExpiryInfo struct {
	// RotatePolicy is the rotation policy of the secret.
	RotatePolicy secrets.RotatePolicy
	// NextRotateTime is when the secret should be rotated.
	NextRotateTime *time.Time
	// LatestExpireTime is the expire time of the most recent revision.
	LatestExpireTime *time.Time
	// LatestRevision is the most recent secret revision.
	LatestRevision int
}

RotationExpiryInfo holds information about the rotation and expiry of a secret.

type RotationInfo

type RotationInfo struct {
	URI             *secrets.URI
	Revision        int
	NextTriggerTime time.Time
}

RotationInfo holds information about the rotation of a secret.

type UnitOwners

type UnitOwners []string

These type aliases are used to specify filter terms.

type UpsertSecretParams

type UpsertSecretParams struct {
	RevisionID     *string
	RotatePolicy   *RotatePolicy
	ExpireTime     *time.Time
	NextRotateTime *time.Time
	Description    *string
	Label          *string
	AutoPrune      *bool

	Data     secrets.SecretData
	ValueRef *secrets.ValueRef
	Checksum string
}

UpsertSecretParams are used to upsert a secret. Only non-nil values are used.

func (*UpsertSecretParams) HasUpdate

func (u *UpsertSecretParams) HasUpdate() bool

HasUpdate returns true if at least one attribute to update is not nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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