accounts

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 9 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

Types

type Account

type Account struct {
	ServerType  ServerType      `json:"type"`         // Which type of API this server provides
	Source      AccountSource   `json:"source"`       // Source of the saved server configuration
	AuthType    AccountAuthType `json:"auth_type"`    // Authentication method (API key, token, etc)
	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
}

func (*Account) InferAuthType

func (acct *Account) InferAuthType() AccountAuthType

type AccountAuthType

type AccountAuthType string
const (
	AuthTypeNone   AccountAuthType = "none"    // No saved credentials
	AuthTypeAPIKey AccountAuthType = "api-key" // Connect API key
)

func (AccountAuthType) Description

func (auth AccountAuthType) Description() string

type AccountList

type AccountList interface {
	GetAllAccounts() ([]Account, error)
	GetAccountByName(name string) (*Account, error)
	GetAccountsByServerType(_ 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"
	AccountSourceEnvironment     AccountSource = "environment"
	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() *CredentialsProvider

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 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)

type ServerType

type ServerType string
const (
	ServerTypeConnect     ServerType = "connect"
	ServerTypeShinyappsIO ServerType = "shinyapps"
	ServerTypeCloud       ServerType = "cloud"
)

func (ServerType) Description

func (t ServerType) Description() string

Jump to

Keyboard shortcuts

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