workspace

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const PulumiBackendURLEnvVar = "PULUMI_BACKEND_URL"

PulumiBackendURLEnvVar is an environment variable which can be used to set the backend that will be used instead of the currently logged in backend or the current projects backend.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	workspace.Account

	// The URL of the account's backend.
	BackendURL string
	// The default org for the backend.
	DefaultOrg string
}

Account holds details about a Pulumi account.

type Credentials

type Credentials struct {
	Current string `json:"name"` // The account to use for login. Accounts are stored in Pulumi creds.
}

Credentials hold the information necessary for authenticating Pulumi Cloud API requests.

type FS

type FS interface {
	MkdirAll(path string, perm fs.FileMode) error

	LockedRead(name string) ([]byte, error)
	LockedWrite(name string, content io.Reader, perm os.FileMode) error
}

func DefaultFS

func DefaultFS() FS

type PulumiWorkspace

type PulumiWorkspace interface {
	DeleteAccount(backendURL string) error
	DeleteAllAccounts() error
	SetBackendConfigDefaultOrg(backendURL, defaultOrg string) error
	GetPulumiConfig() (workspace.PulumiConfig, error)
	GetPulumiPath(elem ...string) (string, error)
	GetStoredCredentials() (workspace.Credentials, error)
	StoreAccount(key string, account workspace.Account, current bool) error
	GetAccount(key string) (workspace.Account, error)
}

func DefaultPulumiWorkspace

func DefaultPulumiWorkspace() PulumiWorkspace

type Workspace

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

func New

func New(fs FS, pulumi PulumiWorkspace) *Workspace

func (*Workspace) DeleteAccount

func (w *Workspace) DeleteAccount(backendURL string) error

DeleteAccount logs out of the given backend. If the backend is the current account, then the current account is cleared.

func (*Workspace) DeleteAllAccounts

func (w *Workspace) DeleteAllAccounts() error

DeleteAllAccounts logs out of all accounts.

func (*Workspace) GetAccount

func (w *Workspace) GetAccount(backendURL string) (*Account, error)

GetAccount returns an account underneath a given key.

Note that the account may not be fully populated: it may only have a valid AccessToken. In that case, it is up to the caller to fill in the username and last validation time.

func (*Workspace) GetBackendConfigDefaultOrg

func (w *Workspace) GetBackendConfigDefaultOrg(backendURL, username string) (string, error)

func (*Workspace) GetCurrentAccount

func (w *Workspace) GetCurrentAccount(shared bool) (*Account, bool, error)

GetCurrentAccount returns information about the currently logged-in account.

func (*Workspace) GetCurrentCloudURL added in v0.8.3

func (w *Workspace) GetCurrentCloudURL(account *Account) string

func (*Workspace) SetBackendConfigDefaultOrg

func (w *Workspace) SetBackendConfigDefaultOrg(backendURL, defaultOrg string) error

func (*Workspace) SetCurrentAccount

func (w *Workspace) SetCurrentAccount(account Account, shared bool) error

SetCurrentAccount sets the currently logged-in account.

Jump to

Keyboard shortcuts

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