Documentation ¶
Index ¶
- Constants
- func LoadFromContext(ctx context.Context) (string, error)
- func SaveToContext(ctx context.Context, tenantID string) context.Context
- func TrimCustomerIDLeadingZeros(id string) string
- func TypeToStr(value Type) string
- type Entity
- type EntityCollection
- type EntityWithAppID
- type EntityWithAppIDCollection
- type Status
- type Type
Constants ¶
const ContextKey contextKey = "TenantCtxKey"
ContextKey missing godoc
Variables ¶
This section is empty.
Functions ¶
func LoadFromContext ¶
LoadFromContext retrieves the tenantID from the provided context or returns error if missing
func SaveToContext ¶
SaveToContext saves the provided tenantID into the respective context
func TrimCustomerIDLeadingZeros ¶
TrimCustomerIDLeadingZeros trims the leading zeros of customer IDs. Some IDs might have those zeros but we need to unify all IDs because other external services expect the values without the zeros. If the id argument is a valid GUID, then no trimming is performed
Types ¶
type Entity ¶
type Entity struct { ID string `db:"id"` Name string `db:"external_name"` ExternalTenant string `db:"external_tenant"` Type Type `db:"type"` ProviderName string `db:"provider_name"` Initialized *bool `db:"initialized"` // computed value Status Status `db:"status"` }
Entity represents a Compass tenant.
func (Entity) WithStatus ¶
WithStatus sets the provided status to the entity.
type EntityCollection ¶
type EntityCollection []Entity
EntityCollection is a wrapper type for slice of entities.
func (EntityCollection) Len ¶
func (a EntityCollection) Len() int
Len returns the current number of entities in the collection.
type EntityWithAppID ¶
EntityWithAppID represents a Compass tenant with application id.
type EntityWithAppIDCollection ¶
type EntityWithAppIDCollection []EntityWithAppID
EntityWithAppIDCollection represents a slice of EntityWithAppID objects
func (EntityWithAppIDCollection) Len ¶
func (a EntityWithAppIDCollection) Len() int
Len returns the current number of entities in the collection.
type Status ¶
type Status string
Status is used to determine if a tenant is currently being used or not.
type Type ¶
type Type string
Type missing godoc
const ( // Unknown tenant type is used when the tenant type cannot be determined when the tenant's being created. Unknown Type = "unknown" // Customer tenants can be parents of account tenants. Customer Type = "customer" // Account tenant type may have a parent with type Customer. Account Type = "account" // Subaccount tenants must have a parent of type Account. Subaccount Type = "subaccount" // Organization tenants can be parents of Folder or ResourceGroup tenants. Organization Type = "organization" // Folder tenants must have a parent of type Organization. Folder Type = "folder" // ResourceGroup tenants must have a parent of type Folder or Organization. ResourceGroup Type = "resource-group" // CostObject tenants can be parents of Folder or Account. CostObject Type = "cost-object" )