client

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseUrlFrom added in v0.0.4

func BaseUrlFrom(cloudRegionId string) string

Types

type Client

type Client struct {
	RegionId string

	HttpClient HttpClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...Option) (*Client, error)

func (*Client) Clone added in v0.0.4

func (client *Client) Clone(opts ...Option) (*Client, error)

func (*Client) CreateCluster

func (c *Client) CreateCluster(params CreateClusterParams) (*CreateClusterResponse, error)

func (*Client) CreateServerlessCluster

func (c *Client) CreateServerlessCluster(params CreateServerlessClusterParams) (*CreateClusterResponse, error)

func (*Client) DescribeCluster

func (c *Client) DescribeCluster(clusterId string) (Cluster, error)

func (*Client) DropCluster

func (c *Client) DropCluster(clusterId string) (*string, error)

func (*Client) ListCloudProviders

func (c *Client) ListCloudProviders() ([]CloudProvider, error)

func (*Client) ListCloudRegions

func (c *Client) ListCloudRegions(cloudId string) ([]CloudRegion, error)

func (*Client) ListClusters

func (c *Client) ListClusters() (Clusters, error)

func (*Client) ListProjects

func (c *Client) ListProjects() ([]Project, error)

func (*Client) ModifyCluster

func (c *Client) ModifyCluster(clusterId string, params *ModifyClusterParams) (*string, error)

type CloudId added in v0.0.4

type CloudId string
var (
	AWS          CloudId = "aws"
	Azure        CloudId = "azure"
	GCP          CloudId = "gcp"
	AliCloud     CloudId = "ali"
	TencentCloud CloudId = "tc"
)

type CloudProvider

type CloudProvider struct {
	CloudId     CloudId `json:"cloudId"`
	Description string  `json:"description"`
}

type CloudRegion

type CloudRegion struct {
	ApiBaseUrl string `json:"apiBaseUrl"`
	CloudId    string `json:"cloudId"`
	RegionId   string `json:"regionId"`
}

type Cluster

type Cluster struct {
	ClusterId          string `json:"clusterId"`
	ClusterName        string `json:"clusterName"`
	Description        string `json:"description"`
	RegionId           string `json:"regionId"`
	ClusterType        string `json:"clusterType"`
	Plan               Plan   `json:"plan"`
	CuSize             int64  `json:"cuSize"`
	Status             string `json:"status"`
	ConnectAddress     string `json:"connectAddress"`
	PrivateLinkAddress string `json:"privateLinkAddress"`
	CreateTime         string `json:"createTime"`
	ProjectId          string `json:"projectId"`
}

type Clusters

type Clusters struct {
	Clusters []Cluster `json:"clusters"`
	// contains filtered or unexported fields
}

type CreateClusterParams

type CreateClusterParams struct {
	Plan        Plan   `json:"plan"`
	ClusterName string `json:"clusterName"`
	CUSize      int    `json:"cuSize"`
	CUType      string `json:"cuType"`
	ProjectId   string `json:"projectId"`
	RegionId    string
}

type CreateClusterResponse

type CreateClusterResponse struct {
	ClusterId string `json:"clusterId"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Prompt    string `json:"prompt"`
}

type CreateServerlessClusterParams

type CreateServerlessClusterParams struct {
	ClusterName string `json:"clusterName"`
	ProjectId   string `json:"projectId"`
	Plan        Plan   `json:"plan,omitempty"`
	RegionId    string
}

type DropClusterResponse

type DropClusterResponse struct {
	ClusterId string `json:"clusterId"`
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (Error) Error

func (err Error) Error() string

func (Error) Is added in v0.0.4

func (err Error) Is(target error) bool

type HttpClient added in v0.0.4

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

type ModifyClusterParams

type ModifyClusterParams struct {
	CuSize int `json:"cuSize"`
}

type ModifyClusterResponse

type ModifyClusterResponse struct {
	ClusterId string `json:"clusterId"`
}

type Option added in v0.0.4

type Option func(*Client)

func OverrideBaseUrl added in v0.0.4

func OverrideBaseUrl() Option

func WithApiKey added in v0.0.4

func WithApiKey(apiKey string) Option

func WithBaseUrl added in v0.0.4

func WithBaseUrl(baseUrl string) Option

func WithCloudRegionId added in v0.0.4

func WithCloudRegionId(cloudRegionId string) Option

func WithDefaultBaseUrl added in v0.0.4

func WithDefaultBaseUrl() Option

func WithDefaultClient added in v0.0.4

func WithDefaultClient() Option

func WithDefaultRegion added in v0.0.4

func WithDefaultRegion() Option

func WithDefaultUserAgent added in v0.0.4

func WithDefaultUserAgent() Option

func WithHTTPClient added in v0.0.4

func WithHTTPClient(client HttpClient) Option

func WithUserAgent added in v0.0.4

func WithUserAgent(userAgent string) Option

type Plan added in v0.0.4

type Plan string
var (
	FreePlan       Plan = "Free"
	ServerlessPlan Plan = "Serverless"
	StandardPlan   Plan = "Standard"
	EnterprisePlan Plan = "Enterprise"
)

type Project

type Project struct {
	ProjectId       string `json:"projectId"`
	ProjectName     string `json:"projectName"`
	CreateTimeMilli int64  `json:"createTimeMilli"`
	InstanceCount   int64  `json:"instanceCount"`
}

Jump to

Keyboard shortcuts

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