Documentation
¶
Overview ¶
Package session resolves the authenticated client and active project for a command run.
Index ¶
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) 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.