Documentation
¶
Index ¶
- type ActivateUserRequest
- type ActivateUserResponse
- type Address
- type CreateDatasourceRequest
- type CreateDatasourceResponse
- type CreateUserRequest
- type CreateUsersResponse
- type DataSource
- type DataSourceStatus
- type DeleteDatasourceResponse
- type Environment
- type GetEnvironmentsResponse
- type GetOrganizationsResponse
- type GetPublicKeyResponse
- type LoginRequest
- type LoginResponse
- type Organization
- type SSLConfig
- type SqlWorkbenchClient
- func (c *SqlWorkbenchClient) ActivateUser(username, currentPassword, newPassword, publicKey, cookie string) (*ActivateUserResponse, error)
- func (c *SqlWorkbenchClient) CreateDatasources(datasource CreateDatasourceRequest, publicKey string, cookie string, ...) (*CreateDatasourceResponse, error)
- func (c *SqlWorkbenchClient) CreateUsers(users []CreateUserRequest, publicKey string, cookie string) (*CreateUsersResponse, error)
- func (c *SqlWorkbenchClient) DeleteDatasource(id int64, cookie string, organizationID int64) (*DeleteDatasourceResponse, error)
- func (c *SqlWorkbenchClient) EncryptPasswordWithRSA(password, publicKey string) (string, error)
- func (c *SqlWorkbenchClient) ExtractCookieValue(cookieStr, cookieName string) string
- func (c *SqlWorkbenchClient) GetEnvironments(organizationID int64, cookie string) (*GetEnvironmentsResponse, error)
- func (c *SqlWorkbenchClient) GetOrganizations(cookie string) (*GetOrganizationsResponse, error)
- func (c *SqlWorkbenchClient) GetPublicKey() (string, error)
- func (c *SqlWorkbenchClient) Login(username, password, publicKey string) (*LoginResponse, error)
- func (c *SqlWorkbenchClient) MergeCookies(xsrfTokenStr, jsessionIdStr string) string
- func (c *SqlWorkbenchClient) UpdateDatasource(datasourceId int64, updateDatasource UpdateDatasourceRequest, publicKey string, ...) (*CreateDatasourceResponse, error)
- type UpdateDatasourceRequest
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivateUserRequest ¶
type ActivateUserRequest struct {
Username string `json:"username"`
CurrentPassword string `json:"currentPassword"`
NewPassword string `json:"newPassword"`
}
ActivateUserRequest 激活用户请求结构
type ActivateUserResponse ¶
type ActivateUserResponse struct {
Data User `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
// 错误相关字段
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Error interface{} `json:"error,omitempty"`
}
ActivateUserResponse 激活用户响应结构
type Address ¶
type Address struct {
Country *string `json:"country"`
Formatted *string `json:"formatted"`
Locality *string `json:"locality"`
PostalCode *string `json:"postalCode"`
Region *string `json:"region"`
StreetAddress *string `json:"streetAddress"`
}
Address 地址结构
type CreateDatasourceRequest ¶
type CreateDatasourceRequest struct {
CreatorID int64 `json:"creatorId"`
Type string `json:"type"`
Name string `json:"name"`
Username string `json:"username"`
Password string `json:"password"`
SysTenantUsername *string `json:"sysTenantUsername"`
ServiceName *string `json:"serviceName"`
SSLConfig SSLConfig `json:"sslConfig"`
SysTenantPassword *string `json:"sysTenantPassword"`
Properties interface{} `json:"properties"`
EnvironmentID int64 `json:"environmentId"`
JdbcURLParameters map[string]interface{} `json:"jdbcUrlParameters"`
Host string `json:"host"`
Port string `json:"port"`
}
CreateDatasourceRequest 创建数据源请求结构
type CreateDatasourceResponse ¶
type CreateDatasourceResponse struct {
Data DataSource `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
// 错误相关字段
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Error interface{} `json:"error,omitempty"`
}
CreateDatasourceResponse 创建数据源响应结构
type CreateUserRequest ¶
type CreateUserRequest struct {
AccountName string `json:"accountName"`
Name string `json:"name"`
Password string `json:"password"`
Enabled bool `json:"enabled"`
RoleIDs []int64 `json:"roleIds"`
}
CreateUserRequest 创建用户请求结构
type CreateUsersResponse ¶
type CreateUsersResponse struct {
Data struct {
Contents []User `json:"contents"`
} `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
// 错误相关字段
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Error interface{} `json:"error,omitempty"`
}
CreateUsersResponse 创建用户响应结构
type DataSource ¶
type DataSource struct {
CatalogName *string `json:"catalogName"`
CloudProvider *string `json:"cloudProvider"`
ClusterName *string `json:"clusterName"`
ConnectType string `json:"connectType"`
CreateTime int64 `json:"createTime"`
CreatorID int64 `json:"creatorId"`
CreatorName *string `json:"creatorName"`
DbObjectLastSyncTime *int64 `json:"dbObjectLastSyncTime"`
DefaultSchema string `json:"defaultSchema"`
DialectType string `json:"dialectType"`
DssDataSourceID *string `json:"dssDataSourceId"`
Enabled bool `json:"enabled"`
EnvironmentID int64 `json:"environmentId"`
EnvironmentName string `json:"environmentName"`
EnvironmentStyle string `json:"environmentStyle"`
Host string `json:"host"`
ID int64 `json:"id"`
InstanceNickName *string `json:"instanceNickName"`
JdbcURLParameters map[string]interface{} `json:"jdbcUrlParameters"`
LabelIDs interface{} `json:"labelIds"`
LastAccessTime *int64 `json:"lastAccessTime"`
Name string `json:"name"`
ObtenantName *string `json:"obtenantName"`
OrganizationID int64 `json:"organizationId"`
OwnerID *string `json:"ownerId"`
PasswordSaved bool `json:"passwordSaved"`
PermittedActions interface{} `json:"permittedActions"`
Port int64 `json:"port"`
ProjectID *string `json:"projectId"`
ProjectName *string `json:"projectName"`
Properties map[string]interface{} `json:"properties"`
QueryTimeoutSeconds int64 `json:"queryTimeoutSeconds"`
ReadonlyUsername *string `json:"readonlyUsername"`
Region *string `json:"region"`
ServiceName *string `json:"serviceName"`
SessionInitScript *string `json:"sessionInitScript"`
SetTop bool `json:"setTop"`
Sid *string `json:"sid"`
SSLConfig SSLConfig `json:"sslConfig"`
Status DataSourceStatus `json:"status"`
SupportedOperations interface{} `json:"supportedOperations"`
SysTenantUsername *string `json:"sysTenantUsername"`
Temp bool `json:"temp"`
TenantName *string `json:"tenantName"`
TenantNickName *string `json:"tenantNickName"`
Type string `json:"type"`
UpdateTime int64 `json:"updateTime"`
UserRole *string `json:"userRole"`
Username string `json:"username"`
VisibleScope string `json:"visibleScope"`
}
DataSource 数据源结构
type DataSourceStatus ¶
type DataSourceStatus struct {
ErrorCode *string `json:"errorCode"`
ErrorMessage *string `json:"errorMessage"`
Status string `json:"status"`
Type *string `json:"type"`
}
DataSourceStatus 数据源状态结构
type DeleteDatasourceResponse ¶
type DeleteDatasourceResponse struct {
Data DataSource `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
// 错误相关字段
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Error interface{} `json:"error,omitempty"`
}
DeleteDatasourceResponse 删除数据源响应结构
type Environment ¶
type Environment struct {
BuiltIn bool `json:"builtIn"`
CreateTime int64 `json:"createTime"`
Creator *User `json:"creator"`
Description string `json:"description"`
Enabled bool `json:"enabled"`
ID int64 `json:"id"`
LastModifier *User `json:"lastModifier"`
Name string `json:"name"`
OrganizationID int64 `json:"organizationId"`
OriginalName string `json:"originalName"`
RulesetID int64 `json:"rulesetId"`
RulesetName *string `json:"rulesetName"`
Style string `json:"style"`
UpdateTime int64 `json:"updateTime"`
}
Environment 环境信息
type GetEnvironmentsResponse ¶
type GetEnvironmentsResponse struct {
Data struct {
Contents []Environment `json:"contents"`
} `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
}
GetEnvironmentsResponse 获取环境列表响应
type GetOrganizationsResponse ¶
type GetOrganizationsResponse struct {
Data struct {
Contents []Organization `json:"contents"`
} `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID *string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
XsrfToken string `json:"xsrfToken"`
// 错误相关字段
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Error interface{} `json:"error,omitempty"`
}
GetOrganizationsResponse 获取组织响应结构
type GetPublicKeyResponse ¶
type GetPublicKeyResponse struct {
Data string `json:"data"`
DurationMillis int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID *string `json:"requestId"`
Server string `json:"server"`
Successful bool `json:"successful"`
Timestamp float64 `json:"timestamp"`
TraceID string `json:"traceId"`
// 错误相关字段
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Error interface{} `json:"error,omitempty"`
}
GetPublicKeyResponse 获取公钥响应结构
type LoginRequest ¶
LoginRequest 登录请求结构
type LoginResponse ¶
type LoginResponse struct {
Data string `json:"data"`
DurationMillis *int64 `json:"durationMillis"`
HTTPStatus string `json:"httpStatus"`
RequestID *string `json:"requestId"`
Server *string `json:"server"`
Successful bool `json:"successful"`
Timestamp *int64 `json:"timestamp"`
TraceID *string `json:"traceId"`
// 错误相关字段
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Cookie string `json:"cookie"`
Error interface{} `json:"error"`
}
LoginResponse 登录响应结构
type Organization ¶
type Organization struct {
Builtin bool `json:"builtin"`
CreateTime int64 `json:"createTime"`
Description string `json:"description"`
DisplayName string `json:"displayName"`
ID int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
UniqueIdentifier string `json:"uniqueIdentifier"`
UpdateTime int64 `json:"updateTime"`
}
Organization 组织结构
type SSLConfig ¶
type SSLConfig struct {
Enabled bool `json:"enabled"`
CACertObjectID *string `json:"CACertObjectId,omitempty"`
CacertObjectID *string `json:"cacertObjectId,omitempty"`
ClientCertObjectID *string `json:"clientCertObjectId,omitempty"`
ClientKeyObjectID *string `json:"clientKeyObjectId,omitempty"`
}
SSLConfig SSL配置结构
type SqlWorkbenchClient ¶
type SqlWorkbenchClient struct {
// contains filtered or unexported fields
}
SqlWorkbenchClient SQL工作台HTTP客户端
func NewSqlWorkbenchClient ¶
func NewSqlWorkbenchClient(cfg *config.SqlWorkbenchOpts, logger utilLog.Logger) *SqlWorkbenchClient
NewSqlWorkbenchClient 创建SQL工作台客户端
func (*SqlWorkbenchClient) ActivateUser ¶
func (c *SqlWorkbenchClient) ActivateUser(username, currentPassword, newPassword, publicKey, cookie string) (*ActivateUserResponse, error)
ActivateUser 激活用户
func (*SqlWorkbenchClient) CreateDatasources ¶
func (c *SqlWorkbenchClient) CreateDatasources(datasource CreateDatasourceRequest, publicKey string, cookie string, organizationID int64) (*CreateDatasourceResponse, error)
CreateDatasources 创建数据源
func (*SqlWorkbenchClient) CreateUsers ¶
func (c *SqlWorkbenchClient) CreateUsers(users []CreateUserRequest, publicKey string, cookie string) (*CreateUsersResponse, error)
CreateUsers 创建用户
func (*SqlWorkbenchClient) DeleteDatasource ¶
func (c *SqlWorkbenchClient) DeleteDatasource(id int64, cookie string, organizationID int64) (*DeleteDatasourceResponse, error)
DeleteDatasource 删除数据源
func (*SqlWorkbenchClient) EncryptPasswordWithRSA ¶
func (c *SqlWorkbenchClient) EncryptPasswordWithRSA(password, publicKey string) (string, error)
EncryptPasswordWithRSA 使用RSA公钥加密密码(兼容JSEncrypt)
func (*SqlWorkbenchClient) ExtractCookieValue ¶
func (c *SqlWorkbenchClient) ExtractCookieValue(cookieStr, cookieName string) string
ExtractCookieValue 从Cookie字符串中提取指定名称的值
func (*SqlWorkbenchClient) GetEnvironments ¶
func (c *SqlWorkbenchClient) GetEnvironments(organizationID int64, cookie string) (*GetEnvironmentsResponse, error)
GetEnvironments 获取环境列表
func (*SqlWorkbenchClient) GetOrganizations ¶
func (c *SqlWorkbenchClient) GetOrganizations(cookie string) (*GetOrganizationsResponse, error)
GetOrganizations 获取组织信息
func (*SqlWorkbenchClient) GetPublicKey ¶
func (c *SqlWorkbenchClient) GetPublicKey() (string, error)
GetPublicKey 获取RSA公钥
func (*SqlWorkbenchClient) Login ¶
func (c *SqlWorkbenchClient) Login(username, password, publicKey string) (*LoginResponse, error)
Login 登录到SQL工作台
func (*SqlWorkbenchClient) MergeCookies ¶
func (c *SqlWorkbenchClient) MergeCookies(xsrfTokenStr, jsessionIdStr string) string
MergeCookies 合并XSRF-TOKEN和JSESSIONID
func (*SqlWorkbenchClient) UpdateDatasource ¶
func (c *SqlWorkbenchClient) UpdateDatasource(datasourceId int64, updateDatasource UpdateDatasourceRequest, publicKey string, cookie string, organizationID int64) (*CreateDatasourceResponse, error)
UpdateDatasource 修改数据源
type UpdateDatasourceRequest ¶
type UpdateDatasourceRequest struct {
Id int64 `json:"id"`
CreatorID *int64 `json:"creatorId"`
Type string `json:"type"`
Name *string `json:"name"`
Username string `json:"username"`
Password *string `json:"password"`
SysTenantUsername *string `json:"sysTenantUsername"`
ServiceName *string `json:"serviceName"`
SSLConfig SSLConfig `json:"sslConfig"`
SysTenantPassword *string `json:"sysTenantPassword"`
Properties *interface{} `json:"properties"`
EnvironmentID int64 `json:"environmentId"`
JdbcURLParameters *map[string]interface{} `json:"jdbcUrlParameters"`
Host string `json:"host"`
Port string `json:"port"`
}
UpdateDatasourceRequest 创建数据源请求结构
type User ¶
type User struct {
AccessTokenHash *string `json:"accessTokenHash"`
AccountName string `json:"accountName"`
AccountNonExpired bool `json:"accountNonExpired"`
AccountNonLocked bool `json:"accountNonLocked"`
Active bool `json:"active"`
Address Address `json:"address"`
Attributes interface{} `json:"attributes"`
Audience *string `json:"audience"`
AuthenticatedAt *int64 `json:"authenticatedAt"`
AuthenticationContextClass *string `json:"authenticationContextClass"`
AuthenticationMethods interface{} `json:"authenticationMethods"`
Authorities interface{} `json:"authorities"`
AuthorizationCodeHash *string `json:"authorizationCodeHash"`
AuthorizedActions interface{} `json:"authorizedActions"`
AuthorizedParty *string `json:"authorizedParty"`
Birthdate *string `json:"birthdate"`
BuiltIn bool `json:"builtIn"`
Claims map[string]interface{} `json:"claims"`
CreateTime int64 `json:"createTime"`
CreatorID int64 `json:"creatorId"`
CreatorName *string `json:"creatorName"`
CredentialsNonExpired bool `json:"credentialsNonExpired"`
Description *string `json:"description"`
Email *string `json:"email"`
EmailVerified *bool `json:"emailVerified"`
Enabled bool `json:"enabled"`
ExpiresAt *int64 `json:"expiresAt"`
ExtraProperties interface{} `json:"extraProperties"`
FamilyName *string `json:"familyName"`
FullName *string `json:"fullName"`
Gender *string `json:"gender"`
GivenName *string `json:"givenName"`
ID int64 `json:"id"`
IDToken *string `json:"idToken"`
IssuedAt *int64 `json:"issuedAt"`
Issuer *string `json:"issuer"`
LastLoginTime *int64 `json:"lastLoginTime"`
Locale *string `json:"locale"`
LoginTime *int64 `json:"loginTime"`
MiddleName *string `json:"middleName"`
Name string `json:"name"`
NickName *string `json:"nickName"`
Nonce *string `json:"nonce"`
OrganizationID int64 `json:"organizationId"`
OrganizationIDs interface{} `json:"organizationIds"`
OrganizationType *string `json:"organizationType"`
PhoneNumber *string `json:"phoneNumber"`
PhoneNumberVerified *bool `json:"phoneNumberVerified"`
Picture *string `json:"picture"`
PreferredUsername *string `json:"preferredUsername"`
Profile *string `json:"profile"`
ResourceManagementPermissions interface{} `json:"resourceManagementPermissions"`
RoleIDs interface{} `json:"roleIds"`
Roles interface{} `json:"roles"`
Subject *string `json:"subject"`
SystemOperationPermissions interface{} `json:"systemOperationPermissions"`
Type string `json:"type"`
UpdateTime int64 `json:"updateTime"`
UpdatedAt *int64 `json:"updatedAt"`
UserInfo interface{} `json:"userInfo"`
Username string `json:"username"`
Website *string `json:"website"`
ZoneInfo *string `json:"zoneInfo"`
}
User 用户结构