api

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EndpointGlobal = "https://app.databend.com"
	EndpointCN     = "https://app.databend.cn"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	UserEmail        string
	Password         string
	AccessToken      string
	RefreshToken     string
	CurrentOrgSlug   string
	CurrentWarehouse string
	Endpoint         string
}

func NewApiClient

func NewApiClient() *APIClient

func (*APIClient) CreateWarehouse

func (c *APIClient) CreateWarehouse(warehouseName, size string) error

func (*APIClient) CreateWarehouseAndWaitRunning

func (c *APIClient) CreateWarehouseAndWaitRunning(warehouseName, size string) error

func (*APIClient) DeleteWarehouse

func (c *APIClient) DeleteWarehouse(warehouseName string) error

func (*APIClient) DoRequest

func (c *APIClient) DoRequest(method, path string, headers http.Header, req interface{}, resp interface{}) error

func (*APIClient) GetCurrentAccountInfo

func (c *APIClient) GetCurrentAccountInfo() (*AccountInfoDTO, error)

func (*APIClient) ListOrgs

func (c *APIClient) ListOrgs() ([]string, error)

func (*APIClient) ListWarehouses

func (c *APIClient) ListWarehouses() ([]WarehouseStatusDTO, error)

func (*APIClient) Login

func (c *APIClient) Login() error

func (*APIClient) Query

func (c *APIClient) Query(warehouseName, query string) (*QueryResponse, error)

func (*APIClient) QueryPage

func (c *APIClient) QueryPage(warehouseName, queryId, path string) (*QueryResponse, error)

func (*APIClient) QuerySync

func (c *APIClient) QuerySync(warehouseName string, sql string, respCh chan QueryResponse) error

func (*APIClient) RefreshTokens

func (c *APIClient) RefreshTokens() error

RefreshTokens every api cmd

func (*APIClient) ResumeWarehouse

func (c *APIClient) ResumeWarehouse(warehouseName string) error

func (*APIClient) SuspendWarehouse

func (c *APIClient) SuspendWarehouse(warehouseName string) error

func (*APIClient) UploadToStageByPresignURL

func (c *APIClient) UploadToStageByPresignURL(presignURL, fileName string, header map[string]interface{}, displayProgress bool) error

func (*APIClient) ViewWarehouse

func (c *APIClient) ViewWarehouse(warehouseName string) (*WarehouseStatusDTO, error)

type AccountID

type AccountID uint64

type AccountInfoDTO

type AccountInfoDTO struct {
	ID              uint64    `json:"id"`
	Email           string    `json:"email"`
	Name            string    `json:"name"`
	State           string    `json:"state"`
	AvatarURL       string    `json:"avatarURL"`
	DefaultOrgSlug  string    `json:"defaultOrgSlug"`
	PasswordEnabled bool      `json:"passwordEnabled"`
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
}

type CreateWarehouseRequestBody

type CreateWarehouseRequestBody struct {
	ImageTag  string `json:"imageTag,omitempty"`
	Instances int64  `json:"instances,omitempty"`
	Name      string `json:"name,omitempty"`
	Size      string `json:"size,omitempty"`
}

type MemberKind

type MemberKind string

type OrgMemberID

type OrgMemberID uint64

type OrgMembershipDTO

type OrgMembershipDTO struct {
	ID               OrgMemberID `json:"id"`
	AccountID        *AccountID  `json:"accountID"`
	AccountName      string      `json:"accountName"`
	AccountEmail     string      `json:"accountEmail"`
	OrgAvatarURL     string      `json:"orgAvatarURL"`
	AccountAvatarURL string      `json:"accountAvatarURL"`
	OrgSlug          string      `json:"orgSlug"`
	OrgName          string      `json:"orgName"`
	OrgState         string      `json:"orgState"`
	OrgTenantID      string      `json:"tenantID"`
	Region           string      `json:"region"`
	Provider         string      `json:"provider"`
	MemberKind       MemberKind  `json:"memberKind"`
	State            string      `json:"state"`
	UpdatedAt        time.Time   `json:"updatedAt"`
	CreatedAt        time.Time   `json:"createdAt"`
}

type QueryError

type QueryError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Kind    string `json:"kind"`
}

type QueryProgress

type QueryProgress struct {
	Bytes uint64 `json:"bytes"`
	Rows  uint64 `json:"rows"`
}

type QueryRequest

type QueryRequest struct {
	SQL string `json:"sql"`
}

type QueryResponse

type QueryResponse struct {
	Data     [][]interface{} `json:"data"`
	Error    *QueryError     `json:"error"`
	FinalURI string          `json:"final_uri"`
	Id       string          `json:"id"`
	NextURI  string          `json:"next_uri"`
	Schema   struct {
		Fields []struct {
			Name     string      `json:"name"`
			DataType interface{} `json:"data_type"`
		} `json:"fields"`
	} `json:"schema,omitempty"`
	State    string     `json:"state"`
	Stats    QueryStats `json:"stats"`
	StatsURI string     `json:"stats_uri"`
}

type QueryStats

type QueryStats struct {
	RunningTimeMS float64       `json:"running_time_ms"`
	ScanProgress  QueryProgress `json:"scan_progress"`
}

type WarehouseStatusDTO

type WarehouseStatusDTO struct {
	Name           string `json:"id,omitempty"`
	ReadyInstances int64  `json:"readyInstances,omitempty"`
	Size           string `json:"size,omitempty"`
	State          string `json:"state,omitempty"`
	TotalInstances int64  `json:"totalInstances,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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