api

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntegrationRequest

type IntegrationRequest struct {
	Name string `json:"name"`
	Type string `json:"type"`

	GitHubAppID          int64  `json:"github_app_id,omitempty"`
	GitHubInstallationID int64  `json:"github_installation_id,omitempty"`
	GitHubPrivateKeyPath string `json:"github_private_key_path,omitempty"`
	GitHubPrivateKeyEnv  string `json:"github_private_key_env,omitempty"`
	GitHubAPIBaseURL     string `json:"github_api_base_url,omitempty"`

	SSHKeyPath               string `json:"ssh_key_path,omitempty"`
	SSHKeyEnv                string `json:"ssh_key_env,omitempty"`
	SSHKeyPassphraseEnv      string `json:"ssh_key_passphrase_env,omitempty"`
	SSHKnownHostsPath        string `json:"ssh_known_hosts_path,omitempty"`
	SSHInsecureIgnoreHostKey bool   `json:"ssh_insecure_ignore_host_key,omitempty"`

	HTTPSUsername string `json:"https_username,omitempty"`
	HTTPSTokenEnv string `json:"https_token_env,omitempty"`
}

IntegrationRequest is the JSON request body for creating/updating an integration.

type IntegrationResponse

type IntegrationResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`

	GitHubAppID          int64  `json:"github_app_id,omitempty"`
	GitHubInstallationID int64  `json:"github_installation_id,omitempty"`
	GitHubPrivateKeyPath string `json:"github_private_key_path,omitempty"`
	GitHubPrivateKeyEnv  string `json:"github_private_key_env,omitempty"`
	GitHubAPIBaseURL     string `json:"github_api_base_url,omitempty"`

	SSHKeyPath               string `json:"ssh_key_path,omitempty"`
	SSHKeyEnv                string `json:"ssh_key_env,omitempty"`
	SSHKeyPassphraseEnv      string `json:"ssh_key_passphrase_env,omitempty"`
	SSHKnownHostsPath        string `json:"ssh_known_hosts_path,omitempty"`
	SSHInsecureIgnoreHostKey bool   `json:"ssh_insecure_ignore_host_key,omitempty"`

	HTTPSUsername string `json:"https_username,omitempty"`
	HTTPSTokenEnv string `json:"https_token_env,omitempty"`

	Source    string `json:"source"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

IntegrationResponse is the JSON response for an integration.

type ProjectRequest

type ProjectRequest struct {
	Name                       string   `json:"name"`
	URL                        string   `json:"url"`
	Branch                     *string  `json:"branch,omitempty"`
	IgnorePaths                []string `json:"ignore_paths,omitempty"`
	Schedule                   *string  `json:"schedule,omitempty"`
	CancelInflightOnNewTrigger *bool    `json:"cancel_inflight_on_new_trigger,omitempty"`

	AuthType      string  `json:"auth_type"` // "https", "ssh", "github_app"
	IntegrationID *string `json:"integration_id,omitempty"`

	GitHubAppID          int64  `json:"github_app_id,omitempty"`
	GitHubInstallationID int64  `json:"github_installation_id,omitempty"`
	GitHubPrivateKey     string `json:"github_private_key,omitempty"`

	SSHPrivateKey string `json:"ssh_private_key,omitempty"`
	SSHKnownHosts string `json:"ssh_known_hosts,omitempty"`

	HTTPSUsername string `json:"https_username,omitempty"`
	HTTPSToken    string `json:"https_token,omitempty"`
}

ProjectRequest is the JSON request body for creating/updating a project.

type ProjectResponse

type ProjectResponse struct {
	Name                       string   `json:"name"`
	URL                        string   `json:"url"`
	Branch                     string   `json:"branch,omitempty"`
	IgnorePaths                []string `json:"ignore_paths,omitempty"`
	Schedule                   string   `json:"schedule,omitempty"`
	CancelInflightOnNewTrigger bool     `json:"cancel_inflight_on_new_trigger"`

	AuthType             string `json:"auth_type"`
	GitHubAppID          int64  `json:"github_app_id,omitempty"`
	GitHubInstallationID int64  `json:"github_installation_id,omitempty"`
	IntegrationID        string `json:"integration_id,omitempty"`
	IntegrationName      string `json:"integration_name,omitempty"`
	IntegrationType      string `json:"integration_type,omitempty"`

	Source    string `json:"source"` // "config" or "dynamic"
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

ProjectResponse is the JSON response for a project.

type Server

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

func New

func New(cfg *config.Config, s storage.Store, q *queue.Queue, templatesFS, staticFS fs.FS, opts ...ServerOption) (*Server, error)

func (*Server) Handler

func (s *Server) Handler() http.Handler

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down background goroutines (e.g. lock renewals).

type ServerOption

type ServerOption func(*Server)

ServerOption is a functional option for configuring the Server.

func WithIntegrationStore

func WithIntegrationStore(is *secrets.IntegrationStore) ServerOption

WithIntegrationStore sets the integration store.

func WithOrchestrator

func WithOrchestrator(orch *orchestrate.ScanOrchestrator) ServerOption

WithOrchestrator sets a shared scan orchestrator.

func WithProjectProvider

func WithProjectProvider(provider projects.Provider) ServerOption

WithProjectProvider sets a repository provider for resolving dynamic projects.

func WithProjectStore

func WithProjectStore(rs *secrets.ProjectStore) ServerOption

WithProjectStore sets the dynamic repository store.

func WithSchedulerCallbacks

func WithSchedulerCallbacks(onAdded, onUpdated func(name, schedule string), onDeleted func(name string)) ServerOption

WithSchedulerCallbacks sets callbacks for scheduler integration when projects change.

Jump to

Keyboard shortcuts

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