Documentation ¶
Index ¶
- Constants
- Variables
- func CheckLiveness() error
- func NewAuditContext(orgID, eventName, userEmail string) *auditContext
- func Run() (err error)
- func WithBaseURL(newBaseURL *url.URL)
- func WithHttpClient(newClient HTTPClient)
- type Agent
- type AppState
- type AppStateRollout
- type AuditContext
- type Blob
- type Client
- func (c *Client) Create(reqBody any) *Response
- func (c *Client) Delete() *Response
- func (c *Client) ExactCount() int64
- func (c *Client) FetchAll() *Response
- func (c *Client) FetchOne() *Response
- func (c *Client) List() *Response
- func (c *Client) Patch(reqBody any) *Response
- func (c *Client) RpcCreate(reqBody any) *Response
- func (c *Client) Update(reqBody any) *Response
- func (c *Client) Upsert(reqBody any) *Response
- type Connection
- type Context
- type EnvVar
- type HTTPClient
- type LicenseContext
- type Login
- type Org
- type OrgContext
- type Plugin
- type PluginConnection
- type ProxyManagerState
- type Response
- type ServiceAccount
- type Session
- type SessionList
- type SessionOption
- type SessionOptionKey
- type SessionReport
- type SessionReportItem
- type User
- type UserContext
Constants ¶
View Source
const ( AgentStatusConnected = "CONNECTED" AgentStatusDisconnected = "DISCONNECTED" )
View Source
const ( ConnectionStatusOnline = "online" ConnectionStatusOffline = "offline" )
View Source
const ( DefaultLimit int = 100 DefaultOffset int = 0 )
Variables ¶
View Source
var ( ErrNotFound = fmt.Errorf("resource not found") ErrEmptyResponse = fmt.Errorf("empty response") )
View Source
var EmptyContext = NewOrgContext("")
Functions ¶
func CheckLiveness ¶
func CheckLiveness() error
CheckLiveness validates if the postgrest process is running by checking if the port is open and responding.
func NewAuditContext ¶
func NewAuditContext(orgID, eventName, userEmail string) *auditContext
func Run ¶
func Run() (err error)
Run performs the initalization and necessary migrations to start the postgrest process. This function will take care of managing the process lifecycle of postgrest.
func WithBaseURL ¶
func WithHttpClient ¶
func WithHttpClient(newClient HTTPClient)
Types ¶
type Agent ¶
type Agent struct { ID string `json:"id"` OrgID string `json:"org_id"` Name string `json:"name"` Mode string `json:"mode"` Key string `json:"key"` KeyHash string `json:"key_hash"` Status string `json:"status"` Metadata map[string]string `json:"metadata"` UpdatedAt *string `json:"updated_at"` Org Org `json:"orgs"` }
type AppStateRollout ¶
func (*AppStateRollout) GetAppState ¶
func (s *AppStateRollout) GetAppState(checksum string) (bool, *AppState)
func (*AppStateRollout) ShouldRollout ¶
func (s *AppStateRollout) ShouldRollout(checksum string) bool
type AuditContext ¶
type AuditContext interface { OrgContext GetEventName() string GetUserEmail() string GetMetadata() map[string]any }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ExactCount ¶
ExactCount returns the total of records in the table, in case of error it returns -1
type Connection ¶
type Connection struct { ID string `json:"id"` OrgID string `json:"org_id"` AgentID string `json:"agent_id"` Name string `json:"name"` Command []string `json:"command"` Type string `json:"type"` SubType string `json:"subtype"` Envs map[string]string `json:"envs"` Status string `json:"status"` // read only field ManagedBy *string `json:"managed_by"` Tags []string `json:"tags"` AccessModeRunbooks string `json:"access_mode_runbooks"` AccessModeExec string `json:"access_mode_exec"` AccessModeConnect string `json:"access_mode_connect"` AccessSchema string `json:"access_schema"` // read only attributes Org Org `json:"orgs"` PluginConnection []PluginConnection `json:"plugin_connections"` Agent Agent `json:"agents"` }
func (Connection) AsSecrets ¶
func (c Connection) AsSecrets() map[string]any
type Context ¶
type Context interface { OrgContext IsAdmin() bool GetUserGroups() []string }
type HTTPClient ¶
HTTPClient is an interface for testing a request object.
type LicenseContext ¶
type LicenseContext interface { OrgContext GetLicenseName() string }
type Org ¶
type Org struct { ID string `json:"id"` Name string `json:"name"` License string `json:"license"` LicenseData *json.RawMessage `json:"license_data"` }
type OrgContext ¶
type OrgContext interface {
GetOrgID() string
}
func NewOrgContext ¶
func NewOrgContext(orgID string) OrgContext
type PluginConnection ¶
type PluginConnection struct { ID string `json:"id"` OrgID string `json:"org_id"` PluginID string `json:"plugin_id"` ConnectionID string `json:"connection_id"` Enabled bool `json:"enabled"` ConnectionConfig []string `json:"config"` Plugin Plugin `json:"plugins"` EnvVar EnvVar `json:"env_vars"` Connection Connection `json:"connections"` }
type ProxyManagerState ¶
type ProxyManagerState struct { ID string `json:"id"` OrgID string `json:"org_id"` Status string `json:"status"` Connection string `json:"connection"` Port string `json:"port"` AccessDuration int `json:"access_duration"` ClientMetadata map[string]string `json:"metadata"` ConnectedAt string `json:"connected_at"` }
func (*ProxyManagerState) GetConnectedAt ¶
func (s *ProxyManagerState) GetConnectedAt() (t time.Time)
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func (*Response) DecodeInto ¶
DecodeInto will copy the bytes of the response if obj is []byte or unmarshal it to json
type ServiceAccount ¶
type Session ¶
type Session struct { ID string `json:"id"` OrgID string `json:"org_id"` Labels map[string]string `json:"labels"` Connection string `json:"connection"` ConnectionType string `json:"connection_type"` Verb string `json:"verb"` UserID string `json:"user_id"` UserName string `json:"user_name"` UserEmail string `json:"user_email"` Status string `json:"status"` JiraIssue string `json:"jira_issue"` BlobInputID string `json:"blob_input_id"` BlobStreamID string `json:"blob_stream_id"` BlobInput *Blob `json:"blob_input"` BlobStream *Blob `json:"blob_stream"` Metadata map[string]any `json:"metadata"` Metrics map[string]any `json:"metrics"` // TODO: convert to time.Time CreatedAt string `json:"created_at"` EndedAt *string `json:"ended_at"` }
func (*Session) GetBlobInput ¶
func (*Session) GetBlobStream ¶
func (s *Session) GetBlobStream() (events []types.SessionEventStream, size int64)
func (*Session) GetCreatedAt ¶
TODO: add a custom json decoder to handle time.Time
func (*Session) GetEndedAt ¶
TODO: add a custom json decoder to handle time.Time
func (*Session) GetRedactCount ¶
type SessionList ¶
type SessionOption ¶
type SessionOption struct { OptionKey SessionOptionKey OptionVal any }
type SessionOptionKey ¶
type SessionOptionKey string
const ( OptionUser SessionOptionKey = "user" OptionType SessionOptionKey = "type" OptionConnection SessionOptionKey = "connection" OptionStartDate SessionOptionKey = "start_date" OptionEndDate SessionOptionKey = "end_date" OptionOffset SessionOptionKey = "offset" OptionLimit SessionOptionKey = "limit" )
type SessionReport ¶
type SessionReport struct { Items []SessionReportItem `json:"items"` TotalRedactCount int64 `json:"total_redact_count"` TotalTransformedBytes int64 `json:"total_transformed_bytes"` }
type SessionReportItem ¶
type User ¶
type User struct { ID string `json:"id"` OrgID string `json:"org_id"` Subject string `json:"subject"` Name string `json:"name"` Picture string `json:"picture"` Email string `json:"email"` Verified bool `json:"verified"` Status string `json:"status"` SlackID string `json:"slack_id"` Groups []string `json:"groups"` Org *Org `json:"orgs"` // used for local auth only HashedPassword string `json:"hashed_password"` }
type UserContext ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.