Documentation
¶
Overview ¶
Package integration models tenant-scoped external CI/CD connections and provider-neutral build provenance.
Index ¶
- Constants
- Variables
- func BoundedErrors(errorsIn []string) []string
- func CanonicalEndpoint(raw string) (string, error)
- func CanonicalExternalKey(raw string) (string, error)
- func ConsumeOperationBytes(ctx context.Context, count int64) error
- func ConsumeOperationRequest(ctx context.Context) error
- func DecodeConfig(raw json.RawMessage) (map[string]any, error)
- func IsRetryable(err error) bool
- func PermanentError(err error) error
- func RetryableError(err error) error
- func SortDescriptors(descriptors []ProviderDescriptor)
- func WithOperationBudget(ctx context.Context, maxRequests int, maxBytes int64) context.Context
- type Adapter
- type Binding
- type Capability
- type ConnectionTester
- type CorrelationState
- type CredentialBundle
- type ExternalRun
- type Factory
- type FieldDescriptor
- type FieldKind
- type Integration
- type Operation
- type OperationCounts
- type OperationState
- type OperationType
- type Pipeline
- type PipelineDiscoverer
- type Provider
- type ProviderDescriptor
- type ProviderError
- type Registry
- func (registry *Registry) Descriptor(provider Provider) (ProviderDescriptor, error)
- func (registry *Registry) Descriptors() []ProviderDescriptor
- func (registry *Registry) Register(descriptor ProviderDescriptor, factory Factory) error
- func (registry *Registry) Resolve(item Integration, credentials CredentialBundle) (Adapter, error)
- type RunLifecycle
- type RunReader
- type RunResult
Constants ¶
View Source
const ( MaxConfigBytes = 32 << 10 MaxCredentialBytes = 16 << 10 MaxPipelines = 1000 MaxBindingsPerPoll = 100 MaxRunsPerPoll = 200 MaxRequestsPerPoll = 250 MaxBytesPerPoll = 32 << 20 MaxOperationErrors = 20 MaxOperationErrorLen = 256 DefaultPollInterval = 5 * time.Minute )
Variables ¶
View Source
var ErrOperationBudgetExceeded = errors.New("integration operation budget exceeded")
Functions ¶
func BoundedErrors ¶
func CanonicalEndpoint ¶
func CanonicalExternalKey ¶
func ConsumeOperationRequest ¶
func DecodeConfig ¶
func DecodeConfig(raw json.RawMessage) (map[string]any, error)
func IsRetryable ¶
func PermanentError ¶
func RetryableError ¶
func SortDescriptors ¶
func SortDescriptors(descriptors []ProviderDescriptor)
Types ¶
type Adapter ¶
type Adapter interface {
Descriptor() ProviderDescriptor
}
type Binding ¶
type Binding struct {
ID shared.ID `json:"id"`
TenantID shared.ID `json:"tenant_id"`
IntegrationID shared.ID `json:"integration_id"`
ProjectID shared.ID `json:"project_id"`
ExternalKey string `json:"external_key"`
ExternalName string `json:"external_name"`
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Capability ¶
type Capability string
const ( CapabilityTestConnection Capability = "test_connection" CapabilityDiscover Capability = "discover_pipelines" CapabilityReadRuns Capability = "read_runs" )
type ConnectionTester ¶
type CorrelationState ¶
type CorrelationState string
const ( CorrelationLinked CorrelationState = "linked" CorrelationMissing CorrelationState = "missing" CorrelationAmbiguous CorrelationState = "ambiguous" )
type CredentialBundle ¶
func (CredentialBundle) Clone ¶
func (bundle CredentialBundle) Clone() CredentialBundle
type ExternalRun ¶
type ExternalRun struct {
ID shared.ID `json:"id"`
TenantID shared.ID `json:"tenant_id"`
IntegrationID shared.ID `json:"integration_id"`
BindingID shared.ID `json:"binding_id,omitempty"`
ProviderKey string `json:"provider_key"`
PipelineKey string `json:"pipeline_key"`
Number string `json:"number,omitempty"`
URL string `json:"url,omitempty"`
Lifecycle RunLifecycle `json:"lifecycle"`
Result RunResult `json:"result"`
Revision string `json:"revision,omitempty"`
Branch string `json:"branch,omitempty"`
AnalysisID shared.ID `json:"analysis_id,omitempty"`
Correlation CorrelationState `json:"correlation"`
QueuedAt *time.Time `json:"queued_at,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
ProviderUpdatedAt time.Time `json:"provider_updated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (*ExternalRun) Normalize ¶
func (run *ExternalRun) Normalize() error
type Factory ¶
type Factory func(Integration, CredentialBundle) (Adapter, error)
type FieldDescriptor ¶
type Integration ¶
type Integration struct {
ID shared.ID `json:"id"`
TenantID shared.ID `json:"tenant_id"`
Provider Provider `json:"provider"`
Name string `json:"name"`
Endpoint string `json:"endpoint"`
Config json.RawMessage `json:"config"`
AllowPrivateNetwork bool `json:"allow_private_network"`
PollInterval time.Duration `json:"-"`
Enabled bool `json:"enabled"`
Archived bool `json:"archived"`
Version int `json:"version"`
ConnectionRevision int `json:"-"`
CredentialRevision int `json:"-"`
CredentialConfigured bool `json:"credential_configured"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Integration) Clone ¶
func (item Integration) Clone() Integration
func (*Integration) Normalize ¶
func (item *Integration) Normalize() error
type Operation ¶
type Operation struct {
ID shared.ID `json:"id"`
TenantID shared.ID `json:"tenant_id"`
IntegrationID shared.ID `json:"integration_id"`
Type OperationType `json:"type"`
State OperationState `json:"state"`
Checkpoint string `json:"checkpoint,omitempty"`
Counts OperationCounts `json:"counts"`
Errors []string `json:"errors"`
Pipelines []Pipeline `json:"pipelines,omitempty"`
JobID string `json:"job_id"`
Actor string `json:"actor"`
ConnectionRevision int `json:"-"`
CredentialRevision int `json:"-"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type OperationCounts ¶
type OperationState ¶
type OperationState string
const ( OperationQueued OperationState = "queued" OperationRunning OperationState = "running" OperationSucceeded OperationState = "succeeded" OperationPartial OperationState = "partial" OperationFailed OperationState = "failed" OperationCancelled OperationState = "cancelled" )
func (OperationState) Terminal ¶
func (state OperationState) Terminal() bool
type OperationType ¶
type OperationType string
const ( OperationTest OperationType = "test" OperationDiscover OperationType = "discover" OperationPoll OperationType = "poll" )
func (OperationType) Valid ¶
func (operation OperationType) Valid() bool
type Pipeline ¶
type PipelineDiscoverer ¶
type ProviderDescriptor ¶
type ProviderDescriptor struct {
Provider Provider `json:"provider"`
Name string `json:"name"`
Description string `json:"description"`
Capabilities []Capability `json:"capabilities"`
ConfigFields []FieldDescriptor `json:"config_fields"`
SecretFields []FieldDescriptor `json:"secret_fields"`
}
func (ProviderDescriptor) Supports ¶
func (descriptor ProviderDescriptor) Supports(capability Capability) bool
func (ProviderDescriptor) Validate ¶
func (descriptor ProviderDescriptor) Validate() error
func (ProviderDescriptor) ValidateConfig ¶
func (descriptor ProviderDescriptor) ValidateConfig(config map[string]any) error
func (ProviderDescriptor) ValidateSecrets ¶
func (descriptor ProviderDescriptor) ValidateSecrets(secrets map[string]string) error
type ProviderError ¶
type ProviderError struct {
// Err must contain a bounded, credential-free diagnostic suitable for an
// integration operation history entry. Provider adapters are code-owned.
Retryable bool
Err error
}
func (*ProviderError) Error ¶
func (providerError *ProviderError) Error() string
func (*ProviderError) Unwrap ¶
func (providerError *ProviderError) Unwrap() error
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is code-owned. Runtime configuration can select a reviewed provider, but cannot upload or execute provider code.
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Descriptor ¶
func (registry *Registry) Descriptor(provider Provider) (ProviderDescriptor, error)
func (*Registry) Descriptors ¶
func (registry *Registry) Descriptors() []ProviderDescriptor
func (*Registry) Register ¶
func (registry *Registry) Register(descriptor ProviderDescriptor, factory Factory) error
func (*Registry) Resolve ¶
func (registry *Registry) Resolve(item Integration, credentials CredentialBundle) (Adapter, error)
type RunLifecycle ¶
type RunLifecycle string
const ( RunQueued RunLifecycle = "queued" RunRunning RunLifecycle = "running" RunCompleted RunLifecycle = "completed" )
Click to show internal directories.
Click to hide internal directories.