Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeProject ¶
NormalizeProject folds the default project onto the canonical "" scope, matching spendalert.NormalizeProject and the cloud principal resolver, so a request's project resolves to its binding exactly as the org-wide default row is matched.
Types ¶
type ProjectBinding ¶
type ProjectBinding struct {
mixin.Model[ProjectBinding]
// Project is the project slug within the org; "" = the default scope.
Project string `json:"project"`
// BillingAccountId is the funding BillingAccount.Id().
BillingAccountId string `json:"billingAccountId"`
}
ProjectBinding links one of the org's projects to the BillingAccount that funds it (GCP's Project.billingAccountId). It is the SINGLE source of truth for "which account does this project's usage debit": the token's billing_account claim is a signed cache of this row, and the debit-time resolver reads THIS row, never a client header. A project with no binding draws the org's Default account (or the org-wide pool if the org has none). Project "" is the org's default scope.
func New ¶
func New(db *datastore.Datastore) *ProjectBinding
func (*ProjectBinding) Validator ¶
func (p *ProjectBinding) Validator() *val.Validator