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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPlaneClusterConfig

type DataPlaneClusterConfig struct {
	Observability        DataPlaneClusterConfigObservability
	DynamicCapacityInfo  map[string]api.DynamicCapacityInfo
	NetworkConfiguration DataPlaneClusterConfigNetwork
}

type DataPlaneClusterConfigNetwork

type DataPlaneClusterConfigNetwork struct {
	Private bool
}

type DataPlaneClusterConfigObservability

type DataPlaneClusterConfigObservability struct {
	AccessToken string
	Channel     string
	Repository  string
	Tag         string
}

type DataPlaneClusterStatus

type DataPlaneClusterStatus struct {
	Conditions               []DataPlaneClusterStatusCondition
	AvailableStrimziVersions []api.StrimziVersion
	DynamicCapacityInfo      map[string]api.DynamicCapacityInfo
}

type DataPlaneClusterStatusCondition

type DataPlaneClusterStatusCondition struct {
	Type    string
	Reason  string
	Status  string
	Message string
}

type DataPlaneKafkaRoute

type DataPlaneKafkaRoute struct {
	Domain string
	Router string
}

type DataPlaneKafkaRouteRequest

type DataPlaneKafkaRouteRequest struct {
	Name   string
	Prefix string
	Router string
}

type DataPlaneKafkaStatus

type DataPlaneKafkaStatus struct {
	KafkaClusterId string
	Conditions     []DataPlaneKafkaStatusCondition
	// Going to ignore the rest of fields (like capacity and versions) for now, until when they are needed
	Routes          []DataPlaneKafkaRouteRequest
	KafkaVersion    string
	StrimziVersion  string
	KafkaIBPVersion string
	AdminServerURI  string
}

func (*DataPlaneKafkaStatus) GetReadyCondition

func (d *DataPlaneKafkaStatus) GetReadyCondition() (DataPlaneKafkaStatusCondition, bool)

type DataPlaneKafkaStatusCondition

type DataPlaneKafkaStatusCondition struct {
	Type    string
	Reason  string
	Status  string
	Message string
}

type KafkaIndex

type KafkaIndex map[string]*KafkaRequest

type KafkaList

type KafkaList []*KafkaRequest

func (KafkaList) Index

func (l KafkaList) Index() KafkaIndex

type KafkaPromotionStatus

type KafkaPromotionStatus string
const (
	KafkaPromotionStatusPromoting   KafkaPromotionStatus = "promoting"
	KafkaPromotionStatusFailed      KafkaPromotionStatus = "failed"
	KafkaPromotionStatusNoPromotion KafkaPromotionStatus = ""
)

func ParseKafkaPromotionStatus

func ParseKafkaPromotionStatus(status string) (KafkaPromotionStatus, error)

func (KafkaPromotionStatus) String

func (s KafkaPromotionStatus) String() string

type KafkaRequest

type KafkaRequest struct {
	api.Meta
	Region                           string `json:"region"`
	ClusterID                        string `json:"cluster_id" gorm:"index"`
	CloudProvider                    string `json:"cloud_provider"`
	MultiAZ                          bool   `json:"multi_az"`
	Name                             string `json:"name" gorm:"index"`
	Status                           string `json:"status" gorm:"index"`
	CanaryServiceAccountClientID     string `json:"canary_service_account_client_id"`
	CanaryServiceAccountClientSecret string `json:"canary_service_account_client_secret"`
	SubscriptionId                   string `json:"subscription_id"`
	Owner                            string `json:"owner" gorm:"index"` // TODO: ocm owner?
	OwnerAccountId                   string `json:"owner_account_id"`
	BootstrapServerHost              string `json:"bootstrap_server_host"`
	AdminApiServerURL                string `json:"admin_api_server_url"`
	OrganisationId                   string `json:"organisation_id" gorm:"index"`
	FailedReason                     string `json:"failed_reason"`
	// PlacementId field should be updated every time when a KafkaRequest is assigned to an OSD cluster (even if it's the same one again)
	PlacementId string `json:"placement_id"`

	DesiredKafkaVersion    string `json:"desired_kafka_version"`
	ActualKafkaVersion     string `json:"actual_kafka_version"`
	DesiredStrimziVersion  string `json:"desired_strimzi_version"`
	ActualStrimziVersion   string `json:"actual_strimzi_version"`
	DesiredKafkaIBPVersion string `json:"desired_kafka_ibp_version"`
	ActualKafkaIBPVersion  string `json:"actual_kafka_ibp_version"`
	KafkaUpgrading         bool   `json:"kafka_upgrading"`
	StrimziUpgrading       bool   `json:"strimzi_upgrading"`
	KafkaIBPUpgrading      bool   `json:"kafka_ibp_upgrading"`
	MaxDataRetentionSize   string `json:"max_data_retention_size"`
	// The type of kafka instance (developer or standard)
	InstanceType string `json:"instance_type"`
	// the quota service type for the kafka, e.g. ams, quota-management-list
	QuotaType string `json:"quota_type"`
	// Routes routes mapping for the kafka instance. It is an array and each item in the array contains a domain value and the corresponding route url
	Routes api.JSON `json:"routes"`
	// RoutesCreated if the routes mapping have been created in the DNS provider like Route53. Use a separate field to make it easier to query.
	RoutesCreated bool `json:"routes_created"`
	// Namespace is the namespace of the provisioned kafka instance.
	// We store this in the database to ensure that old kafkas whose namespace contained "owner-<kafka-id>" information will continue to work.
	Namespace                string               `json:"namespace"`
	ReauthenticationEnabled  bool                 `json:"reauthentication_enabled"`
	RoutesCreationId         string               `json:"routes_creation_id"`
	SizeId                   string               `json:"size_id"`
	BillingCloudAccountId    string               `json:"billing_cloud_account_id"`
	Marketplace              string               `json:"marketplace"`
	ActualKafkaBillingModel  string               `json:"actual_kafka_billing_model"`
	DesiredKafkaBillingModel string               `json:"desired_kafka_billing_model"`
	PromotionStatus          KafkaPromotionStatus `json:"promotion_status"`
	PromotionDetails         string               `json:"promotion_details"`
	// ExpiresAt contains the timestamp of when a Kafka instance is scheduled to expire.
	// On expiration, the Kafka instance will be marked for deletion, its status will be set to 'deprovision'.
	ExpiresAt sql.NullTime `json:"expires_at"`
	// KafkasRoutesBaseDomainName is the base domain name for kafkas routes
	KafkasRoutesBaseDomainName string
	// KafkasRoutesBaseDomainTLSKeyRef is the key referencing the TLS certificate key (private part of the certificate) for the base kafka domain
	KafkasRoutesBaseDomainTLSKeyRef string
	// KafkasRoutesBaseDomainTLSCrtRef is the key referencing the TLS certificate crt (public part of the certificate) for the base kafka domain
	KafkasRoutesBaseDomainTLSCrtRef string
}

func (*KafkaRequest) BeforeCreate

func (k *KafkaRequest) BeforeCreate(scope *gorm.DB) error

func (*KafkaRequest) CanBeAutomaticallySuspended

func (k *KafkaRequest) CanBeAutomaticallySuspended() bool

CanBeAutomaticallySuspended returns whether the kafka instance can be suspended or not This method is used when the Kafka instance enters its grace period

func (*KafkaRequest) DesiredBillingModelIsEnterprise

func (k *KafkaRequest) DesiredBillingModelIsEnterprise() bool

DesiredBillingModelIsEnterprise returns true if the Kafka has enterprise billing model. Otherwise returns false.

func (*KafkaRequest) GetExpirationTime

func (k *KafkaRequest) GetExpirationTime(lifespanSeconds int) *time.Time

GetExpirationTime returns when the Kafka request will expire based on the provided lifespanSeconds value. lifespanSeconds is assumed to be greater than 0

func (*KafkaRequest) GetRoutes

func (k *KafkaRequest) GetRoutes() ([]DataPlaneKafkaRoute, error)

func (*KafkaRequest) HasCertificateInfo

func (k *KafkaRequest) HasCertificateInfo() bool

HasCertificateInfo returns true when the tls certificate info for this Kafka have been set

func (*KafkaRequest) IsADeveloperInstance

func (k *KafkaRequest) IsADeveloperInstance() bool

IsADeveloperInstance returns true if the instance type is developer. Otherwise returns false

func (*KafkaRequest) IsExpired

func (k *KafkaRequest) IsExpired() (bool, RemainingLifeSpan)

IsExpired returns whether a kafka is expired and how many days the instance will live before expiring

func (*KafkaRequest) IsUsingSharedTLSCertificate

func (k *KafkaRequest) IsUsingSharedTLSCertificate(kafkaConfig *config.KafkaConfig) bool

IsUsingSharedTLSCertificate returns true if the kafka is using a shared certificate. A kafka is considered to be using a shared certificate if its kafkas routes base domain name is the same as the kafka domain name given in the configuration or its routes base domain is prefixed with the "trial"

func (*KafkaRequest) SetRoutes

func (k *KafkaRequest) SetRoutes(routes []DataPlaneKafkaRoute) error

type RemainingLifeSpan

type RemainingLifeSpan interface {
	// Infinite returns whether the Kafka instance has infinite (no expiration) remaining life span
	Infinite() bool

	// Days returns the number of remaining life span days a Kafka instance has.
	// The value can be negative if the instance has expired by 1 day or more to indicate how many days ago the instance
	// has expired, or it can be `-1` if the remaining life is `infinite`.
	// Caller shouldn't rely on this function returning `-1` to check for infinity, since this function will return `-1`
	// even when the instance has expired one day ago.
	// To reliable check for infinity, check the value returned by `Infinite`
	Days() float64

	// LessThanOrEqual returns whether the remaining number of days is less or equal then the specified one.
	// If the remaining life is `infinte` this method always returns `false`.
	LessThanOrEqual(days float64) bool
}

The RemainingLifeSpan is the remaining life a kafka instance have before it expires and gets deleted

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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