api

package
v0.0.0-...-675700b Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Web      bool   `json:"web"`
}

type Client

type Client interface {
	// Auth
	// Login will login the user and get the response.
	Login(*AuthRequest) (int, error)
	// Signup will register the user
	Signup(*CreateUserRequest) (int, error)
	// GetLoginCookie get the inside login cookie.
	GetLoginCookie() LoginCookie

	// Environment
	// CreateEnvironment creates the environment.
	CreateEnvironment(ctx context.Context, environmentID string, create *EnvironmentMessage) (*EnvironmentMessage, error)
	// GetEnvironment gets the environment by id.
	GetEnvironment(ctx context.Context, environmentID string) (*EnvironmentMessage, error)

	// Instance
	// ListInstance will return instances in environment.
	GetInstance(ctx context.Context, find *InstanceFindMessage) (*InstanceMessage, error)
	// CreateInstance creates the instance.
	CreateInstance(ctx context.Context, environmentID, instanceID string, instance *InstanceMessage) (*InstanceMessage, error)
}

Client is the API message for Bytebase OpenAPI client.

type CreateUserRequest

type CreateUserRequest struct {
	Email    string   `json:"email"`
	Password string   `json:"password"`
	Type     UserType `json:"userType"`
	Name     string   `json:"name"`
	Title    string   `json:"title"`
}

a.k.a SignupRequest

type DataSourceMessage

type DataSourceMessage struct {
	Title    string         `json:"title"`
	Type     DataSourceType `json:"type"`
	Username string         `json:"username"`
	Password string         `json:"password"`
	SslCa    string         `json:"sslCa"`
	SslCert  string         `json:"sslCert"`
	SslKey   string         `json:"sslKey"`
	Host     string         `json:"host"`
	Port     string         `json:"port"`
	Database string         `json:"database"`
}

DataSourceMessage is the API message for a data source.

type DataSourceType

type DataSourceType string

DataSourceType is the type for data source.

const (
	// DataSourceAdmin is the ADMIN type of data source.
	DataSourceAdmin DataSourceType = "ADMIN"
	// DataSourceRO is the read-only type of data source.
	DataSourceRO DataSourceType = "READ_ONLY"
)

type EngineType

type EngineType string

EngineType is the type of the instance engine.

const (
	// EngineTypeMySQL is the database type for MYSQL.
	EngineTypeMySQL EngineType = "MYSQL"
	// EngineTypePostgres is the database type for POSTGRES.
	EngineTypePostgres EngineType = "POSTGRES"
	// EngineTypeTiDB is the database type for TiDB.
	EngineTypeTiDB EngineType = "TIDB"
	// EngineTypeSnowflake is the database type for SNOWFLAKE.
	EngineTypeSnowflake EngineType = "SNOWFLAKE"
	// EngineTypeClickHouse is the database type for CLICKHOUSE.
	EngineTypeClickHouse EngineType = "CLICKHOUSE"
	// EngineTypeMongoDB is the database type for MongoDB.
	EngineTypeMongoDB EngineType = "MONGODB"
	// EngineTypeSQLite is the database type for SQLite.
	EngineTypeSQLite EngineType = "SQLITE"
)

type EnvironmentMessage

type EnvironmentMessage struct {
	UID string `json:"uid"`

	// Domain specific fields
	Name  string `json:"name"`
	Title string `json:"title"`
	Order int    `json:"order"`
	State State  `json:"state,omitempty"`
	Tier  string `json:"tier"`
}

EnvironmentMessage is the API message for an environment.

type EnvironmentPatchMessage

type EnvironmentPatchMessage struct {
	Title *string `json:"title,omitempty"`
	Order *int    `json:"order,omitempty"`
	Tier  *string `json:"tier,omitempty"`
}

EnvironmentPatchMessage is the API message to patch the environment.

type GetUserResponse

type GetUserResponse struct {
	Email      string `json:"email"`
	Password   string `json:"password"`
	Type       string `json:"userType"`
	Name       string `json:"name"`
	Title      string `json:"title"`
	State      string `json:"state"`
	ServiceKey string `json:"serviceKey"`
}

type Instance

type Instance struct {
	// Related fields
	EnvironmentID string `json:"environmentId"`
	// Domain specific fields
	Name         string     `json:"name"`
	Engine       EngineType `json:"engine"`
	Host         string     `json:"host"`
	ExternalLink string     `json:"externalLink,omitempty"`
	Port         string     `json:"port,omitempty"`
	Username     string     `json:"username"`
	Password     string     `json:"password"`
}

check InstanceCreate ref: https://github.com/bytebase/bytebase/blob/cf5e0927a91c0c52ace4ff141c69875c2aa679c3/frontend/src/types/instance.ts#L91

type InstanceFindMessage

type InstanceFindMessage struct {
	EnvironmentID string
	InstanceID    string
	ShowDeleted   bool
}

InstanceFindMessage is the API message for finding instance.

type InstanceMessage

type InstanceMessage struct {
	UID          string               `json:"uid"`
	Name         string               `json:"name"`
	State        State                `json:"state,omitempty"`
	Title        string               `json:"title"`
	Engine       EngineType           `json:"engine"`
	ExternalLink string               `json:"externalLink"`
	DataSources  []*DataSourceMessage `json:"dataSources"`
}

InstanceMessage is the API message for an instance.

type InstancePatchMessage

type InstancePatchMessage struct {
	Title        *string              `json:"title,omitempty"`
	ExternalLink *string              `json:"externalLink,omitempty"`
	DataSources  []*DataSourceMessage `json:"dataSources,omitempty"`
}

InstancePatchMessage is the API message to patch the instance.

type ListEnvironmentMessage

type ListEnvironmentMessage struct {
	Environments  []*EnvironmentMessage `json:"environments"`
	NextPageToken string                `json:"nextPageToken"`
}

ListEnvironmentMessage is the API message for list environment response.

type ListInstanceMessage

type ListInstanceMessage struct {
	Instances     []*InstanceMessage `json:"instances"`
	NextPageToken string             `json:"nextPageToken"`
}

ListInstanceMessage is the API message for list instance response.

type LoginCookie

type LoginCookie struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
	User         string `json:"user"`
}

All needed cookies after login

type Role

type Role struct {
	Name            string         `json:"name"`
	RoleName        string         `json:"roleName"`
	ConnectionLimit int            `json:"connectionLimit"`
	ValidUntil      *string        `json:"validUntil"`
	Attribute       *RoleAttribute `json:"attribute"`
}

Role is the API message for role.

type RoleAttribute

type RoleAttribute struct {
	SuperUser   bool `json:"superUser"`
	NoInherit   bool `json:"noInherit"`
	CreateRole  bool `json:"createRole"`
	CreateDB    bool `json:"createDb"`
	CanLogin    bool `json:"canLogin"`
	Replication bool `json:"replication"`
	ByPassRLS   bool `json:"bypassRls"`
}

RoleAttribute is the attribute for role.

type RoleUpsert

type RoleUpsert struct {
	RoleName        string         `json:"roleName"`
	Password        *string        `json:"password"`
	ConnectionLimit *int           `json:"connectionLimit"`
	ValidUntil      *string        `json:"validUntil"`
	Attribute       *RoleAttribute `json:"attribute"`
}

RoleUpsert is the API message for upserting a new role.

type State

type State string

State is the state for a row.

const (
	// Active is the state for a normal row.
	Active State = "ACTIVE"
	// Deleted is the state for an removed row.
	Deleted State = "DELETED"
)

type UserType

type UserType int32
const (
	// EndUser is the principal type for END_USER.
	// EndUser represents the human being using Bytebase.
	EndUser UserType = 1
	// ServiceAccount is the principal type for SERVICE_ACCOUNT.
	// ServiceAcount represents the external service calling Bytebase OpenAPI.
	ServiceAccount UserType = 2
	// SystemBot is the principal type for SYSTEM_BOT.
	// SystemBot represents the internal system bot performing operations.
	SystemBot UserType = 3

	// PrincipalIDForFirstUser is the principal id for the first user in workspace.
	PrincipalIDForFirstUser = "101"
)

https://github.com/bytebase/bytebase/blob/main/proto/generated-go/v1/auth_service.pb.go

Jump to

Keyboard shortcuts

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