Documentation
¶
Overview ¶
Package session resolves the authenticated client and active project for a command run.
Index ¶
- type Factory
- func (f Factory) APIClient(apiURL, token string) (*api.Client, error)
- func (f Factory) APIURL(cfg *config.Config) string
- func (f Factory) AccountScoped() (*Session, error)
- func (f Factory) Authenticated() (*Session, error)
- func (f Factory) Config() (*config.Config, error)
- func (f Factory) CurrentProject() (*ProjectSession, error)
- type ProjectSession
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory builds API clients and authenticated sessions.
func NewFactory ¶
func NewFactory(deps cliruntime.Deps) Factory
NewFactory returns a session factory using the provided runtime dependencies.
func (Factory) APIClient ¶
APIClient constructs an API client with runtime overrides. In local mode it sends no credential: local is a single-tenant sandbox with no attacker model, and the local server defaults an absent credential to the pre-provisioned local user, so every local command behaves the same way. Cloud is unaffected.
func (Factory) AccountScoped ¶ added in v0.31.0
AccountScoped loads config and builds an API client for a workflow that reaches beyond one project, rejecting a project access token before it can produce a 403 the caller cannot act on.
func (Factory) Authenticated ¶
Authenticated loads config, requires authentication, and builds an API client.
func (Factory) CurrentProject ¶
func (f Factory) CurrentProject() (*ProjectSession, error)
CurrentProject builds an authenticated API client for the current project.
type ProjectSession ¶
type ProjectSession struct {
Config *config.Config
API *api.Client
ProjectID uuid.UUID
APIURL string
// contains filtered or unexported fields
}
ProjectSession contains config, an API client, and the current project ID.
func (*ProjectSession) APIWithToken ¶
func (s *ProjectSession) APIWithToken(token string) (*api.Client, error)
APIWithToken constructs an API client for the same API URL and runtime dependencies as this project session, using the provided bearer token.