Documentation ¶
Index ¶
- Constants
- Variables
- func APIURL() string
- type API
- type APIOption
- type Border0API
- func (a *Border0API) AttachPolicies(ctx context.Context, socketID string, policyUUIDs []string) ([]string, error)
- func (a *Border0API) CreateConnector(ctx context.Context, name string, description string, ...) (*models.Connector, error)
- func (a *Border0API) CreateConnectorToken(ctx context.Context, connectorId string, name string, expiresAt *time.Time) (*models.ConnectorToken, error)
- func (a *Border0API) CreateConnectorWithInstallToken(ctx context.Context, name string, installToken string) (*models.ConnectorWithInstallTokenResponse, error)
- func (a *Border0API) CreatePlugin(ctx context.Context, connectorId string, enabled bool, pluginType string, ...) (*models.ConnectorPlugin, error)
- func (a *Border0API) CreateSocket(ctx context.Context, socket *models.Socket) (*models.Socket, error)
- func (a *Border0API) CreateToken(ctx context.Context, name string, role string, expiresAt *time.Time) (*models.Token, error)
- func (a *Border0API) CreateTunnel(ctx context.Context, socketID string) (*models.Tunnel, error)
- func (a *Border0API) DeleteSocket(ctx context.Context, socketID string) error
- func (a *Border0API) DetachPolicies(ctx context.Context, socketID string, policyUUIDs []string) ([]string, error)
- func (a *Border0API) Evaluate(ctx context.Context, socket *models.Socket, ...) (allowedActions []any, info map[string][]string, err error)
- func (a *Border0API) GetAccessToken() string
- func (a *Border0API) GetDefaultPluginConfiguration(ctx context.Context, pluginType string) (*connector.PluginConfiguration, error)
- func (a *Border0API) GetOrganizationInfo(ctx context.Context) (*models.Organization, error)
- func (a *Border0API) GetPoliciesBySocketID(socketID string) ([]models.Policy, error)
- func (a *Border0API) GetPolicyByName(ctx context.Context, name string) (*models.Policy, error)
- func (a *Border0API) GetSocket(ctx context.Context, socketID string) (*models.Socket, error)
- func (a *Border0API) GetSockets(ctx context.Context) ([]models.Socket, error)
- func (a *Border0API) GetTunnel(ctx context.Context, socketID string, tunnelID string) (*models.Tunnel, error)
- func (a *Border0API) GetUserID() (string, error)
- func (a *Border0API) ListConnectors(ctx context.Context) ([]models.Connector, error)
- func (a *Border0API) Login(email, password string) (*models.LoginResponse, error)
- func (a *Border0API) RefreshAccessToken() (*models.Credentials, error)
- func (a *Border0API) Request(method string, url string, target interface{}, data interface{}, ...) error
- func (a *Border0API) RequestAny(method string, url string, target interface{}, body *bytes.Buffer, ...) error
- func (a *Border0API) ServerOrgCertificate(ctx context.Context, name string, csr []byte) ([]byte, error)
- func (a *Border0API) SignSSHKey(ctx context.Context, socketID string, key []byte) (string, string, error)
- func (a *Border0API) SignSshOrgCertificate(ctx context.Context, socketID, sessionID, userEmail string, ...) ([]byte, error)
- func (a *Border0API) StartRefreshAccessTokenJob(ctx context.Context)
- func (a *Border0API) UpdateSession(update models.SessionUpdate) (err error)
- func (a *Border0API) UpdateSocket(ctx context.Context, socketID string, socket models.Socket) error
- func (a *Border0API) UploadRecording(content []byte, socketID, sessionKey, recordingID string) error
- func (a *Border0API) Whoami(ctx context.Context) (map[string]any, error)
- func (a *Border0API) With(opt APIOption) *Border0API
- type ErrorMessage
Constants ¶
View Source
const APIUrl = "https://api.border0.com/api/v1"
Variables ¶
View Source
var APIImpl = (*Border0API)(nil)
View Source
var ErrNotFound = errors.New("resource not found")
Functions ¶
Types ¶
type API ¶
type API interface { GetOrganizationInfo(ctx context.Context) (*models.Organization, error) GetSockets(ctx context.Context) ([]models.Socket, error) GetSocket(ctx context.Context, socketID string) (*models.Socket, error) GetTunnel(ctx context.Context, socketID string, tunnelID string) (*models.Tunnel, error) CreateTunnel(ctx context.Context, socketID string) (*models.Tunnel, error) CreateSocket(ctx context.Context, socket *models.Socket) (*models.Socket, error) UpdateSocket(ctx context.Context, socketID string, socket models.Socket) error DeleteSocket(ctx context.Context, socketID string) error Login(email, password string) (*models.LoginResponse, error) GetPolicyByName(ctx context.Context, name string) (*models.Policy, error) AttachPolicies(ctx context.Context, socketID string, policyUUIDs []string) ([]string, error) DetachPolicies(ctx context.Context, socketID string, policyUUIDs []string) ([]string, error) GetPoliciesBySocketID(socketID string) ([]models.Policy, error) StartRefreshAccessTokenJob(ctx context.Context) GetAccessToken() string SignSSHKey(ctx context.Context, socketID string, key []byte) (string, string, error) GetUserID() (string, error) Evaluate(ctx context.Context, socket *models.Socket, clientIP, userEmail, sessionKey string) (allowedActions []any, info map[string][]string, err error) UpdateSession(update models.SessionUpdate) error SignSshOrgCertificate(ctx context.Context, socketID, sessionID, userEmail string, ticket, publicKey []byte) ([]byte, error) UploadRecording(content []byte, socketID, sessionKey, recordingID string) error ServerOrgCertificate(ctx context.Context, name string, csr []byte) ([]byte, error) }
type APIOption ¶
type APIOption func(*Border0API)
func WithCredentials ¶
func WithCredentials(creds *models.Credentials) APIOption
func WithVersion ¶
type Border0API ¶
type Border0API struct { Credentials *models.Credentials Version string // contains filtered or unexported fields }
func NewAPI ¶
func NewAPI(opts ...APIOption) *Border0API
func (*Border0API) AttachPolicies ¶
func (*Border0API) CreateConnector ¶
func (a *Border0API) CreateConnector( ctx context.Context, name string, description string, enableBuiltInSshService bool, builtInSshServiceConfig *service.BuiltInSshServiceConfiguration, ) (*models.Connector, error)
CreateConnector creates a new border0 connector (v2)
func (*Border0API) CreateConnectorToken ¶
func (a *Border0API) CreateConnectorToken(ctx context.Context, connectorId string, name string, expiresAt *time.Time) (*models.ConnectorToken, error)
CreateConnectorToken creates a new border0 connector token
func (*Border0API) CreateConnectorWithInstallToken ¶
func (a *Border0API) CreateConnectorWithInstallToken( ctx context.Context, name string, installToken string, ) (*models.ConnectorWithInstallTokenResponse, error)
CreateConnectorWithInstallToken is a connector v2 method, it creates a new border0 connector and connector token from an install token (invite code)
func (*Border0API) CreatePlugin ¶
func (a *Border0API) CreatePlugin( ctx context.Context, connectorId string, enabled bool, pluginType string, pluginConfiguration *connector.PluginConfiguration, ) (*models.ConnectorPlugin, error)
CreatePlugin creates a new connector plugin.
func (*Border0API) CreateSocket ¶
func (*Border0API) CreateToken ¶
func (a *Border0API) CreateToken(ctx context.Context, name string, role string, expiresAt *time.Time) (*models.Token, error)
CreateToken creates a new border0 admin token (api key)
func (*Border0API) CreateTunnel ¶
func (*Border0API) DeleteSocket ¶
func (a *Border0API) DeleteSocket(ctx context.Context, socketID string) error
func (*Border0API) DetachPolicies ¶
func (*Border0API) GetAccessToken ¶
func (a *Border0API) GetAccessToken() string
func (*Border0API) GetDefaultPluginConfiguration ¶
func (a *Border0API) GetDefaultPluginConfiguration(ctx context.Context, pluginType string) (*connector.PluginConfiguration, error)
GetDefaultPluginConfiguration returns the default configuration for a given plugin type.
func (*Border0API) GetOrganizationInfo ¶
func (a *Border0API) GetOrganizationInfo(ctx context.Context) (*models.Organization, error)
func (*Border0API) GetPoliciesBySocketID ¶
func (a *Border0API) GetPoliciesBySocketID(socketID string) ([]models.Policy, error)
func (*Border0API) GetPolicyByName ¶
func (*Border0API) GetSockets ¶
func (*Border0API) GetUserID ¶
func (a *Border0API) GetUserID() (string, error)
func (*Border0API) ListConnectors ¶
ListConnectors lists an organization's connectors (v2)
func (*Border0API) Login ¶
func (a *Border0API) Login(email, password string) (*models.LoginResponse, error)
func (*Border0API) RefreshAccessToken ¶
func (a *Border0API) RefreshAccessToken() (*models.Credentials, error)
func (*Border0API) Request ¶
func (a *Border0API) Request(method string, url string, target interface{}, data interface{}, requireAccessToken bool) error
func (*Border0API) RequestAny ¶
func (*Border0API) ServerOrgCertificate ¶
func (*Border0API) SignSSHKey ¶
func (*Border0API) SignSshOrgCertificate ¶
func (*Border0API) StartRefreshAccessTokenJob ¶
func (a *Border0API) StartRefreshAccessTokenJob(ctx context.Context)
func (*Border0API) UpdateSession ¶
func (a *Border0API) UpdateSession(update models.SessionUpdate) (err error)
func (*Border0API) UpdateSocket ¶
func (*Border0API) UploadRecording ¶
func (a *Border0API) UploadRecording(content []byte, socketID, sessionKey, recordingID string) error
func (*Border0API) With ¶
func (a *Border0API) With(opt APIOption) *Border0API
type ErrorMessage ¶
type ErrorMessage struct {
ErrorMessage string `json:"error_message,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.