dbapi

package
v0.0.0-...-9b598c7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectorUnassigned ConnectorDesiredState = "unassigned"
	ConnectorReady      ConnectorDesiredState = "ready"
	ConnectorStopped    ConnectorDesiredState = "stopped"
	ConnectorDeleted    ConnectorDesiredState = "deleted"

	ConnectorStatusPhaseAssigning      ConnectorStatusPhase = "assigning"      // set by kas-fleet-manager - user request
	ConnectorStatusPhaseAssigned       ConnectorStatusPhase = "assigned"       // set by kas-fleet-manager - worker
	ConnectorStatusPhaseUpdating       ConnectorStatusPhase = "updating"       // set by kas-fleet-manager - user request
	ConnectorStatusPhaseStopped        ConnectorStatusPhase = "stopped"        // set by kas-fleet-manager - user request
	ConnectorStatusPhaseProvisioning   ConnectorStatusPhase = "provisioning"   // set by kas-agent
	ConnectorStatusPhaseReady          ConnectorStatusPhase = "ready"          // set by the agent
	ConnectorStatusPhaseFailed         ConnectorStatusPhase = "failed"         // set by the agent
	ConnectorStatusPhaseDeprovisioning ConnectorStatusPhase = "deprovisioning" // set by kas-agent
	ConnectorStatusPhaseDeleting       ConnectorStatusPhase = "deleting"       // set by the kas-fleet-manager - user request
	ConnectorStatusPhaseDeleted        ConnectorStatusPhase = "deleted"        // set by the agent
)
View Source
const (
	// ConnectorClusterPhaseDisconnected - cluster status when first created
	ConnectorClusterPhaseDisconnected ConnectorClusterPhaseEnum = "disconnected"
	// ConnectorClusterPhaseReady - cluster status when it operational
	ConnectorClusterPhaseReady ConnectorClusterPhaseEnum = "ready"
	// ConnectorClusterPhaseDeleting - cluster status when in the process of being deleted
	ConnectorClusterPhaseDeleting ConnectorClusterPhaseEnum = "deleting"

	ConnectorClusterOrgIdAnnotation string = "cos.bf2.org/organisation-id"
)
View Source
const (
	ConnectorTypePricingTierAnnotation = "cos.bf2.org/pricing-tier"
)

Variables

View Source
var AgentRequestConnectorClusterStatus = []string{
	string(ConnectorClusterPhaseReady),
}

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Type               string
	Reason             string
	Message            string
	Status             string
	LastTransitionTime string
}

type ConditionList

type ConditionList []Condition

func (*ConditionList) Scan

func (c *ConditionList) Scan(value interface{}) error

func (ConditionList) Value

func (c ConditionList) Value() (driver.Value, error)

type Connector

type Connector struct {
	db.Model

	NamespaceId   *string
	CloudProvider string
	Region        string
	MultiAZ       bool

	Name           string
	Owner          string
	OrganisationId string
	Version        int64                 `gorm:"type:bigserial;index:"`
	Annotations    []ConnectorAnnotation `gorm:"foreignKey:ConnectorID;references:ID"`

	ConnectorTypeId string
	ConnectorSpec   api.JSON `gorm:"type:jsonb"`
	DesiredState    ConnectorDesiredState
	Channel         string
	Kafka           KafkaConnectionSettings          `gorm:"embedded;embeddedPrefix:kafka_"`
	SchemaRegistry  SchemaRegistryConnectionSettings `gorm:"embedded;embeddedPrefix:schema_registry_"`
	ServiceAccount  ServiceAccount                   `gorm:"embedded;embeddedPrefix:service_account_"`

	Status ConnectorStatus `gorm:"foreignKey:ID"`
}

type ConnectorAnnotation

type ConnectorAnnotation struct {
	ConnectorID string `gorm:"primaryKey;index"`
	Key         string `gorm:"primaryKey;not null"`
	Value       string `gorm:"not null"`
}

type ConnectorCatalogEntry

type ConnectorCatalogEntry struct {
	ConnectorType *ConnectorType
	Channels      map[string]*ConnectorShardMetadata
}

type ConnectorChannel

type ConnectorChannel struct {
	Channel   string `gorm:"primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	// needed for soft delete. See https://gorm.io/docs/delete.html#Soft-Delete
	DeletedAt gorm.DeletedAt
}

type ConnectorCluster

type ConnectorCluster struct {
	db.Model
	Owner          string
	OrganisationId string
	Name           string
	ClientId       string
	ClientSecret   string
	Annotations    []ConnectorClusterAnnotation `gorm:"foreignKey:ConnectorClusterID;references:ID"`
	Status         ConnectorClusterStatus       `gorm:"embedded;embeddedPrefix:status_"`
}

type ConnectorClusterAnnotation

type ConnectorClusterAnnotation struct {
	ConnectorClusterID string `gorm:"primaryKey;index"`
	Key                string `gorm:"primaryKey;not null"`
	Value              string `gorm:"not null"`
}

type ConnectorClusterList

type ConnectorClusterList []ConnectorCluster

type ConnectorClusterPhaseEnum

type ConnectorClusterPhaseEnum string

type ConnectorClusterPlatform

type ConnectorClusterPlatform struct {
	// renamed struct field to PlatformID to avoid gorm Preload conflict
	PlatformID string `gorm:"column:id"`
	Type       string
	Version    string
}

type ConnectorClusterStatus

type ConnectorClusterStatus struct {
	Phase ConnectorClusterPhaseEnum
	// the version of the agent
	Version    string
	Platform   ConnectorClusterPlatform `gorm:"embedded;embeddedPrefix:platform_"`
	Conditions ConditionList            `gorm:"type:jsonb"`
	Operators  OperatorList             `gorm:"type:jsonb"`
}

type ConnectorDeployment

type ConnectorDeployment struct {
	db.Model
	Version                  int64
	ConnectorID              string
	Connector                Connector
	OperatorID               string
	ConnectorVersion         int64
	ConnectorShardMetadataID int64
	ConnectorShardMetadata   ConnectorShardMetadata
	ClusterID                string
	NamespaceID              string
	AllowUpgrade             bool
	Status                   ConnectorDeploymentStatus `gorm:"foreignKey:ID;references:ID"`
	Annotations              []ConnectorAnnotation     `gorm:"foreignKey:ConnectorID;references:ConnectorID"`
}

ConnectorDeployment Holds the deployment configuration of a connector

type ConnectorDeploymentList

type ConnectorDeploymentList []ConnectorDeployment

type ConnectorDeploymentStatus

type ConnectorDeploymentStatus struct {
	db.Model
	Phase            ConnectorStatusPhase
	Version          int64
	Conditions       api.JSON `gorm:"type:jsonb"`
	Operators        api.JSON `gorm:"type:jsonb"`
	UpgradeAvailable bool
}

type ConnectorDesiredState

type ConnectorDesiredState string

type ConnectorList

type ConnectorList []*Connector

type ConnectorNamespace

type ConnectorNamespace struct {
	db.Model
	Name      string `gorm:"not null;uniqueIndex:idx_connector_namespaces_name_cluster_id"`
	ClusterId string `gorm:"not null;uniqueIndex:idx_connector_namespaces_name_cluster_id;index"`

	Owner      string `gorm:"not null;index"`
	Version    int64  `gorm:"type:bigserial;index"`
	Expiration *time.Time

	// metadata
	Annotations []ConnectorNamespaceAnnotation `gorm:"foreignKey:NamespaceId;references:ID"`

	// tenant, only one of the below fields can be not null
	TenantUserId         *string                      `gorm:"index:connector_namespaces_user_organisation_idx;index:,where:tenant_user_id is not null"`
	TenantOrganisationId *string                      `gorm:"index:connector_namespaces_user_organisation_idx;index:,where:tenant_organisation_id is not null"`
	TenantUser           *ConnectorTenantUser         `gorm:"foreignKey:TenantUserId"`
	TenantOrganisation   *ConnectorTenantOrganisation `gorm:"foreignKey:TenantOrganisationId"`

	Status ConnectorNamespaceStatus `gorm:"embedded;embeddedPrefix:status_"`
}

type ConnectorNamespaceAnnotation

type ConnectorNamespaceAnnotation struct {
	NamespaceId string `gorm:"primaryKey;index"`
	Key         string `gorm:"primaryKey;not null"`
	Value       string `gorm:"not null"`
}

type ConnectorNamespaceList

type ConnectorNamespaceList []*ConnectorNamespace

type ConnectorNamespacePhaseEnum

type ConnectorNamespacePhaseEnum string
const (
	// ConnectorNamespacePhaseDisconnected - Namespace status when first created
	ConnectorNamespacePhaseDisconnected ConnectorNamespacePhaseEnum = "disconnected"
	// ConnectorNamespacePhaseReady- Namespace status when it operational
	ConnectorNamespacePhaseReady ConnectorNamespacePhaseEnum = "ready"
	// ConnectorNamespacePhaseDeleting- Namespace status when in the process of being deleted
	ConnectorNamespacePhaseDeleting ConnectorNamespacePhaseEnum = "deleting"
	// ConnectorNamespacePhaseDeleted- Namespace status after agent acknowledges namespace delete
	ConnectorNamespacePhaseDeleted ConnectorNamespacePhaseEnum = "deleted"
)

type ConnectorNamespaceStatus

type ConnectorNamespaceStatus struct {
	Phase ConnectorNamespacePhaseEnum `gorm:"not null;index"`
	// the version of the agent
	Version            string
	ConnectorsDeployed int32         `gorm:"-:all"` // gorm ignored field set using query from connector_deployments table
	Conditions         ConditionList `gorm:"type:jsonb"`
}

type ConnectorOperator

type ConnectorOperator struct {
	// the id of the operator
	Id string `json:"id,omitempty"`
	// the type of the operator
	Type string `json:"type,omitempty"`
	// the version of the operator
	Version string `json:"version,omitempty"`
}

type ConnectorShardMetadata

type ConnectorShardMetadata struct {
	ID              int64  `gorm:"primaryKey:autoIncrement"`
	ConnectorTypeId string `gorm:"index:idx_typeid_channel_revision;index:idx_typeid_channel"`
	Channel         string `gorm:"index:idx_typeid_channel_revision;index:idx_typeid_channel"`
	Revision        int64  `gorm:"index:idx_typeid_channel_revision;default:0"`
	LatestRevision  *int64
	ShardMetadata   api.JSON `gorm:"type:jsonb"`
}

type ConnectorStatus

type ConnectorStatus struct {
	db.Model
	NamespaceID *string
	Phase       ConnectorStatusPhase
}

type ConnectorStatusPhase

type ConnectorStatusPhase string

type ConnectorTenantOrganisation

type ConnectorTenantOrganisation struct {
	db.Model // org id in Id, required for references and data consistency
}

type ConnectorTenantUser

type ConnectorTenantUser struct {
	db.Model // user id in Id, required for references and data consistency
}

type ConnectorType

type ConnectorType struct {
	db.Model
	Version     string
	Name        string `gorm:"index"`
	Description string
	Deprecated  bool `gorm:"not null;default:false"`
	// A json schema that can be used to validate a connector's connector_spec field.
	JsonSchema api.JSON `gorm:"type:jsonb"`

	// Type's channels
	Channels []ConnectorChannel `gorm:"many2many:connector_type_channels;"`
	// URL to an icon of the connector.
	IconHref string
	// labels used to categorize the connector
	Labels []ConnectorTypeLabel `gorm:"foreignKey:ConnectorTypeID"`
	// annotations metadata
	Annotations []ConnectorTypeAnnotation `gorm:"foreignKey:ConnectorTypeID;references:ID"`
	// connector capabilities used to understand what features a connector support
	Capabilities []ConnectorTypeCapability `gorm:"foreignKey:ConnectorTypeID"`
	Checksum     *string
	FeaturedRank int32 `gorm:"not null;default:0"`
}

func (*ConnectorType) CapabilitiesNames

func (ct *ConnectorType) CapabilitiesNames() []string

func (*ConnectorType) ChannelNames

func (ct *ConnectorType) ChannelNames() []string

func (*ConnectorType) JsonSchemaAsMap

func (ct *ConnectorType) JsonSchemaAsMap() (map[string]interface{}, *errors.ServiceError)

func (*ConnectorType) LabelNames

func (ct *ConnectorType) LabelNames() []string

func (*ConnectorType) SetCapabilities

func (ct *ConnectorType) SetCapabilities(capabilities []string)

func (*ConnectorType) SetChannels

func (ct *ConnectorType) SetChannels(channels []string)

func (*ConnectorType) SetLabels

func (ct *ConnectorType) SetLabels(labels []string)

func (*ConnectorType) SetSchema

func (ct *ConnectorType) SetSchema(schema map[string]interface{}) error

type ConnectorTypeAnnotation

type ConnectorTypeAnnotation struct {
	ConnectorTypeID string `gorm:"primaryKey;index"`
	Key             string `gorm:"primaryKey;not null"`
	Value           string `gorm:"not null"`
}

type ConnectorTypeCapability

type ConnectorTypeCapability struct {
	ConnectorTypeID string `gorm:"primaryKey"`
	Capability      string `gorm:"primaryKey"`
}

type ConnectorTypeLabel

type ConnectorTypeLabel struct {
	ConnectorTypeID string `gorm:"primaryKey"`
	Label           string `gorm:"primaryKey"`
}

type ConnectorTypeLabelCount

type ConnectorTypeLabelCount struct {
	Label string
	Count int32
}

type ConnectorTypeLabelCountList

type ConnectorTypeLabelCountList []*ConnectorTypeLabelCount

type ConnectorTypeList

type ConnectorTypeList []*ConnectorType

type ConnectorWithConditions

type ConnectorWithConditions struct {
	Connector
	Conditions api.JSON `gorm:"type:jsonb"`
}

type ConnectorWithConditionsList

type ConnectorWithConditionsList []*ConnectorWithConditions

type KafkaConnectionSettings

type KafkaConnectionSettings struct {
	KafkaID         string `gorm:"column:id"`
	BootstrapServer string
}

type OperatorList

type OperatorList []OperatorStatus

func (*OperatorList) Scan

func (o *OperatorList) Scan(value interface{}) error

func (OperatorList) Value

func (o OperatorList) Value() (driver.Value, error)

type OperatorStatus

type OperatorStatus struct {
	// the id of the operator
	Id string
	// the type of the operator
	Type string
	// the version of the operator
	Version string
	// the namespace to which the operator has been installed
	Namespace string
	// the status of the operator
	Status string
}

type SchemaRegistryConnectionSettings

type SchemaRegistryConnectionSettings struct {
	SchemaRegistryID string `gorm:"column:id"`
	Url              string
}

type ServiceAccount

type ServiceAccount struct {
	ClientId        string
	ClientSecret    string `gorm:"-"`
	ClientSecretRef string `gorm:"column:client_secret"`
}

Jump to

Keyboard shortcuts

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