client

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReplicasDefault        = 2
	DataTunnelCountDefault = 50
	RetryIntervalDefault   = "5s"
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code   int         `json:"code"`
	Data   interface{} `json:"data,omitempty"`
	Msg    string      `json:"msg"`
	Errors []struct {
		Resource string `json:"resource"`
		Field    string `json:"field"`
		Code     string `json:"code"`
	} `json:"errors,omitempty"`
}

APIError represents the error message that GitHub API returns. GitHub API doc: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#client-errors

func (*APIError) Error

func (e *APIError) Error() string

Error convert APIError to a human readable error and return.

type AddSaNsRequestBody

type AddSaNsRequestBody struct {
	ProjectName string `json:"project_name,omitempty"`
	ClusterName string `json:"cluster_name,omitempty"`
	SaName      string `json:"sa_name,omitempty"`
	Namespace   string `json:"namespace,omitempty"`
}

type CMClient

type CMClient struct {
	*req.Client
	// contains filtered or unexported fields
}

GithubClient is the go client for GitHub API.

func NewGithubClient

func NewGithubClient(baseurl string) *CMClient

NewGithubClient create a GitHub client.

func (*CMClient) Cluster_Create

func (c *CMClient) Cluster_Create(project_name, cluster_name, description string) (*clusterOne, error)

Cluster_Create /cluster/create

func (*CMClient) Cluster_Delete

func (c *CMClient) Cluster_Delete(project_name, cluster_name string) (*clusterData, error)

Cluster_Delete /cluster/delete

func (*CMClient) Cluster_GetId

func (c *CMClient) Cluster_GetId(project_name, cluster_name string) (*clusterData, error)

Cluster_GetId /cluster/get_id

func (*CMClient) Cluster_List

func (c *CMClient) Cluster_List(project_name, cluster_name string) (*clusterList, error)

Cluster_List /cluster/list

func (*CMClient) Cluster_Update

func (c *CMClient) Cluster_Update(cluster_id, project_name, new_cluster_name, new_description string) (*clusterData, error)

Cluster_Update /cluster/update

func (*CMClient) Cluster_label

func (c *CMClient) Cluster_label(project_name, label_key, label_value string) (*clusterList, error)

Cluster_Label /cluster/label

func (*CMClient) IsLogged

func (c *CMClient) IsLogged() bool

IsLogged return true is user is logged in, otherwise false.

func (*CMClient) Label_Create

func (c *CMClient) Label_Create(project_name, cluster_name, label_key, label_value string) (*labelList, error)

Label_Create /label/create

func (*CMClient) Label_Delete

func (c *CMClient) Label_Delete(project_name, cluster_name, label_key, label_value string) (*labelData, error)

Label_Delete /label/delete

func (*CMClient) Label_List

func (c *CMClient) Label_List(project_name, cluster_name string) (*labelList, error)

Label_List /label/list

func (*CMClient) LoginWithToken

func (c *CMClient) LoginWithToken(BearerAuthToken string) *CMClient

LoginWithToken login with GitHub personal access token.

func (*CMClient) Project_Create

func (c *CMClient) Project_Create(project_name, description string) (*projectOne, error)

Project_Create /project/create

func (*CMClient) Project_Delete

func (c *CMClient) Project_Delete(project_name string) (*projectData, error)

Project_Delete /project/delete

func (*CMClient) Project_GetId

func (c *CMClient) Project_GetId(project_name string) (*projectData, error)

Project_GetId /project/get_id

func (*CMClient) Project_List

func (c *CMClient) Project_List(project_name string) (*projectList, error)

Project_List /project/list

func (*CMClient) Project_Update

func (c *CMClient) Project_Update(project_id, new_project_name, new_description string) (*projectData, error)

Project_Update /project/update

func (*CMClient) Proxy_Create

func (c *CMClient) Proxy_Create(image, cluster, gatewayUrl, namespace string) (string, error)

Proxy_Create /console/proxies

func (*CMClient) Sa_AddNs

func (c *CMClient) Sa_AddNs(project_name, cluster_name, sa_name, namespace string) (*saList, error)

Sa_AddNs /sa/adns

func (*CMClient) Sa_Create

func (c *CMClient) Sa_Create(project_name, cluster_name, sa_name, sa_token, namespace string) (*saList, error)

Sa_Create /sa/create

func (*CMClient) Sa_DelNs

func (c *CMClient) Sa_DelNs(project_name, cluster_name, sa_name, namespace string) (*saData, error)

Sa_DelNs /sa/delns

func (*CMClient) Sa_Delete

func (c *CMClient) Sa_Delete(project_name, cluster_name, sa_name string) (*saData, error)

Sa_Delete /sa/delete

func (*CMClient) Sa_GetToken

func (c *CMClient) Sa_GetToken(project_name, cluster_name, ns_name string) (*saData, error)

Sa_GetToken /sa/gettoken

func (*CMClient) Sa_List

func (c *CMClient) Sa_List(project_name, cluster_name, sa_name string) (*saList, error)

Sa_List /sa/list

func (*CMClient) Sa_ListNs

func (c *CMClient) Sa_ListNs(project_name, cluster_name, sa_name string) (*nsList, error)

Sa_ListNs /sa/listns

func (*CMClient) Sa_Update

func (c *CMClient) Sa_Update(project_name, cluster_name, sa_name, sa_token string) (*saData, error)

Sa_Update /sa/update

func (*CMClient) SetDebug

func (c *CMClient) SetDebug(enable bool) *CMClient

SetDebug enable debug if set to true, disable debug if set to false.

func (*CMClient) User_Login

func (c *CMClient) User_Login(username, password string) (*UserData, error)

User_Login /user/login

func (*CMClient) User_VerifyToken

func (c *CMClient) User_VerifyToken(token string) (*UserData, error)

User_VerifyToken /user/verifyToken

type CluseterLabel

type CluseterLabel struct {
	ProjectName string `json:"project_name"`
	ClusterName string `json:"cluster_name"`
	Labels      string `json:"Labels"`
}

type CreateClusterRequestBody

type CreateClusterRequestBody struct {
	ProjectName string `json:"project_name,omitempty"`
	ClusterName string `json:"cluster_name,omitempty"`
	Description string `json:"description,omitempty"`
}

type CreateLabelRequestBody

type CreateLabelRequestBody struct {
	ProjectName string `json:"project_name,omitempty"`
	ClusterName string `json:"cluster_name,omitempty"`
	LabelKey    string `json:"label_key,omitempty"`
	LabelValue  string `json:"label_value,omitempty"`
}

type CreateSaRequestBody

type CreateSaRequestBody struct {
	ProjectName string `json:"project_name,omitempty"`
	ClusterName string `json:"cluster_name,omitempty"`
	SaName      string `json:"sa_name,omitempty"`
	SaToken     string `json:"sa_token,omitempty"`
	Namespace   string `json:"namespace,omitempty"`
}

type GlobalRes

type GlobalRes struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type ProjectRequestBody

type ProjectRequestBody struct {
	ProjectName string `json:"project_name,omitempty"`
	Description string `json:"description,omitempty"`
}

type ProxyRequestBody

type ProxyRequestBody struct {
	Image           string `json:"image"`
	Cluster         string `json:"cluster"`
	GatewayUrl      string `json:"gatewayUrl"`
	Namespace       string `json:"namespace,omitempty"`
	Replicas        int    `json:"replicas,omitempty"`
	RetryInterval   string `json:"retryInterval,omitempty"`
	DataTunnelCount int    `json:"dataTunnelCount,omitempty"`
}

type SaRes

type SaRes struct {
	ID        int32     `json:"id"`
	SaID      string    `json:"sa_id"`
	SaName    string    `json:"sa_name"`
	SaToken   string    `json:"sa_token"`
	NameSpace string    `json:"namespace"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type UpdateClusterRequestBody

type UpdateClusterRequestBody struct {
	ClusterName string `json:"cluster_name,omitempty"`
	Description string `json:"description,omitempty"`
}

type UpdateSaRequestBody

type UpdateSaRequestBody struct {
	SaToken string `json:"sa_token,omitempty"`
}

type UserData

type UserData struct {
	GlobalRes
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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