api

package
v1.23.9 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const APIPrefix string = "api"
View Source
const DefaultTimeout = 30 * time.Second

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, req *http.Request, log logging.Logger, err error)

func DeleteConfigurationHandlerFunc

func DeleteConfigurationHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func DeleteCredentialHandlerFunc

func DeleteCredentialHandlerFunc(log logging.Logger) http.HandlerFunc

func DeleteDeploymentHandlerFunc

func DeleteDeploymentHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func DeleteIntegrationRequestFuncHandler added in v1.22.0

func DeleteIntegrationRequestFuncHandler(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetAccountHandlerFunc

func GetAccountHandlerFunc(lister accounts.AccountList, log logging.Logger) http.HandlerFunc

GetAccountHandlerFunc returns a handler for the Get Account (by name) endpoint.

func GetAccountsHandlerFunc

func GetAccountsHandlerFunc(lister accounts.AccountList, log logging.Logger) http.HandlerFunc

GetAccountsHandlerFunc returns a handler for the account list.

func GetActiveInterpretersHandlerFunc added in v1.12.0

func GetActiveInterpretersHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetConfigFilesHandlerFunc

func GetConfigFilesHandlerFunc(base util.AbsolutePath, filesService files.FilesService, log logging.Logger) http.HandlerFunc

func GetConfigSecretsHandlerFunc added in v1.1.7

func GetConfigSecretsHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetConfigurationHandlerFunc

func GetConfigurationHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetConfigurationsHandlerFunc

func GetConfigurationsHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetConnectCloudAccountsFunc added in v1.18.1

func GetConnectCloudAccountsFunc(log logging.Logger) http.HandlerFunc

func GetCredentialHandlerFunc

func GetCredentialHandlerFunc(log logging.Logger) http.HandlerFunc

func GetCredentialsHandlerFunc

func GetCredentialsHandlerFunc(log logging.Logger, credserviceFactory credentials.CredServiceFactory) http.HandlerFunc

func GetDeploymentEnvironmentHandlerFunc added in v1.4.0

func GetDeploymentEnvironmentHandlerFunc(base util.AbsolutePath, log logging.Logger, accountList accounts.AccountList) http.HandlerFunc

func GetDeploymentHandlerFunc

func GetDeploymentHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetDeploymentsHandlerFunc

func GetDeploymentsHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetEntrypointsHandlerFunc added in v1.1.5

func GetEntrypointsHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetFileHandlerFunc

func GetFileHandlerFunc(base util.AbsolutePath, filesService files.FilesService, pathsService paths.PathsService, log logging.Logger) http.HandlerFunc

func GetIntegrationRequestsFuncHandler added in v1.22.0

func GetIntegrationRequestsFuncHandler(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func GetIntegrationsHandlerFunc added in v1.22.0

func GetIntegrationsHandlerFunc(lister accounts.AccountList, log logging.Logger) http.HandlerFunc

func GetServerSettingsHandlerFunc added in v1.22.0

func GetServerSettingsHandlerFunc(lister accounts.AccountList, log logging.Logger) http.HandlerFunc

func GetSnowflakeConnectionsHandlerFunc added in v1.16.0

func GetSnowflakeConnectionsHandlerFunc(log logging.Logger, connections snowflake.Connections) http.HandlerFunc

GetSnowflakeConnectionsHandlerFunc responds with a list of Snowflake connections, derived from configuration files and environment variables, that can successfully authenticate to `serverUrl`.

A connection includes a name and a validated server URL.

func InternalError

func InternalError(w http.ResponseWriter, req *http.Request, log logging.Logger, err error)

func InterpretersFromRequest added in v1.12.0

func JsonResult added in v1.1.7

func JsonResult(w http.ResponseWriter, status int, result any)

func NewGetConfigPythonPackagesHandler

func NewGetConfigPythonPackagesHandler(base util.AbsolutePath, log logging.Logger) *getConfigPythonPackagesHandler

func NewGetConfigRPackagesHandler

func NewGetConfigRPackagesHandler(base util.AbsolutePath, log logging.Logger) *getConfigRPackagesHandler

func NotFound

func NotFound(w http.ResponseWriter, log logging.Logger, err error)

func PatchDeploymentHandlerFunc

func PatchDeploymentHandlerFunc(
	base util.AbsolutePath,
	log logging.Logger) http.HandlerFunc

func PostAccountVerifyHandlerFunc

func PostAccountVerifyHandlerFunc(lister accounts.AccountList, log logging.Logger) http.HandlerFunc

func PostConfigFilesHandlerFunc

func PostConfigFilesHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func PostConfigSecretsHandlerFunc added in v1.1.7

func PostConfigSecretsHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func PostConnectCloudDeviceAuthHandlerFunc added in v1.18.1

func PostConnectCloudDeviceAuthHandlerFunc(log logging.Logger) http.HandlerFunc

func PostConnectCloudOAuthTokenHandlerFunc added in v1.18.1

func PostConnectCloudOAuthTokenHandlerFunc(log logging.Logger) http.HandlerFunc

func PostConnectTokenHandlerFunc added in v1.19.0

func PostConnectTokenHandlerFunc(log logging.Logger) http.HandlerFunc

PostConnectTokenHandlerFunc creates a handler for the POST /api/connect/token endpoint This endpoint generates a new token for Connect authentication and returns the token along with a claim URL for browser-based authentication

func PostConnectTokenUserHandlerFunc added in v1.19.0

func PostConnectTokenUserHandlerFunc(log logging.Logger) http.HandlerFunc

PostConnectTokenUserHandlerFunc creates a handler for the POST /api/connect/token/user endpoint This endpoint checks if a token has been claimed and returns the user information

func PostCredentialFuncHandler

func PostCredentialFuncHandler(log logging.Logger) http.HandlerFunc

func PostDeploymentCancelHandlerFunc added in v1.10.0

func PostDeploymentCancelHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func PostDeploymentHandlerFunc

func PostDeploymentHandlerFunc(
	base util.AbsolutePath,
	log logging.Logger,
	accountList accounts.AccountList,
	emitter events.Emitter) http.HandlerFunc

func PostDeploymentsHandlerFunc

func PostDeploymentsHandlerFunc(
	base util.AbsolutePath,
	log logging.Logger,
	accountList accounts.AccountList) http.HandlerFunc

func PostInspectHandlerFunc

func PostInspectHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func PostIntegrationRequestFuncHandler added in v1.22.0

func PostIntegrationRequestFuncHandler(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func PostTestCredentialsHandlerFunc

func PostTestCredentialsHandlerFunc(log logging.Logger) http.HandlerFunc

func ProjectDirFromRequest

func ProjectDirFromRequest(base util.AbsolutePath, w http.ResponseWriter, req *http.Request, log logging.Logger) (util.AbsolutePath, util.RelativePath, error)

ProjectDirFromRequest returns the project directory from the request query parameter "dir". If the directory does not exist, it returns a 404. If the directory is not a subdirectory of the base directory, it returns a 400. Other errors return a 500.

func PutConfigurationHandlerFunc

func PutConfigurationHandlerFunc(base util.AbsolutePath, log logging.Logger) http.HandlerFunc

func ResetCredentialsHandlerFunc added in v1.8.0

func ResetCredentialsHandlerFunc(log logging.Logger, credserviceFactory credentials.CredServiceFactory) http.HandlerFunc

func RouterHandlerFunc

func RouterHandlerFunc(base util.AbsolutePath, lister accounts.AccountList, log logging.Logger, eventServer *sse.Server, emitter events.Emitter) http.HandlerFunc

func ToPath

func ToPath(elements ...string) string

Types

type DeleteIntegrationRequestRequest added in v1.22.0

type DeleteIntegrationRequestRequest = config.IntegrationRequest

type GetIntegrationRequestsResponse added in v1.22.0

type GetIntegrationRequestsResponse = config.IntegrationRequest

type MockFilesService

type MockFilesService struct {
	mock.Mock
	files.FilesService
}

func (*MockFilesService) GetFile

func (m *MockFilesService) GetFile(p util.AbsolutePath, matchList matcher.MatchList) (*files.File, error)

type MockPathsService

type MockPathsService struct {
	mock.Mock
	paths.PathsService
}

func (*MockPathsService) IsSafe

func (m *MockPathsService) IsSafe(p util.AbsolutePath) (bool, error)

type PatchDeploymentRequestBody

type PatchDeploymentRequestBody struct {
	ConfigName string          `json:"configurationName"`
	ID         types.ContentID `json:"id"`
}

type PostAccountVerifyResponse

type PostAccountVerifyResponse struct {
	*connect.User
	Error string `json:"error"`
}

type PostConnectTokenRequest added in v1.19.0

type PostConnectTokenRequest struct {
	ServerURL string `json:"serverUrl"`
}

type PostConnectTokenResponse added in v1.19.0

type PostConnectTokenResponse struct {
	Token     string `json:"token"`
	ClaimURL  string `json:"claimUrl"`
	PublicKey string `json:"publicKey,omitempty"`
	// PrivateKey is only returned to the client and never sent to the server
	PrivateKey string `json:"privateKey"`
}

type PostCredentialsRequest

type PostCredentialsRequest struct {
	Name       string                 `json:"name"`
	URL        string                 `json:"url"`
	ServerType server_type.ServerType `json:"serverType"`

	// Connect fields
	ApiKey string `json:"apiKey"`

	// Snowflake fields
	SnowflakeConnection string `json:"snowflakeConnection"`

	// Connect Cloud fields
	AccountID    string               `json:"accountId"`
	AccountName  string               `json:"accountName"`
	RefreshToken string               `json:"refreshToken"`
	AccessToken  types.CloudAuthToken `json:"accessToken"`

	// Token authentication fields
	Token      string `json:"token"`
	PrivateKey string `json:"privateKey"`
}

type PostCredentialsResponse

type PostCredentialsResponse = credentials.Credential

type PostDeploymentRequestBody

type PostDeploymentRequestBody struct {
	AccountName string            `json:"account"`
	ConfigName  string            `json:"config"`
	Secrets     map[string]string `json:"secrets,omitempty"`
	Insecure    bool              `json:"insecure"`
	R           string            `json:"r"`
	Python      string            `json:"python"`
	Positron    *positronSettings `json:"positron,omitempty"`
}

type PostDeploymentsReponse

type PostDeploymentsReponse struct {
	LocalID state.LocalDeploymentID `json:"localId"` // Unique ID of this publishing operation. Only valid for this run of the agent.
}

type PostDeploymentsRequestBody

type PostDeploymentsRequestBody struct {
	AccountName string          `json:"account"`
	ConfigName  string          `json:"config"`
	SaveName    string          `json:"saveName"`
	ID          types.ContentID `json:"id"`
}

type PostIntegrationRequestRequest added in v1.22.0

type PostIntegrationRequestRequest = config.IntegrationRequest

type PostIntegrationRequestResponse added in v1.22.0

type PostIntegrationRequestResponse = config.IntegrationRequest

type PostPackagesPythonScanHandler

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

func NewPostPackagesPythonScanHandler

func NewPostPackagesPythonScanHandler(base util.AbsolutePath, log logging.Logger) *PostPackagesPythonScanHandler

func (*PostPackagesPythonScanHandler) ServeHTTP

type PostPackagesPythonScanRequest

type PostPackagesPythonScanRequest struct {
	SaveName string `json:"saveName"`
}

type PostPackagesPythonScanResponse added in v1.1.6

type PostPackagesPythonScanResponse struct {
	Python       string   `json:"python"`
	Requirements []string `json:"requirements"`
	Incomplete   []string `json:"incomplete"`
}

type PostPackagesRScanHandler

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

func NewPostPackagesRScanHandler

func NewPostPackagesRScanHandler(
	base util.AbsolutePath,
	log logging.Logger,
) *PostPackagesRScanHandler

func (*PostPackagesRScanHandler) ServeHTTP

type PostPackagesRScanRequest

type PostPackagesRScanRequest struct {
	R        string            `json:"r"`
	SaveName string            `json:"saveName"`
	Positron *positronSettings `json:"positron,omitempty"`
}

type PostTestCredentialsRequestBody

type PostTestCredentialsRequestBody struct {
	URL      string  `json:"url"`
	ApiKey   string  `json:"apiKey"`
	Insecure bool    `json:"insecure"`
	Timeout  float32 `json:"timeout"`
}

type PostTestCredentialsResponseBody

type PostTestCredentialsResponseBody struct {
	User *connect.User `json:"user"`
	URL  string        `json:"url"`

	ServerType server_type.ServerType `json:"serverType"`

	Error *types.AgentError `json:"error"`
}

type Service

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

func NewService

func NewService(
	fragment string,
	listen string,
	accessLog bool,
	dir util.AbsolutePath,
	lister accounts.AccountList,
	log logging.Logger,
	eventServer *sse.Server,
	emitter events.Emitter) *Service

func (*Service) Run

func (svc *Service) Run() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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