tidbcloudapi

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Host = "https://api.tidbcloud.com"
)

Variables

This section is empty.

Functions

func DeleteClusterByID

func DeleteClusterByID(projectID, clusterID uint64) error

deleteClusterByID delete a cluster

func DoGET

func DoGET(url string, payload, output interface{}) (*resty.Response, error)

func DoPOST

func DoPOST(url string, payload, output interface{}) (*resty.Response, error)

func InitClient

func InitClient(publicKey, privateKey string) error

func IsValidProjectID

func IsValidProjectID(projectID uint64) (bool, error)

func PauseClusterByID

func PauseClusterByID(projectID, clusterID uint64) error

func ResumeClusterByID

func ResumeClusterByID(projectID, clusterID uint64) error

Types

type Cluster

type Cluster struct {
	ID                uint64           `json:"id,string"`
	ProjectID         uint64           `json:"project_id,string"`
	Name              string           `json:"name"`
	Port              int32            `json:"port"`
	TiDBVersion       string           `json:"tidb_version"`
	ClusterType       string           `json:"cluster_type"`
	CloudProvider     string           `json:"cloud_provider"`
	Region            string           `json:"region"`
	Status            ClusterStatus    `json:"status"`
	CreateTimestamp   string           `json:"create_timestamp"`
	Config            ClusterConfig    `json:"config"`
	ConnectionStrings ConnectionString `json:"connection_strings"`
}

func GetClusterByName

func GetClusterByName(projectID uint64, clusterName string) (*Cluster, error)

type ClusterConfig

type ClusterConfig struct {
	RootPassword string     `json:"root_password"`
	Port         int32      `json:"port"`
	Paused       bool       `json:"paused"`
	Components   Components `json:"components"`
	IPAccessList []IPAccess `json:"ip_access_list"`
}

type ClusterPauseConfig

type ClusterPauseConfig struct {
	Config struct {
		Paused bool `json:"paused"`
	} `json:"config"`
}

type ClusterStatus

type ClusterStatus struct {
	TidbVersion   string `json:"tidb_version"`
	ClusterStatus string `json:"cluster_status"`
}

type ComponentTiDB

type ComponentTiDB struct {
	NodeSize       string `json:"node_size"`
	StorageSizeGib int    `json:"storage_size_gib,omitempty"`
	NodeQuantity   int    `json:"node_quantity"`
}

type ComponentTiFlash

type ComponentTiFlash struct {
	NodeSize       string `json:"node_size"`
	StorageSizeGib int32  `json:"storage_size_gib"`
	NodeQuantity   int32  `json:"node_quantity"`
}

type ComponentTiKV

type ComponentTiKV struct {
	NodeSize       string `json:"node_size"`
	StorageSizeGib int    `json:"storage_size_gib"`
	NodeQuantity   int    `json:"node_quantity"`
}

type Components

type Components struct {
	TiDB    *ComponentTiDB    `json:"tidb,omitempty"`
	TiKV    *ComponentTiKV    `json:"tikv,omitempty"`
	TiFlash *ComponentTiFlash `json:"tiflash,omitempty"`
}

type ConnectionString

type ConnectionString struct {
	Standard   string `json:"standard"`
	VpcPeering string `json:"vpc_peering"`
}

type CreateClusterReq

type CreateClusterReq struct {
	Name          string        `json:"name"`
	ClusterType   string        `json:"cluster_type"`
	CloudProvider string        `json:"cloud_provider"`
	Region        string        `json:"region"`
	Config        ClusterConfig `json:"config"`
}

type CreateClusterResp

type CreateClusterResp struct {
	ClusterID uint64 `json:"id,string"`
	Message   string `json:"message"`
}

func CreateDedicatedCluster

func CreateDedicatedCluster(projectID uint64, spec *Specification) (*CreateClusterResp, error)

createDedicatedCluster create a cluster in the given project

type GetAllClustersResp

type GetAllClustersResp struct {
	Items []Cluster `json:"items"`
	Total int64     `json:"total"`
}

type GetAllProjectsResp

type GetAllProjectsResp struct {
	Items []Project `json:"items"`
	Total int64     `json:"total"`
}

type GetSpecificationsResp

type GetSpecificationsResp struct {
	Items []Specification `json:"items"`
}

func GetSpecifications

func GetSpecifications() (*GetSpecificationsResp, error)

getSpecifications returns all the available specifications

type IPAccess

type IPAccess struct {
	CIDR        string `json:"cidr"`
	Description string `json:"description"`
}

type Project

type Project struct {
	ID              uint64 `json:"id,string"`
	OrgID           uint64 `json:"org_id,string"`
	Name            string `json:"name"`
	ClusterCount    int64  `json:"cluster_count"`
	UserCount       int64  `json:"user_count"`
	CreateTimestamp int64  `json:"create_timestamp,string"`
}

func GetAllProjects

func GetAllProjects() ([]Project, error)

getAllProjects list all projects in current organization

func GetProjectByName

func GetProjectByName(projectName string) (*Project, error)

type Specification

type Specification struct {
	ClusterType   string `json:"cluster_type"`
	CloudProvider string `json:"cloud_provider"`
	Region        string `json:"region"`
	Tidb          []struct {
		NodeSize          string `json:"node_size"`
		NodeQuantityRange struct {
			Min  int `json:"min"`
			Step int `json:"step"`
		} `json:"node_quantity_range"`
	} `json:"tidb"`
	Tikv []struct {
		NodeSize          string `json:"node_size"`
		NodeQuantityRange struct {
			Min  int `json:"min"`
			Step int `json:"step"`
		} `json:"node_quantity_range"`
		StorageSizeGibRange struct {
			Min int `json:"min"`
			Max int `json:"max"`
		} `json:"storage_size_gib_range"`
	} `json:"tikv"`
	Tiflash []struct {
		NodeSize          string `json:"node_size"`
		NodeQuantityRange struct {
			Step int `json:"step"`
		} `json:"node_quantity_range"`
		StorageSizeGibRange struct {
			Min int `json:"min"`
			Max int `json:"max"`
		} `json:"storage_size_gib_range"`
	} `json:"tiflash"`
}

func GetDedicatedSpec

func GetDedicatedSpec(specifications *GetSpecificationsResp) (*Specification, error)

Jump to

Keyboard shortcuts

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