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
- 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 ¶
This section is empty.
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
Accounts []*account.Account
Pools []*pool.Pool
Budgets []*budget.Budget
}
Rows are the rows that can live under a team or project. Deleting the owner would cascade through the foreign keys to its projects, service accounts, their keys and its policy bindings, and leave its policies, host keys, rate limits, accounts, pools and budgets owned by a team or project that no longer exists — so apply's prune refuses while any remain, as the control API's delete does. A caller account is the exception: the delete takes it along.
func (Rows) Dependents ¶
Dependents names, as "Kind/name", every row in rows under project id the caller may see, and counts the rest.
func (Rows) TeamDependents ¶ added in v0.20.0
func (r Rows) TeamDependents(id string, projects []*Project, gone Gone, visible Visible) (named []string, hidden int)
TeamDependents names, as "Kind/name", every project in projects under team id and every row in rows the team owns that the caller may see, and counts the rest.
type Spec ¶
type Spec struct {
// TeamID is the owning Team. Required; mirrors Meta.Owner.ID.
TeamID string `` /* 129-byte string literal not displayed */
// Enabled defaults to true when nil.
Enabled *bool `` /* 150-byte string literal not displayed */
}
Spec carries the parent Team and the enabled flag. A project's spend cap is a Budget its bound policy links.