cloudauth

package
v0.11.818 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ClientID = "bruin-cli"
View Source
const DefaultAPIURL = "https://cloud.getbruin.com/api/v1"

Variables

This section is empty.

Functions

func APIURL

func APIURL() string

func CheckDestination

func CheckDestination(stored, current string) error

func Revoke

func Revoke(ctx context.Context, credential *Credential) error

Types

type ActAsSession added in v0.11.818

type ActAsSession struct {
	AgentID   int       `yaml:"agent_id"`
	AgentName string    `yaml:"agent_name"`
	Team      string    `yaml:"team"`
	APIURL    string    `yaml:"api_url"`
	Token     string    `yaml:"token"`
	ExpiresAt time.Time `yaml:"expires_at"`
}

type Credential

type Credential struct {
	Token       string    `json:"access_token"`
	TokenType   string    `json:"token_type"`
	TokenID     string    `json:"token_id"`
	Account     string    `json:"account"`
	DefaultTeam string    `json:"default_team"`
	ExpiresAt   time.Time `json:"expires_at"`
	Abilities   []string  `json:"abilities"`
	Teams       []string  `json:"teams"`
	APIURL      string    `json:"-"`
	// contains filtered or unexported fields
}

type OAuth

type OAuth struct {
	APIURL      string
	OpenBrowser func(context.Context, string) error
	Writer      io.Writer
	NoBrowser   bool
}

func (OAuth) Login

func (o OAuth) Login(ctx context.Context, target string) (*Credential, error)

type SecretStore

type SecretStore interface {
	Get(key string) (keyring.Item, error)
	Set(item keyring.Item) error
	Remove(key string) error
}

type Store

type Store struct {
	Path string
	Open func() (SecretStore, error)
}

func DefaultStore

func DefaultStore() (Store, error)

func (Store) ActAsPath added in v0.11.818

func (s Store) ActAsPath() string

func (Store) ClearActAs added in v0.11.818

func (s Store) ClearActAs(ctx context.Context) (*ActAsSession, error)

ClearActAs removes the session file even when it is corrupt, returning an empty session in that case.

func (Store) Delete

func (s Store) Delete() error

func (Store) Load

func (s Store) Load() (*Credential, []byte, error)

func (Store) LoadActAs added in v0.11.818

func (s Store) LoadActAs() (*ActAsSession, []byte, error)

LoadActAs also returns the raw file so a later save can detect concurrent changes.

func (Store) LockActAs added in v0.11.818

func (s Store) LockActAs(ctx context.Context) (func(), error)

LockActAs serialises session changes across bruin processes; reads need no lock.

func (Store) Read

func (s Store) Read(apiURL string) (*Credential, error)

func (Store) Save

func (s Store) Save(credential Credential, expected []byte) error

func (Store) SaveActAs added in v0.11.818

func (s Store) SaveActAs(session ActAsSession, expected []byte) error

SaveActAs fails without writing if the file no longer matches expected.

Jump to

Keyboard shortcuts

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