connect

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthRoleAdmin     = "administrator"
	AuthRolePublisher = "publisher"
	AuthRoleViewer    = "viewer"
)

Variables

View Source
var ErrTimedOut = errors.New("request timed out")

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	TestAuthentication(logging.Logger) (*User, error)
	CreateDeployment(*ConnectContent, logging.Logger) (types.ContentID, error)
	UpdateDeployment(types.ContentID, *ConnectContent, logging.Logger) error
	SetEnvVars(types.ContentID, config.Environment, logging.Logger) error
	UploadBundle(types.ContentID, io.Reader, logging.Logger) (types.BundleID, error)
	DeployBundle(types.ContentID, types.BundleID, logging.Logger) (types.TaskID, error)
	WaitForTask(taskID types.TaskID, log logging.Logger) error
	ValidateDeployment(types.ContentID, logging.Logger) error
	CheckCapabilities(util.AbsolutePath, *config.Config, logging.Logger) error
}

func NewConnectClient

func NewConnectClient(
	account *accounts.Account,
	timeout time.Duration,
	emitter events.Emitter,
	log logging.Logger) (APIClient, error)

type AppMode

type AppMode string
const (
	UnknownMode         AppMode = ""
	ShinyMode           AppMode = "shiny"
	ShinyRmdMode        AppMode = "rmd-shiny"
	StaticRmdMode       AppMode = "rmd-static"
	StaticMode          AppMode = "static"
	PlumberAPIMode      AppMode = "api"
	StaticJupyterMode   AppMode = "jupyter-static"
	PythonAPIMode       AppMode = "python-api"
	PythonDashMode      AppMode = "python-dash"
	PythonStreamlitMode AppMode = "python-streamlit"
	PythonBokehMode     AppMode = "python-bokeh"
	PythonFastAPIMode   AppMode = "python-fastapi"
	ShinyQuartoMode     AppMode = "quarto-shiny"
	StaticQuartoMode    AppMode = "quarto-static"
	PythonShinyMode     AppMode = "python-shiny"
	JupyterVoilaMode    AppMode = "jupyter-voila"
)

These values are the strings that will appear in manifest.json.

func AppModeFromString

func AppModeFromString(s string) (AppMode, error)

AppModeFromString return the normalized string value corresponding to the provided string. UnknownMode and an error are returned if the string does not map to a known content type.

func AppModeFromType

func AppModeFromType(t config.ContentType) AppMode

func (AppMode) Description

func (t AppMode) Description() string

func (AppMode) IsAPIApp

func (mode AppMode) IsAPIApp() bool

IsAPIApp returns true for any API apps (currently, Plumber, Flask, or FastAPI).

func (AppMode) IsBokehApp

func (t AppMode) IsBokehApp() bool

IsBokehApp returns true for Python Bokeh applications

func (AppMode) IsDashApp

func (t AppMode) IsDashApp() bool

IsDashApp returns true for Python Dash applications

func (AppMode) IsFastAPIApp

func (t AppMode) IsFastAPIApp() bool

IsFastAPIApp returns true for Python FastAPI applications

func (AppMode) IsPlumberAPI

func (mode AppMode) IsPlumberAPI() bool

IsPlumberAPI returns true for Plumber API applications.

func (AppMode) IsPyShinyApp

func (mode AppMode) IsPyShinyApp() bool

IsPyShinyApp returns true for Python Shiny applications

func (AppMode) IsPythonAPI

func (mode AppMode) IsPythonAPI() bool

IsPythonAPI returns true for Python API applications.

func (AppMode) IsPythonApp

func (mode AppMode) IsPythonApp() bool

IsPythonApp returns true for Python applications (Dash, Streamlit, Bokeh, Voila)

func (AppMode) IsPythonContent

func (t AppMode) IsPythonContent() bool

IsPythonContent returns true if Python is the primary interpreter for this content type.

func (AppMode) IsQuartoContent

func (t AppMode) IsQuartoContent() bool

IsQuartoContent return true if Quarto is the primary driver of this content type.

func (AppMode) IsRContent

func (t AppMode) IsRContent() bool

IsRContent returns true if R is the primary interpreter for this content type.

func (AppMode) IsShinyApp

func (t AppMode) IsShinyApp() bool

IsShinyApp returns true for Shiny applications and interactive R Markdown documents.

func (AppMode) IsStaticContent

func (t AppMode) IsStaticContent() bool

IsStaticContent returns true for any static content (deployed without source).

func (AppMode) IsStaticJupyter

func (t AppMode) IsStaticJupyter() bool

IsStaticJupyter returns true for any non-interactive Jupyter content.

func (AppMode) IsStaticReport

func (t AppMode) IsStaticReport() bool

IsStaticReport returns true for any non-interactive R or Jupyter content.

func (AppMode) IsStaticRmd

func (mode AppMode) IsStaticRmd() bool

IsStaticRmd returns true for any non-interactive R Markdown content.

func (AppMode) IsStreamlitApp

func (t AppMode) IsStreamlitApp() bool

IsStreamlitApp returns true for Python Streamlit applications

func (AppMode) IsVoilaApp

func (mode AppMode) IsVoilaApp() bool

IsVoilaApp returns true for Python Voila interactive notebooks

func (AppMode) IsWorkerApp

func (mode AppMode) IsWorkerApp() bool

IsWorkerApp returns true for any content that is serviced by worker processes. This includes Shiny applications, interactive R Markdown documents, Plumber/Python (flask/fastapi) APIs, and Python apps (Dash, Streamlit, Bokeh, PyShiny, Voila).

func (*AppMode) UnmarshalText

func (mode *AppMode) UnmarshalText(text []byte) error

type AppRole

type AppRole string
const (
	AppRoleOwner  AppRole = "owner"
	AppRoleEditor AppRole = "editor"
	AppRoleViewer AppRole = "viewer"
	AppRoleNone   AppRole = "none"
)

func AppRoleFromString

func AppRoleFromString(s string) (AppRole, error)

type ConnectClient

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

func (*ConnectClient) CheckCapabilities

func (c *ConnectClient) CheckCapabilities(base util.AbsolutePath, cfg *config.Config, log logging.Logger) error

func (*ConnectClient) CreateDeployment

func (c *ConnectClient) CreateDeployment(body *ConnectContent, log logging.Logger) (types.ContentID, error)

func (*ConnectClient) DeployBundle

func (c *ConnectClient) DeployBundle(contentId types.ContentID, bundleId types.BundleID, log logging.Logger) (types.TaskID, error)

func (*ConnectClient) SetEnvVars

func (c *ConnectClient) SetEnvVars(contentID types.ContentID, env config.Environment, log logging.Logger) error

func (*ConnectClient) TestAuthentication

func (c *ConnectClient) TestAuthentication(log logging.Logger) (*User, error)

func (*ConnectClient) UpdateDeployment

func (c *ConnectClient) UpdateDeployment(contentID types.ContentID, body *ConnectContent, log logging.Logger) error

func (*ConnectClient) UploadBundle

func (c *ConnectClient) UploadBundle(contentID types.ContentID, body io.Reader, log logging.Logger) (types.BundleID, error)

func (*ConnectClient) ValidateDeployment

func (c *ConnectClient) ValidateDeployment(contentID types.ContentID, log logging.Logger) error

func (*ConnectClient) WaitForTask

func (c *ConnectClient) WaitForTask(taskID types.TaskID, log logging.Logger) error

type ConnectContent

type ConnectContent struct {
	Name                           types.ContentName `json:"name"`
	Title                          string            `json:"title,omitempty"`
	Description                    string            `json:"description,omitempty"`
	AccessType                     string            `json:"access_type,omitempty"`
	ConnectionTimeout              *int32            `json:"connection_timeout,omitempty"`
	ReadTimeout                    *int32            `json:"read_timeout,omitempty"`
	InitTimeout                    *int32            `json:"init_timeout,omitempty"`
	IdleTimeout                    *int32            `json:"idle_timeout,omitempty"`
	MaxProcesses                   *int32            `json:"max_processes,omitempty"`
	MinProcesses                   *int32            `json:"min_processes,omitempty"`
	MaxConnsPerProcess             *int32            `json:"max_conns_per_process,omitempty"`
	LoadFactor                     *float64          `json:"load_factor,omitempty"`
	RunAs                          string            `json:"run_as,omitempty"`
	RunAsCurrentUser               *bool             `json:"run_as_current_user,omitempty"`
	MemoryRequest                  *int64            `json:"memory_request,omitempty"`
	MemoryLimit                    *int64            `json:"memory_limit,omitempty"`
	CPURequest                     *float64          `json:"cpu_request,omitempty"`
	CPULimit                       *float64          `json:"cpu_limit,omitempty"`
	AMDGPULimit                    *int64            `json:"amd_gpu_limit,omitempty"`
	NvidiaGPULimit                 *int64            `json:"nvidia_gpu_limit,omitempty"`
	ServiceAccountName             string            `json:"service_account_name,omitempty"`
	DefaultImageName               string            `json:"default_image_name,omitempty"`
	DefaultREnvironmentManagement  *bool             `json:"default_r_environment_management,omitempty"`
	DefaultPyEnvironmentManagement *bool             `json:"default_py_environment_management,omitempty"`
}

func ConnectContentFromConfig

func ConnectContentFromConfig(cfg *config.Config) *ConnectContent

type MockClient

type MockClient struct {
	mock.Mock
}

func NewMockClient

func NewMockClient() *MockClient

func (*MockClient) CheckCapabilities

func (m *MockClient) CheckCapabilities(base util.AbsolutePath, cfg *config.Config, log logging.Logger) error

func (*MockClient) CreateDeployment

func (m *MockClient) CreateDeployment(s *ConnectContent, log logging.Logger) (types.ContentID, error)

func (*MockClient) DeployBundle

func (m *MockClient) DeployBundle(cid types.ContentID, bid types.BundleID, log logging.Logger) (types.TaskID, error)

func (*MockClient) Read

func (m *MockClient) Read(p []byte) (n int, err error)

func (*MockClient) SetEnvVars

func (m *MockClient) SetEnvVars(id types.ContentID, env config.Environment, log logging.Logger) error

func (*MockClient) TestAuthentication

func (m *MockClient) TestAuthentication(log logging.Logger) (*User, error)

func (*MockClient) UpdateDeployment

func (m *MockClient) UpdateDeployment(id types.ContentID, s *ConnectContent, log logging.Logger) error

func (*MockClient) UploadBundle

func (m *MockClient) UploadBundle(id types.ContentID, r io.Reader, log logging.Logger) (types.BundleID, error)

func (*MockClient) ValidateDeployment

func (m *MockClient) ValidateDeployment(id types.ContentID, log logging.Logger) error

func (*MockClient) WaitForTask

func (m *MockClient) WaitForTask(taskID types.TaskID, log logging.Logger) error

type User

type User struct {
	Id        types.UserID `json:"id"`
	Username  string       `json:"username"`
	FirstName string       `json:"first_name"`
	LastName  string       `json:"last_name"`
	Email     string       `json:"email"`
}

Simplified user structure common to all servers

type UserDTO

type UserDTO struct {
	Email       string         `json:"email"`
	Username    string         `json:"username"`
	FirstName   string         `json:"first_name"`
	LastName    string         `json:"last_name"`
	UserRole    string         `json:"user_role"`
	CreatedTime types.Time     `json:"created_time"`
	UpdatedTime types.Time     `json:"updated_time"`
	ActiveTime  types.NullTime `json:"active_time"`
	Confirmed   bool           `json:"confirmed"`
	Locked      bool           `json:"locked"`
	GUID        types.UserID   `json:"guid"`
}

func (*UserDTO) CanAdmin

func (u *UserDTO) CanAdmin() bool

func (*UserDTO) CanPublish

func (u *UserDTO) CanPublish() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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