api

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

Documentation

Index

Constants

View Source
const (
	// The create cluster request has been recorder
	ClusterAccepted ClusterStatus = "cluster_accepted"
	// ClusterProvisioning the underlying ocm cluster is provisioning
	ClusterProvisioning ClusterStatus = "cluster_provisioning"
	// ClusterProvisioned the underlying ocm cluster is provisioned
	ClusterProvisioned ClusterStatus = "cluster_provisioned"
	// ClusterFailed the cluster failed to become ready
	ClusterFailed ClusterStatus = "failed"
	// ClusterReady the cluster is terraformed and ready for kafka instances
	ClusterReady ClusterStatus = "ready"
	// ClusterDeprovisioning the cluster is empty and can be deprovisioned
	ClusterDeprovisioning ClusterStatus = "deprovisioning"
	// ClusterCleanup the cluster external resources are being removed
	ClusterCleanup ClusterStatus = "cleanup"
	// ClusterWaitingForKasFleetShardOperator the cluster is waiting for the KAS fleetshard operator to be ready
	ClusterWaitingForKasFleetShardOperator ClusterStatus = "waiting_for_kas_fleetshard_operator"

	ClusterProviderOCM        ClusterProviderType = "ocm"
	ClusterProviderAwsEKS     ClusterProviderType = "aws_eks"
	ClusterProviderStandalone ClusterProviderType = "standalone"

	EnterpriseDataPlaneClusterType DataPlaneClusterType = "enterprise"
	ManagedDataPlaneClusterType    DataPlaneClusterType = "managed"

	DeveloperTypeSupport   ClusterInstanceTypeSupport = "developer"
	StandardTypeSupport    ClusterInstanceTypeSupport = "standard"
	AllInstanceTypeSupport ClusterInstanceTypeSupport = "standard,developer"
)
View Source
const ErrorType = "Error"

ErrorType is the name of the type used to report errors.

Variables

View Source
var ClusterDeletionStatuses = []string{ClusterCleanup.String(), ClusterDeprovisioning.String()}

ClusterDeletionStatuses are statuses of clusters under deletion

This represents the valid statuses of a dataplane cluster

View Source
var StrimziVersionNumberPartRegex = regexp.MustCompile(`\d+\.\d+\.\d+-\d+$`)

StrimziVersionNumberPartRegex contains the regular expression needed to extract the semver version number for a StrimziVersion. StrimziVersion follows the format of: prefix_string-X.Y.Z-B where X,Y,Z,B are numbers

Functions

func CompareBuildAwareSemanticVersions

func CompareBuildAwareSemanticVersions(v1, v2 string) (int, error)

func CompareSemanticVersionsMajorAndMinor

func CompareSemanticVersionsMajorAndMinor(current, desired string) (int, error)

func NewID

func NewID() string

func SendMethodNotAllowed

func SendMethodNotAllowed(w http.ResponseWriter, r *http.Request)

SendMethodNotAllowed response

func SendNotFound

func SendNotFound(w http.ResponseWriter, r *http.Request)

SendNotFound sends a 404 response with some details about the non existing resource.

func SendPanic

func SendPanic(w http.ResponseWriter, r *http.Request)

SendPanic sends a panic error response to the client, but it doesn't end the process.

func SendUnauthorized

func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)

SendUnauthorized response

Types

type CloudProvider

type CloudProvider struct {
	Kind        string `json:"kind"`
	Id          string `json:"id"`
	DisplayName string `json:"display_name"`
	Name        string `json:"name"`
	Enabled     bool   `json:"enabled"`
}

type CloudProviderList

type CloudProviderList []*CloudProvider

type CloudRegion

type CloudRegion struct {
	Kind                   string                   `json:"kind"`
	Id                     string                   `json:"id"`
	DisplayName            string                   `json:"display_name"`
	CloudProvider          string                   `json:"cloud_provider"`
	Enabled                bool                     `json:"enabled"`
	SupportedInstanceTypes []string                 `json:"supported_instance_types"`
	Capacity               []RegionCapacityListItem `json:"capacity"`
}

type CloudRegionList

type CloudRegionList *[]CloudRegion

type Cluster

type Cluster struct {
	Meta
	CloudProvider      string        `json:"cloud_provider"`
	ClusterID          string        `json:"cluster_id" gorm:"uniqueIndex"`
	ExternalID         string        `json:"external_id"`
	MultiAZ            bool          `json:"multi_az"`
	Region             string        `json:"region"`
	Status             ClusterStatus `json:"status" gorm:"index"`
	StatusDetails      string        `json:"status_details" gorm:"-"`
	IdentityProviderID string        `json:"identity_provider_id"`
	ClusterDNS         string        `json:"cluster_dns"`
	ClientID           string        `json:"client_id"`
	ClientSecret       string        `json:"client_secret"`
	// the provider type for the cluster, e.g. OCM, AWS, GCP, Standalone etc
	ProviderType ClusterProviderType `json:"provider_type"`
	// store the provider-specific information that can be used to managed the openshift/k8s cluster
	ProviderSpec JSON `json:"provider_spec"`
	// store the specs of the openshift/k8s cluster which can be used to access the cluster
	ClusterSpec JSON `json:"cluster_spec"`
	// List of available strimzi versions in the cluster. Content MUST be stored
	// with the versions sorted in ascending order as a JSON. See
	// StrimziVersionNumberPartRegex for details on the expected strimzi version
	// format. See the StrimziVersion data type for the format of JSON stored. Use the
	// `SetAvailableStrimziVersions` helper method to ensure the correct order is set.
	// Latest position in the list is considered the newest available version.
	AvailableStrimziVersions JSON `json:"available_strimzi_versions"`
	// SupportedInstanceType holds information on what kind of instances types can be provisioned on this cluster.
	// A cluster can support two kinds of instance types: 'developer', 'standard' or both in this case it will be a comma separated list of instance types e.g 'standard,developer'.
	SupportedInstanceType string `json:"supported_instance_type"`

	// DynamicCapacityInfo holds dynamic scaling capacity information per instance type.
	// For each instance type, the maxinum number of nodes, remaining units and maximum supported units are stored
	DynamicCapacityInfo JSON `json:"dynamic_capacity_info"`

	// for now used only for enterprise OSD clusters
	ClusterType    string `json:"cluster_type"`
	OrganizationID string `json:"organization_id"`

	// AccessKafkasViaPrivateNetwork indicates whether Kafkas deployed on this OSD cluster have to be accessed via private network
	AccessKafkasViaPrivateNetwork bool `json:"access_kafkas_via_private_network"`
}

func (*Cluster) BeforeCreate

func (cluster *Cluster) BeforeCreate(tx *gorm.DB) error

func (*Cluster) GetAvailableAndReadyStrimziVersions

func (cluster *Cluster) GetAvailableAndReadyStrimziVersions() ([]StrimziVersion, error)

GetAvailableAndReadyStrimziVersions returns the cluster's list of available and ready versions or an error. An empty list is returned if there are no available and ready versions

func (*Cluster) GetAvailableStrimziVersions

func (cluster *Cluster) GetAvailableStrimziVersions() ([]StrimziVersion, error)

GetAvailableStrimziVersions returns the cluster's list of available strimzi versions or an error. An empty list is returned if there are no versions. This returns the available versions in the cluster independently on whether they are ready or not. If you want to only get the available and ready versions use the GetAvailableAndReadyStrimziVersions method

func (*Cluster) GetLatestAvailableAndReadyStrimziVersion

func (cluster *Cluster) GetLatestAvailableAndReadyStrimziVersion() (*StrimziVersion, error)

GetLatestAvailableAndReadyStrimziVersion returns the latest available and ready strimzi version in the cluster or an error. If there are no available and ready strimzi versions nil is returned. This method does not perform any sorting of the Strimzi versions, it simply returns the latest stored element. Make sure you set the strimzi versions of the cluster using the SetAvailableStrimziVersions method to have a sorted list beforehand

func (*Cluster) GetLatestAvailableStrimziVersion

func (cluster *Cluster) GetLatestAvailableStrimziVersion() (*StrimziVersion, error)

GetLatestAvailableStrimziVersion returns the latest available strimzi version in the cluster or an error. If there are no available strimzi versions nil is returned. This method does not perform any sorting of the Strimzi versions, it simply returns the latest stored element. Make sure you set the strimzi versions of the cluster using the SetAvailableStrimziVersions method to have a sorted list beforehand

func (*Cluster) GetRawSupportedInstanceTypes

func (cluster *Cluster) GetRawSupportedInstanceTypes() string

GetRawSupportedInstanceTypes returns the supported instance types for the cluster. The result is a comma separated string of supported instance types

func (*Cluster) GetSupportedInstanceTypes

func (cluster *Cluster) GetSupportedInstanceTypes() []string

GetSupportedInstanceTypes returns a list of the supported instance types for the cluster. If there are no supported instance types the result is an empty list

func (*Cluster) RetrieveDynamicCapacityInfo

func (cluster *Cluster) RetrieveDynamicCapacityInfo() map[string]DynamicCapacityInfo

RetrieveDynamicCapacityInfo returns the dynamic scaling info per instance type

func (*Cluster) SetAvailableStrimziVersions

func (cluster *Cluster) SetAvailableStrimziVersions(availableStrimziVersions []StrimziVersion) error

SetAvailableStrimziVersions sets the cluster's list of available strimzi versions. The list of versions is always stored in version ascending order, with all versions deeply sorted (strimzi versions, kafka versions, kafka ibp versions ...). If availableStrimziVersions is nil an empty list is set. See StrimziVersionNumberPartRegex for details on the expected strimzi version format

func (*Cluster) SetDynamicCapacityInfo

func (cluster *Cluster) SetDynamicCapacityInfo(dynamicCapacityInfo map[string]DynamicCapacityInfo) error

SetDynamicCapacityInfo sets the dynamic scaling info per instance type into a json object that can be persisted in the database

type ClusterIndex

type ClusterIndex map[string]*Cluster

type ClusterInstanceTypeSupport

type ClusterInstanceTypeSupport string

func (ClusterInstanceTypeSupport) String

type ClusterList

type ClusterList []*Cluster

func (ClusterList) Index

func (c ClusterList) Index() ClusterIndex

type ClusterProviderType

type ClusterProviderType string

func (ClusterProviderType) String

func (p ClusterProviderType) String() string

func (*ClusterProviderType) UnmarshalYAML

func (p *ClusterProviderType) UnmarshalYAML(unmarshal func(interface{}) error) error

type ClusterStatus

type ClusterStatus string

func (ClusterStatus) CompareTo

func (k ClusterStatus) CompareTo(k1 ClusterStatus) int

CompareTo - Compare this status with the given status returning an int. The result will be 0 if k==k1, -1 if k < k1, and +1 if k > k1

func (ClusterStatus) String

func (k ClusterStatus) String() string

func (*ClusterStatus) UnmarshalYAML

func (k *ClusterStatus) UnmarshalYAML(unmarshal func(interface{}) error) error

type CollectionMetadata

type CollectionMetadata struct {
	ID   string `json:"id"`
	HREF string `json:"href"`
	Kind string `json:"kind"`
}

CollectionMetadata represents a collection.

type DataPlaneClusterType

type DataPlaneClusterType string

func (DataPlaneClusterType) String

func (t DataPlaneClusterType) String() string

type DynamicCapacityInfo

type DynamicCapacityInfo struct {
	//MaxNodes is the maximum number of worker nodes assigned to the corresponding machine pool.
	//The value is read from the configuration and updated once the machine pool has been created
	MaxNodes int32 `json:"max_nodes"`
	//MaxUnits is the maximum number of streaming units that can fit into the given MaxNodes value.
	//The value is updated each time by kas-fleetshard-sync cluster status update API call
	MaxUnits int32 `json:"max_units"`
	//RemainingUnits is the remaining number of streaming units to be placed into the machine pool.
	// The value is updated each time by kas-fleetshard-sync cluster status update API call
	RemainingUnits int32 `json:"remaining_units"`
}

type Error

type Error struct {
	Type   string `json:"type,omitempty"`
	ID     string `json:"id,omitempty"`
	HREF   string `json:"href,omitempty"`
	Code   string `json:"code,omitempty"`
	Reason string `json:"reason,omitempty"`
}

Error represents an error reported by the API.

type JSON

type JSON json.RawMessage

func (JSON) MarshalJSON

func (m JSON) MarshalJSON() ([]byte, error)

func (JSON) Object

func (m JSON) Object() (map[string]interface{}, error)

func (*JSON) Scan

func (j *JSON) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (JSON) Unmarshal

func (m JSON) Unmarshal(v interface{}) error

func (*JSON) UnmarshalJSON

func (m *JSON) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *m to a copy of data.

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type KafkaIBPVersion

type KafkaIBPVersion struct {
	Version string `json:"version"`
}

func (*KafkaIBPVersion) Compare

func (s *KafkaIBPVersion) Compare(other KafkaIBPVersion) (int, error)

type KafkaVersion

type KafkaVersion struct {
	Version string `json:"version"`
}

func (*KafkaVersion) Compare

func (s *KafkaVersion) Compare(other KafkaVersion) (int, error)

type LeaderLease

type LeaderLease struct {
	Meta
	Leader    string
	LeaseType string
	Expires   *time.Time
}

func (*LeaderLease) BeforeCreate

func (leaderLease *LeaderLease) BeforeCreate(tx *gorm.DB) error

type LeaderLeaseIndex

type LeaderLeaseIndex map[string]*LeaderLease

type LeaderLeaseList

type LeaderLeaseList []*LeaderLease

func (LeaderLeaseList) Index

type Meta

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

Meta is base model definition, embedded in all kinds

type Metadata

type Metadata struct {
	ID       string            `json:"id"`
	HREF     string            `json:"href"`
	Kind     string            `json:"kind"`
	Versions []VersionMetadata `json:"versions"`
}

Metadata api metadata.

func (*Metadata) ServeHTTP

func (m *Metadata) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP sends API documentation response.

type PagingMeta

type PagingMeta struct {
	Page  int
	Size  int
	Total int
}

List Paging metadata

type QuotaType

type QuotaType string
const (
	AMSQuotaType                 QuotaType = "ams"
	QuotaManagementListQuotaType QuotaType = "quota-management-list"
	UndefinedQuotaType           QuotaType = ""
)

func (QuotaType) String

func (quotaType QuotaType) String() string

type RegionCapacityListItem

type RegionCapacityListItem struct {
	// kafka instance type
	InstanceType string `json:"instance_type,omitempty"`
	// a list of kafka instance sizes that can still be created in this region
	AvailableSizes []string `json:"available_sizes,omitempty"`
}

RegionCapacityListItem schema for a kafka instance type capacity in region

type ServiceAccount

type ServiceAccount struct {
	ID           string    `json:"id,omitempty"`
	ClientID     string    `json:"clientID,omitempty"`
	ClientSecret string    `json:"clientSecret,omitempty"`
	Name         string    `json:"name,omitempty"`
	CreatedBy    string    `json:"owner,omitempty"`
	Description  string    `json:"description,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
}

type ServiceAccountRequest

type ServiceAccountRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type SsoProvider

type SsoProvider struct {
	Name        string `json:"name"`
	BaseUrl     string `json:"base_url,omitempty"`
	TokenUrl    string `json:"token_url,omitempty"`
	Jwks        string `json:"jwks,omitempty"`
	ValidIssuer string `json:"valid_issuer,omitempty"`
}

type StrimziVersion

type StrimziVersion struct {
	Version          string            `json:"version"`
	Ready            bool              `json:"ready"`
	KafkaVersions    []KafkaVersion    `json:"kafkaVersions"`
	KafkaIBPVersions []KafkaIBPVersion `json:"kafkaIBPVersions"`
}

func StrimziVersionsDeepSort

func StrimziVersionsDeepSort(versions []StrimziVersion) ([]StrimziVersion, error)

StrimziVersionsDeepSort returns a sorted copy of the provided StrimziVersions in the versions slice. The following elements are sorted in ascending order: - The strimzi versions - For each strimzi version, their Kafka Versions - For each strimzi version, their Kafka IBP Versions

func (*StrimziVersion) Compare

func (s *StrimziVersion) Compare(other StrimziVersion) (int, error)

Compare returns compares s.Version with other.Version comparing the version number suffix specified there using StrimziVersionNumberPartRegex to extract the version number. If s.Version is smaller than other.Version a -1 is returned. If s.Version is equal than other.Version 0 is returned. If s.Version is greater than other.Version 1 is returned. If there is an error during the comparison an error is returned

func (*StrimziVersion) DeepCopy

func (s *StrimziVersion) DeepCopy() *StrimziVersion

func (*StrimziVersion) GetLatestKafkaIBPVersion

func (s *StrimziVersion) GetLatestKafkaIBPVersion() *KafkaIBPVersion

GetLatestKafkaIBPVersion returns the latest (most recent) Kafka IBP version in the StrimziVersion s. If there are no Kafka IBP versions nil is returned. This method does not perform any sorting of the Kafka IBP versions, it simply returns the latest stored element. Use the StrimziVersionsDeepSort method to get a semantically sorted StrimziVersion beorehand

func (*StrimziVersion) GetLatestKafkaVersion

func (s *StrimziVersion) GetLatestKafkaVersion() *KafkaVersion

GetLatestKafkaVersion returns the latest (most recent) Kafka version in the StrimziVersion. If there are no Kafka versions nil is returned. This method does not perform any sorting of the Kafka versions, it simply returns the latest stored element. Use the StrimziVersionsDeepSort method to get a semantically sorted StrimziVersion beforehand

type VersionMetadata

type VersionMetadata struct {
	ID            string               `json:"id"`
	HREF          string               `json:"href"`
	Kind          string               `json:"kind"`
	ServerVersion string               `json:"server_version"`
	Collections   []CollectionMetadata `json:"collections"`
}

VersionMetadata represents a version.

func (*VersionMetadata) ServeHTTP

func (v *VersionMetadata) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP sends API version v1 documentation response.

Directories

Path Synopsis
managedkafkas.managedkafka.bf2.org
v1

Jump to

Keyboard shortcuts

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