project

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Name     string
	DomainID string
}

Info holds resolved project name and domain ID.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver resolves project IDs to names and domain IDs via keystone DB. It caches the mapping and refreshes it periodically based on a TTL.

func NewResolver

func NewResolver(logger *slog.Logger, keystoneDB *keystonedb.Queries, ttl time.Duration) *Resolver

NewResolver creates a resolver that fetches projects from keystone and caches them for the given TTL. If keystoneDB is nil, the resolver returns project IDs as-is. A zero TTL uses the default (5 minutes).

func (*Resolver) AllProjects

func (r *Resolver) AllProjects() map[string]Info

AllProjects returns a snapshot of all cached project IDs and their info.

func (*Resolver) Resolve

func (r *Resolver) Resolve(projectID string) (name, domainID string)

Resolve returns the project name and domain_id for a given project ID. Falls back to the project ID itself if not found.

Jump to

Keyboard shortcuts

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