accounts

package
v1.23.16 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccountNotFound = errors.New("no such account")

Functions

func NewAccountList

func NewAccountList(fs afero.Fs, log logging.Logger) (*defaultAccountList, error)

Types

type Account

type Account struct {
	ServerType          server_type.ServerType `json:"type"`               // Which type of API this server provides
	Source              AccountSource          `json:"source"`             // Source of the saved server configuration
	Name                string                 `json:"name"`               // Nickname
	URL                 string                 `json:"url"`                // Server URL, e.g. https://connect.example.com/rsc
	Insecure            bool                   `json:"insecure"`           // Skip https server verification
	Certificate         string                 `json:"-"`                  // Root CA certificate, if server cert is signed by a private CA
	AccountName         string                 `json:"account_name"`       // Username, if known
	ApiKey              string                 `json:"-"`                  // For Connect servers
	SnowflakeConnection string                 `json:"-"`                  // Snowflake connection name used instead of API Key in SPCS
	CloudEnvironment    types.CloudEnvironment `json:"cloud_environment"`  // Environment for Connect Cloud (production, staging, development)
	CloudAccountID      string                 `json:"cloud_account_id"`   // Account ID for Connect Cloud
	CloudAccountName    string                 `json:"cloud_account_name"` // Account name for Connect Cloud
	CloudAccessToken    types.CloudAuthToken   `json:"-"`                  // Access token for OAuth authentication
	CloudRefreshToken   string                 `json:"-"`                  // Refresh token for OAuth authentication
	Token               string                 `json:"-"`                  // Token ID for token-based authentication
	PrivateKey          string                 `json:"-"`                  // Base64-encoded private key for signing requests
}

func (*Account) AuthType

func (acct *Account) AuthType() AccountAuthType

AuthType returns the detected AccountAuthType based on the properties of the Account.

func (*Account) HasCredential added in v1.16.0

func (acct *Account) HasCredential() bool

HasCredential returns true if the Account is configured with valid credentials for authentication.

type AccountAuthType

type AccountAuthType string
const (
	AuthTypeNone      AccountAuthType = "none"    // No saved credentials
	AuthTypeAPIKey    AccountAuthType = "api-key" // Connect API key
	AuthTypeSnowflake AccountAuthType = "snowflake"
	AuthTypeToken     AccountAuthType = "token" // Token-based authentication with RSA key pair
)

func (AccountAuthType) Description

func (auth AccountAuthType) Description() string

type AccountList

type AccountList interface {
	GetAllAccounts() ([]Account, error)
	GetAccountByName(name string) (*Account, error)
	GetAccountsByServerType(_ server_type.ServerType) ([]Account, error)
	GetAccountByServerURL(url string) (*Account, error)
}

type AccountProvider

type AccountProvider interface {
	Load() ([]Account, error)
}

type AccountSource

type AccountSource string
const (
	AccountSourceRsconnectPython AccountSource = "rsconnect-python"
	AccountSourceRsconnect       AccountSource = "rsconnect"
	AccountSourceKeychain        AccountSource = "keychain"
)

func (AccountSource) Description

func (source AccountSource) Description() string

type CredentialsProvider

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

func NewCredentialsProvider

func NewCredentialsProvider(log logging.Logger) (*CredentialsProvider, error)

func (*CredentialsProvider) Load

func (p *CredentialsProvider) Load() ([]Account, error)

type MockAccountList

type MockAccountList struct {
	mock.Mock
	AccountList
}

func NewMockAccountList

func NewMockAccountList() *MockAccountList

func (*MockAccountList) GetAccountByName

func (m *MockAccountList) GetAccountByName(name string) (*Account, error)

func (*MockAccountList) GetAccountByServerURL

func (m *MockAccountList) GetAccountByServerURL(url string) (*Account, error)

func (*MockAccountList) GetAccountsByServerType

func (m *MockAccountList) GetAccountsByServerType(serverType server_type.ServerType) ([]Account, error)

func (*MockAccountList) GetAllAccounts

func (m *MockAccountList) GetAllAccounts() ([]Account, error)

type MockAccountProvider

type MockAccountProvider struct {
	mock.Mock
}

func (*MockAccountProvider) Load

func (m *MockAccountProvider) Load() ([]Account, error)

Jump to

Keyboard shortcuts

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