Documentation
¶
Overview ¶
Package project is the domain layer for the Project entity — the unit inside a Team that owns Policies, Keys, and user-created HostKeys. A Project's owner is always its Team (owner.kind=team, owner.id=teamId); rows owned by a Project carry owner.kind=project.
Authorization (who in the team may touch a project's rows) lives in app/authz; this package validates shape only.
Index ¶
- Constants
- func OfTeam(teamID string, projects []*Project, gone Gone, visible Visible) (named []string, hidden int)
- type DependentsError
- type Gone
- type Project
- type Rows
- type Spec
- type Store
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) Directory() directory.Store[directory.Project]
- func (s *Store) Get(ctx context.Context, id string) (*Project, error)
- func (s *Store) List(ctx context.Context) ([]*Project, error)
- func (s *Store) Upsert(ctx context.Context, p *Project) error
- type Visible
Constants ¶
const LegacyID = "00000000-0000-7000-8000-000000000001"
LegacyID is the id of the `legacy` project the tenancy migration creates for keys that predate projects. Fixed so the data plane can tell it apart from a project an operator later names `legacy`; ids are server-minted, so no other row can claim it.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DependentsError ¶
DependentsError refuses deleting a team or project that still has rows under it. The caller names the team or project. Hidden rows still block but are only counted.
func (*DependentsError) Error ¶
func (e *DependentsError) Error() string
type Gone ¶
Gone reports a row the caller is deleting in the same operation, keyed by manifest kind and id. Such a row is not in the way.
type Project ¶
type Project struct {
Meta meta.Metadata `json:"metadata" yaml:"metadata"`
Spec Spec `json:"spec" yaml:"spec"`
}
Project is a Team-owned grouping of request-authoring resources.
func FromDirectory ¶ added in v0.10.8
FromDirectory is a directory row as a Project.
func (*Project) StampOwner ¶
func (p *Project) StampOwner()
StampOwner sets Meta.Owner to the project's Team. Called by every write path (translate, CRUD guard) so Owner never drifts from TeamID.
func (*Project) ToDirectory ¶ added in v0.10.8
ToDirectory is p as the directory stores it.
type Rows ¶
type Rows struct {
ServiceAccounts []*serviceaccount.ServiceAccount
Keys []*key.Key
Policies []*policy.Policy
HostKeys []*hostkey.HostKey
RateLimits []*ratelimit.RateLimit
PolicyBindings []*policybinding.PolicyBinding
}
Rows are the rows that can live under a project. Deleting the project would cascade through the foreign keys to its service accounts, their keys and its policy bindings, and leave its policies, host keys and rate limits owned by a project that no longer exists — so apply's prune refuses while any remain.
type Spec ¶
type Spec struct {
// TeamID is the owning Team. Required; mirrors Meta.Owner.ID.
TeamID string `json:"teamId" yaml:"teamId" validate:"required,uuid"`
// Enabled defaults to true when nil.
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
// Budget caps spend for this project alone.
Budget *team.Budget `json:"budget,omitempty" yaml:"budget,omitempty" validate:"omitempty"`
}
Spec carries the parent Team, the enabled flag, and the spend cap.