instaclustr

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout  = time.Second * 60
	OperatorVersion = "k8s v0.0.1"
)
View Source
const (
	ClustersEndpoint                       = "/cluster-management/v2/data-sources/clusters/v2/"
	CassandraEndpoint                      = "/cluster-management/v2/resources/applications/cassandra/clusters/v2/"
	KafkaEndpoint                          = "/cluster-management/v2/resources/applications/kafka/clusters/v2/"
	KafkaConnectEndpoint                   = "/cluster-management/v2/resources/applications/kafka-connect/clusters/v2/"
	KafkaMirrorEndpoint                    = "/cluster-management/v2/resources/applications/kafka_connect/mirrors/v2/"
	KafkaTopicEndpoint                     = "/cluster-management/v2/resources/applications/kafka/topics/v2/"
	KafkaTopicConfigsUpdateEndpoint        = "/cluster-management/v2/operations/applications/kafka/topics/v2/%s/modify-configs/v2"
	ZookeeperEndpoint                      = "/cluster-management/v2/resources/applications/zookeeper/clusters/v2/"
	AWSPeeringEndpoint                     = "/cluster-management/v2/resources/providers/aws/vpc-peers/v2/"
	AzurePeeringEndpoint                   = "/cluster-management/v2/resources/providers/azure/vnet-peers/v2/"
	ClusterNetworkFirewallRuleEndpoint     = "/cluster-management/v2/resources/network-firewall-rules/v2/"
	AWSSecurityGroupFirewallRuleEndpoint   = "/cluster-management/v2/resources/providers/aws/security-group-firewall-rules/v2/"
	GCPPeeringEndpoint                     = "/cluster-management/v2/resources/providers/gcp/vpc-peers/v2/"
	KafkaUserEndpoint                      = "/cluster-management/v2/resources/applications/kafka/users/v2/"
	KafkaACLEndpoint                       = "/cluster-management/v2/resources/applications/kafka/acls/v2/"
	CadenceEndpoint                        = "/cluster-management/v2/resources/applications/cadence/clusters/v2/"
	RedisEndpoint                          = "/cluster-management/v2/resources/applications/redis/clusters/v2/"
	RedisUserEndpoint                      = "/cluster-management/v2/resources/applications/redis/users/v2/"
	PGSQLEndpoint                          = "/cluster-management/v2/resources/applications/postgresql/clusters/v2/"
	PGSQLConfigEndpoint                    = "%s/cluster-management/v2/data-sources/postgresql_cluster/%s/configurations"
	PGSQLConfigManagementEndpoint          = "%s/cluster-management/v2/resources/applications/postgresql/configurations/v2/"
	PGSQLUpdateDefaultUserPasswordEndpoint = "%s/cluster-management/v2/operations/applications/postgresql/clusters/v2/%s/update-default-user-password"
	NodeReloadEndpoint                     = "%s/cluster-management/v2/operations/applications/postgresql/nodes/v2/%s/reload"
)

constants for API v2

View Source
const (
	AddDataCentresEndpoint                 = "/cluster-data-centres"
	ClusterConfigurationsEndpoint          = "/configurations"
	ClusterConfigurationsParameterEndpoint = "/parameter/"
	ActiveOnly                             = "activeOnly=true"
	TerraformDescription                   = "/terraform-description"
	ClustersCreationEndpoint               = "/provisioning/v1/extended/"
	BackupsEndpoint                        = "/backups"

	// ClustersEndpoint is used for GET, DELETE and UPDATE clusters
	ClustersEndpointV1 = "/provisioning/v1/"

	// ClustersResizeEndpoint is used for nodes resizing in a cluster data centre.
	// Example: fmt.Sprintf("%s/provisioning/v1/%s/%s/resize", serverHostname, clusterID, dataCentreID)
	ClustersResizeEndpoint = "%s/provisioning/v1/%s/%s/resize"
	APIv1RestoreEndpoint   = "%s/provisioning/v1/%s/backups/restore"

	ExclusionWindowEndpoint        = "/v1/maintenance-events/exclusion-windows/"
	ExclusionWindowStatusEndpoint  = "/v1/maintenance-events/exclusion-windows?clusterId="
	MaintenanceEventEndpoint       = "/v1/maintenance-events/events/"
	MaintenanceEventStatusEndpoint = "/v1/maintenance-events/events?clusterId="
)

constants for API v1

Variables

View Source
var (
	StatusPreconditionFailed  = errors.New("412 - status precondition failed")
	ClusterNotRunning         = errors.New("сluster is not running")
	NotFound                  = errors.New("not found")
	CannotDownsizeNode        = errors.New("nodes cannot be downsized")
	ClusterIsBeingDeleted     = errors.New("cluster is being deleted")
	HasActiveResizeOperation  = errors.New("cluster has active resize operation")
	ClusterIsNotReadyToResize = errors.New("cluster is not ready to resize yet")
)

Functions

This section is empty.

Types

type API

type API interface {
	DoRequest(url string, method string, data []byte) (*http.Response, error)
	CreateCluster(url string, clusterSpec any) (string, error)
	GetOpenSearch(id string) ([]byte, error)
	UpdateNodeSize(clusterEndpoint string, resizeRequest *models.ResizeRequest) error
	GetActiveDataCentreResizeOperations(clusterID, dataCentreID string) ([]*models.DataCentreResizeOperations, error)
	GetClusterConfigurations(clusterEndpoint, clusterID, bundle string) (map[string]string, error)
	UpdateClusterConfiguration(clusterEndpoint, clusterID, bundle, paramName, paramValue string) error
	ResetClusterConfiguration(clusterEndpoint, clusterID, bundle, paramName string) error
	UpdateDescriptionAndTwoFactorDelete(clusterEndpoint, clusterID, description string, twoFactorDelete *v1alpha1.TwoFactorDelete) error
	UpdateCluster(id, clusterEndpoint string, instaDCs any) error
	DeleteCluster(id, clusterEndpoint string) error
	AddDataCentre(id, clusterEndpoint string, dataCentre any) error
	GetPeeringStatus(peerID, peeringEndpoint string) (*clusterresourcesv1alpha1.PeeringStatus, error)
	UpdatePeering(peerID, peeringEndpoint string, peerSpec any) error
	DeletePeering(peerID, peeringEndpoint string) error
	CreatePeering(url string, peeringSpec any) (*clusterresourcesv1alpha1.PeeringStatus, error)
	GetFirewallRuleStatus(firewallRuleID string, firewallRuleEndpoint string) (*clusterresourcesv1alpha1.FirewallRuleStatus, error)
	CreateFirewallRule(url string, firewallRuleSpec any) (*clusterresourcesv1alpha1.FirewallRuleStatus, error)
	DeleteFirewallRule(firewallRuleID string, firewallRuleEndpoint string) error
	GetKafkaUserStatus(kafkaUserID, kafkaUserEndpoint string) (*kafkamanagementv1alpha1.KafkaUserStatus, error)
	CreateKafkaUser(url string, kafkaUser *models.KafkaUser) (*kafkamanagementv1alpha1.KafkaUserStatus, error)
	UpdateKafkaUser(kafkaUserID string, kafkaUserSpec *models.KafkaUser) error
	DeleteKafkaUser(kafkaUserID, kafkaUserEndpoint string) error
	GetTopicStatus(id string) (*kafkamanagementv1alpha1.TopicStatus, error)
	CreateKafkaTopic(url string, topic *kafkamanagementv1alpha1.Topic) error
	DeleteKafkaTopic(url, id string) error
	UpdateKafkaTopic(url string, topic *kafkamanagementv1alpha1.Topic) error
	CreateKafkaMirror(url string, m *kafkamanagementv1alpha1.Mirror) error
	GetMirrorStatus(id, mirrorEndpoint string) (*kafkamanagementv1alpha1.MirrorStatus, error)
	DeleteKafkaMirror(url, id string) error
	UpdateKafkaMirror(url string, m *kafkamanagementv1alpha1.Mirror) error
	GetClusterBackups(endpoint, clusterID string) (*models.ClusterBackup, error)
	TriggerClusterBackup(url, clusterID string) error
	CreateExclusionWindow(clusterID string, window clusterresourcesv1alpha1.ExclusionWindowSpec) (string, error)
	GetExclusionWindowsStatuses(clusterID string) ([]*clusterresourcesv1alpha1.ExclusionWindowStatus, error)
	GetMaintenanceEventsStatuses(clusterID string) ([]*clusterresourcesv1alpha1.MaintenanceEventStatus, error)
	GetMaintenanceEvents(clusterID string) ([]*v1alpha1.MaintenanceEvent, error)
	DeleteExclusionWindow(id string) error
	UpdateMaintenanceEvent(me clusterresourcesv1alpha1.MaintenanceEventRescheduleSpec) (*clusterresourcesv1alpha1.MaintenanceEventStatus, error)
	RestorePgCluster(restoreData *v1alpha1.PgRestoreFrom) (string, error)
	RestoreRedisCluster(restoreData *v1alpha1.RedisRestoreFrom) (string, error)
	RestoreOpenSearchCluster(restoreData *v1alpha1.OpenSearchRestoreFrom) (string, error)
	CreateNodeReload(nr *clusterresourcesv1alpha1.Node) error
	GetNodeReloadStatus(nodeID string) (*models.NodeReloadStatus, error)
	GetRedis(id string) ([]byte, error)
	CreateRedisUser(user *models.RedisUser) (string, error)
	UpdateRedisUser(user *models.RedisUserUpdate) error
	DeleteRedisUser(id string) error
	CreateKafkaACL(url string, kafkaACL *kafkamanagementv1alpha1.KafkaACLSpec) (*kafkamanagementv1alpha1.KafkaACLStatus, error)
	GetKafkaACLStatus(kafkaACLID, kafkaACLEndpoint string) (*kafkamanagementv1alpha1.KafkaACLStatus, error)
	DeleteKafkaACL(kafkaACLID, kafkaACLEndpoint string) error
	UpdateKafkaACL(kafkaACLID, kafkaACLEndpoint string, kafkaACLSpec any) error
	GetCassandra(id string) ([]byte, error)
	UpdateCassandra(id string, cassandra models.CassandraClusterAPIUpdate) error
	GetKafka(id string) ([]byte, error)
	GetKafkaConnect(id string) ([]byte, error)
	UpdateKafkaConnect(id string, kc models.KafkaConnectAPIUpdate) error
	GetZookeeper(id string) ([]byte, error)
	RestoreCassandra(restoreData v1alpha1.CassandraRestoreFrom) (string, error)
	GetPostgreSQL(id string) ([]byte, error)
	UpdatePostgreSQLDataCentres(id string, dataCentres []*models.PGDataCentre) error
	GetPostgreSQLConfigs(id string) ([]*models.PGConfigs, error)
	CreatePostgreSQLConfiguration(id, name, value string) error
	UpdatePostgreSQLConfiguration(id, name, value string) error
	ResetPostgreSQLConfiguration(id, name string) error
	GetCadence(id string) ([]byte, error)
	UpdatePostgreSQLDefaultUserPassword(id, password string) error
	ListClusters() ([]*models.ActiveClusters, error)
}

type Client

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

func NewClient

func NewClient(
	username string,
	key string,
	serverHostname string,
	timeout time.Duration,
) *Client

func (*Client) AddDataCentre

func (c *Client) AddDataCentre(id, clusterEndpoint string, dataCentre any) error

func (*Client) CreateCluster

func (c *Client) CreateCluster(url string, cluster any) (string, error)

func (*Client) CreateExclusionWindow

func (c *Client) CreateExclusionWindow(clusterID string, window clusterresourcesv1alpha1.ExclusionWindowSpec) (string, error)

func (*Client) CreateFirewallRule

func (c *Client) CreateFirewallRule(
	url string,
	firewallRuleSpec any,
) (*clusterresourcesv1alpha1.FirewallRuleStatus, error)

func (*Client) CreateKafkaACL

func (*Client) CreateKafkaMirror

func (c *Client) CreateKafkaMirror(url string, m *kafkamanagementv1alpha1.Mirror) error

func (*Client) CreateKafkaTopic

func (c *Client) CreateKafkaTopic(url string, t *kafkamanagementv1alpha1.Topic) error

func (*Client) CreateKafkaUser

func (c *Client) CreateKafkaUser(
	url string,
	kafkaUser *models.KafkaUser,
) (*kafkamanagementv1alpha1.KafkaUserStatus, error)

func (*Client) CreateNodeReload

func (c *Client) CreateNodeReload(nr *clusterresourcesv1alpha1.Node) error

func (*Client) CreatePeering

func (c *Client) CreatePeering(url string, peeringSpec any) (*clusterresourcesv1alpha1.PeeringStatus, error)

func (*Client) CreatePostgreSQLConfiguration

func (c *Client) CreatePostgreSQLConfiguration(id, name, value string) error

func (*Client) CreateRedisUser added in v0.0.2

func (c *Client) CreateRedisUser(user *models.RedisUser) (string, error)

func (*Client) DeleteCluster

func (c *Client) DeleteCluster(id, clusterEndpoint string) error

func (*Client) DeleteExclusionWindow

func (c *Client) DeleteExclusionWindow(id string) error

func (*Client) DeleteFirewallRule

func (c *Client) DeleteFirewallRule(
	firewallRuleID string,
	firewallRuleEndpoint string,
) error

func (*Client) DeleteKafkaACL

func (c *Client) DeleteKafkaACL(
	kafkaACLID,
	kafkaACLEndpoint string,
) error

func (*Client) DeleteKafkaMirror

func (c *Client) DeleteKafkaMirror(url, id string) error

func (*Client) DeleteKafkaTopic

func (c *Client) DeleteKafkaTopic(url, id string) error

func (*Client) DeleteKafkaUser

func (c *Client) DeleteKafkaUser(kafkaUserID, kafkaUserEndpoint string) error

func (*Client) DeletePeering

func (c *Client) DeletePeering(peerID, peeringEndpoint string) error

func (*Client) DeleteRedisUser added in v0.0.2

func (c *Client) DeleteRedisUser(id string) error

func (*Client) DoRequest

func (c *Client) DoRequest(url string, method string, data []byte) (*http.Response, error)

func (*Client) GetActiveDataCentreResizeOperations

func (c *Client) GetActiveDataCentreResizeOperations(clusterID, dataCentreID string) ([]*models.DataCentreResizeOperations, error)

func (*Client) GetCadence added in v0.0.2

func (c *Client) GetCadence(id string) ([]byte, error)

func (*Client) GetCassandra

func (c *Client) GetCassandra(id string) ([]byte, error)

func (*Client) GetClusterBackups

func (c *Client) GetClusterBackups(endpoint, clusterID string) (*models.ClusterBackup, error)

func (*Client) GetClusterConfigurations

func (c *Client) GetClusterConfigurations(clusterEndpoint, clusterID, bundle string) (map[string]string, error)

func (*Client) GetExclusionWindowsStatuses added in v0.0.2

func (c *Client) GetExclusionWindowsStatuses(clusterID string) ([]*clusterresourcesv1alpha1.ExclusionWindowStatus, error)

func (*Client) GetFirewallRuleStatus

func (c *Client) GetFirewallRuleStatus(
	firewallRuleID string,
	firewallRuleEndpoint string,
) (*clusterresourcesv1alpha1.FirewallRuleStatus, error)

func (*Client) GetKafka added in v0.0.2

func (c *Client) GetKafka(id string) ([]byte, error)

func (*Client) GetKafkaACLStatus

func (c *Client) GetKafkaACLStatus(
	kafkaACLID,
	kafkaACLEndpoint string,
) (*kafkamanagementv1alpha1.KafkaACLStatus, error)

func (*Client) GetKafkaConnect added in v0.0.2

func (c *Client) GetKafkaConnect(id string) ([]byte, error)

func (*Client) GetKafkaUserStatus

func (c *Client) GetKafkaUserStatus(
	kafkaUserID,
	kafkaUserEndpoint string,
) (*kafkamanagementv1alpha1.KafkaUserStatus, error)

func (*Client) GetMaintenanceEvents added in v0.0.2

func (c *Client) GetMaintenanceEvents(clusterID string) ([]*v1alpha1.MaintenanceEvent, error)

func (*Client) GetMaintenanceEventsStatuses added in v0.0.2

func (c *Client) GetMaintenanceEventsStatuses(clusterID string) ([]*clusterresourcesv1alpha1.MaintenanceEventStatus, error)

func (*Client) GetMirrorStatus

func (c *Client) GetMirrorStatus(id, mirrorEndpoint string) (*kafkamanagementv1alpha1.MirrorStatus, error)

func (*Client) GetNodeReloadStatus

func (c *Client) GetNodeReloadStatus(nodeID string) (*models.NodeReloadStatus, error)

func (*Client) GetOpenSearch added in v0.0.2

func (c *Client) GetOpenSearch(id string) ([]byte, error)

func (*Client) GetPeeringStatus

func (c *Client) GetPeeringStatus(peerID,
	peeringEndpoint string,
) (*clusterresourcesv1alpha1.PeeringStatus, error)

func (*Client) GetPostgreSQL

func (c *Client) GetPostgreSQL(id string) ([]byte, error)

func (*Client) GetPostgreSQLConfigs

func (c *Client) GetPostgreSQLConfigs(id string) ([]*models.PGConfigs, error)

func (*Client) GetRedis added in v0.0.2

func (c *Client) GetRedis(id string) ([]byte, error)

func (*Client) GetTopicStatus added in v0.0.2

func (c *Client) GetTopicStatus(id string) (*kafkamanagementv1alpha1.TopicStatus, error)

func (*Client) GetZookeeper added in v0.0.2

func (c *Client) GetZookeeper(id string) ([]byte, error)

func (*Client) ListClusters added in v0.0.2

func (c *Client) ListClusters() ([]*models.ActiveClusters, error)

func (*Client) ResetClusterConfiguration

func (c *Client) ResetClusterConfiguration(clusterEndpoint, clusterID, bundle, paramName string) error

func (*Client) ResetPostgreSQLConfiguration

func (c *Client) ResetPostgreSQLConfiguration(id, name string) error

func (*Client) RestoreCassandra

func (c *Client) RestoreCassandra(restoreData v1alpha1.CassandraRestoreFrom) (string, error)

func (*Client) RestoreOpenSearchCluster

func (c *Client) RestoreOpenSearchCluster(restoreData *v1alpha1.OpenSearchRestoreFrom) (string, error)

func (*Client) RestorePgCluster

func (c *Client) RestorePgCluster(restoreData *v1alpha1.PgRestoreFrom) (string, error)

func (*Client) RestoreRedisCluster

func (c *Client) RestoreRedisCluster(restoreData *v1alpha1.RedisRestoreFrom) (string, error)

func (*Client) TriggerClusterBackup

func (c *Client) TriggerClusterBackup(url, clusterID string) error

func (*Client) UpdateCassandra added in v0.0.2

func (c *Client) UpdateCassandra(id string, cassandra models.CassandraClusterAPIUpdate) error

func (*Client) UpdateCluster

func (c *Client) UpdateCluster(id, clusterEndpoint string, InstaDCs any) error

func (*Client) UpdateClusterConfiguration

func (c *Client) UpdateClusterConfiguration(clusterEndpoint, clusterID, bundle, paramName, paramValue string) error

func (*Client) UpdateDescriptionAndTwoFactorDelete

func (c *Client) UpdateDescriptionAndTwoFactorDelete(clusterEndpoint, clusterID, description string, twoFactorDelete *v1alpha1.TwoFactorDelete) error

func (*Client) UpdateKafkaACL

func (c *Client) UpdateKafkaACL(
	kafkaACLID,
	kafkaACLEndpoint string,
	kafkaACLSpec any,
) error

func (*Client) UpdateKafkaConnect added in v0.0.2

func (c *Client) UpdateKafkaConnect(id string, kc models.KafkaConnectAPIUpdate) error

func (*Client) UpdateKafkaMirror

func (c *Client) UpdateKafkaMirror(url string, m *kafkamanagementv1alpha1.Mirror) error

func (*Client) UpdateKafkaTopic

func (c *Client) UpdateKafkaTopic(url string, t *kafkamanagementv1alpha1.Topic) error

func (*Client) UpdateKafkaUser

func (c *Client) UpdateKafkaUser(
	kafkaUserID string,
	kafkaUserSpec *models.KafkaUser,
) error

func (*Client) UpdateNodeSize

func (c *Client) UpdateNodeSize(clusterEndpoint string, resizeRequest *models.ResizeRequest) error

func (*Client) UpdatePeering

func (c *Client) UpdatePeering(peerID,
	peeringEndpoint string,
	peerSpec any,
) error

func (*Client) UpdatePostgreSQLConfiguration

func (c *Client) UpdatePostgreSQLConfiguration(id, name, value string) error

func (*Client) UpdatePostgreSQLDataCentres

func (c *Client) UpdatePostgreSQLDataCentres(id string, dataCentres []*models.PGDataCentre) error

func (*Client) UpdatePostgreSQLDefaultUserPassword added in v0.0.2

func (c *Client) UpdatePostgreSQLDefaultUserPassword(id, password string) error

func (*Client) UpdateRedisUser added in v0.0.2

func (c *Client) UpdateRedisUser(user *models.RedisUserUpdate) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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