tenant

package
v0.0.0-...-61ee147 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

* Copyright (c) 2024 OceanBase. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright (c) 2024 OceanBase. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright (c) 2024 OceanBase. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	SCALE_IN_REPLICA = iota
	SCALE_OUT_REPLICA
	MODIFY_REPLICA_TYPE
)
View Source
const (
	// task param name
	PARAM_CREATE_TENANT                = "createTenant"
	PARAM_TENANT_VARIABLES             = "tenantVariables"
	PARAM_TENANT_NAME                  = "tenantName"
	PARAM_TENANT_TIME_ZONE             = "timeZone"
	PARAM_TENANT_ID                    = "tenantId"
	PARAM_ALTER_LOCALITY_TYPE          = "alterLocalityType"
	PARAM_TENANT_NEW_PASSWORD          = "newPassword"
	PARAM_TENANT_WHITELIST             = "whitelist"
	PARAM_TENANT_PARAMETER             = "tenantParameter"
	PARAM_DROP_RESOURCE_POOL_LIST      = "dropResourcePoolList"
	PARAM_SPLIT_RESOURCE_POOL_LIST     = "splitResourcePoolList"
	PARAM_TENANT_LOCALITY_ZONE         = "localityZone"
	PARAM_LOCALITY_TYPE                = "localityType"
	PARAM_TARGET_LOCALITY              = "targetLocality"
	PARAM_ZONE_PARAM                   = "zoneParam"
	PARAM_MODIFY_TENANT_REPLICAS_PARAM = "modifyTenantReplicasParam"
	PARAM_DELETE_TENANT_REPLICAS_PARAM = "deleteTenantReplicasParam"
	PARAM_ZONE_LIST                    = "zoneList"
	PARAM_TENANT_UNIT_NUM              = "tenantUnitNum"
	PARAM_TENANT_UNIT_NAME             = "tenantUnitName"
	PARAM_ZONE_NAME                    = "zoneName"
	PARAM_PRIMARY_ZONE                 = "primaryZone"
	PARAM_ZONE_WITH_UNIT               = "zoneWithUnit"
	PARAM_TIMESTAMP                    = "timestamp"

	// tenant task
	TASK_NAME_CREATE_AND_ATTACH_RESOURCE_POOL = "Create and attach resource pools"
	TASK_NAME_CREATE_TENANT                   = "Create tenant"
	TASK_NAME_OPTIMIZE_TENANT                 = "Optimize tenant"
	TASK_NAME_SET_TENANT_TIME_ZONE            = "Set tenant time zone"
	Task_NAME_MODIFY_WHITELIST                = "Modify tenant whitelist"
	TASK_NAME_MODIFY_PRIMARY_ZONE             = "Modify tenant primary zone"
	TASK_NAME_SET_ROOT_PWD                    = "Set root password"
	TASK_NAME_SET_TENANT_PARAM                = "Set tenant parameters"
	TASK_NAME_SET_TENANT_VARIABLE             = "Set tenant variables"
	TASK_NAME_DROP_RESOURCE_POOL              = "Drop resource pools"
	TASK_NAME_SET_TENANT_PARAMETER            = "Set tenant parameter"
	TASK_NAME_DROP_TENANT                     = "Drop tenant"
	TASK_NAME_RECYCLE_TENANT                  = "Recycle tenant"
	TASK_NAME_FLASHBACK_TENANT                = "Flashback tenant"
	TASK_NAME_SCALE_OUT_TENANT_LOCALITY       = "Scale out tenant locality"
	TASK_NAME_SPLIT_RESOURCE_POOL             = "Split resource pool"
	TASK_NAME_ALTER_RESOURCE_POOL_UNIT_CONF   = "Alter resource pool unit config"
	TASK_NAME_ALTER_RESOURCE_POOL_UNIT_NUM    = "Alter resource pool unit num"
	TASK_NAME_ATTACH_TENANT_RESOURCE_POOL     = "Attach tenant resource pool"
	TASK_NAME_ALTER_TENANT_LOCALITY           = "Alter tenant locality"
	TASK_NAME_ALTER_TENANT_PRIMARY_ZONE       = "Alter tenant primary zone"

	// tenant dag
	DAG_CREATE_TENANT              = "Create tenant %s"
	DAG_SET_ROOTPASSWORD           = "Set root password"
	DAG_DROP_TENANT                = "Drop tenant"
	DAG_SCALE_OUT_TENANT_REPLICA   = "Scale out tenant replicas"
	DAG_SCALE_IN_TENANT_REPLICA    = "Scale in tenant replicas"
	DAG_MODIFY_TENANT_REPLICA      = "Modify tenant replicas"
	DAG_MODIFY_TENANT_PRIMARY_ZONE = "Modify tenant primary zone"

	EXPRESS_OLTP = "express_oltp"
	COMPLEX_OLTP = "complex_oltp"
	OLAP         = "olap"
	OLTP         = "htap"
	KV           = "kv"

	NORMAL_TENANT = "NORMAL"

	VARIABLES_TEMPLATE  = "variables"
	PARAMETERS_TEMPLATE = "parameters"
)

Variables

This section is empty.

Functions

func AlterDatabase

func AlterDatabase(tenantName string, databaseName string, param *param.ModifyDatabaseParam) error

func ChangeUserPassword

func ChangeUserPassword(tenantName, userName string, p *param.ChangeUserPasswordParam) error

func CheckResourceEnough

func CheckResourceEnough(zoneList []param.ZoneParam) error

func ClearTenantCompactionError

func ClearTenantCompactionError(tenantName string) error

func CloseDbConnection

func CloseDbConnection(db *gorm.DB)

func CreateDatabase

func CreateDatabase(tenantName string, param *param.CreateDatabaseParam) error

func CreateRole

func CreateRole(name string, param *param.CreateRoleParam) error

func CreateTenant

func CreateTenant(param *param.CreateTenantParam) (*task.DagDetailDTO, error)

func CreateUser

func CreateUser(tenantName string, param *param.CreateUserParam) error

func DeleteDatabase

func DeleteDatabase(tenantName, databaseName string, password *string) error

func DropRole

func DropRole(tenantName, role string, param *param.DropRoleParam) error

func DropTenant

func DropTenant(param *param.DropTenantParam) (*task.DagDetailDTO, error)

func DropUser

func DropUser(tenantName, userName string, param *param.DropUserParam) error

func GetConnectionWithPassword

func GetConnectionWithPassword(tenantName string, password *string) (*gorm.DB, error)

func GetConnectionWithPasswordAndMode

func GetConnectionWithPasswordAndMode(tenantName string, password *string, mode string) (*gorm.DB, error)

func GetConnectionWithTenantInfo

func GetConnectionWithTenantInfo(tenantInfo *obmodel.DbaObTenant, password *string) (*gorm.DB, error)

func GetDatabase

func GetDatabase(tenantName, databaseName string, password *string) (*bo.Database, error)

func GetExecuteAgentForTenant

func GetExecuteAgentForTenant(tenantName string) (meta.AgentInfoInterface, error)

func GetRole

func GetRole(name, role string, password *string) (*bo.ObRole, error)

func GetTenantCompaction

func GetTenantCompaction(tenantName string) (*bo.TenantCompaction, error)

func GetTenantInfo

func GetTenantInfo(tenantName string) (*bo.TenantInfo, error)

func GetTenantParameter

func GetTenantParameter(tenantName string, parameterName string) (*oceanbase.GvObParameter, error)

func GetTenantParameters

func GetTenantParameters(tenantName string, filter string) ([]oceanbase.GvObParameter, error)

func GetTenantSession

func GetTenantSession(tenantName string, sessionId string) (*bo.TenantSession, error)

func GetTenantSessionStats

func GetTenantSessionStats(tenantName string) (*bo.TenantSessionStats, error)

func GetTenantSessions

func GetTenantSessions(tenantName string, p *param.QueryTenantSessionParam) (*bo.PaginatedTenantSessions, error)

func GetTenantVariable

func GetTenantVariable(tenantName string, variableName string) (*oceanbase.CdbObSysVariable, error)

func GetTenantVariables

func GetTenantVariables(tenantName string, filter string) ([]oceanbase.CdbObSysVariable, error)

func GetTenantsOverView

func GetTenantsOverView(mode string) ([]oceanbase.TenantOverview, error)

func GetTopCompactions

func GetTopCompactions(top int) ([]bo.TenantCompactionHistory, error)

func GetUser

func GetUser(tenantName, userName string, password *string) (*bo.ObUser, error)

func GetUserStats

func GetUserStats(tenantName, userName string) (*bo.ObUserStats, error)

func GrantRoleObjectPrivilege

func GrantRoleObjectPrivilege(name, role string, param *param.GrantObjectPrivilegeParam) error

func GrantUserObjectPrivilege

func GrantUserObjectPrivilege(tenantName, userName string, p *param.GrantObjectPrivilegeParam) error

func IsEmptyRootPassword

func IsEmptyRootPassword(tenantName string) (bool, error)

func KillTenantSessionQueries

func KillTenantSessionQueries(tenantName string, sessionId []int) error

func KillTenantSessions

func KillTenantSessions(tenantName string, sessionId []int) error

func ListDatabases

func ListDatabases(tenantName string, password *string) ([]bo.Database, error)

func ListObjects

func ListObjects(tenantName string, password *string) ([]bo.DbaObjectBo, error)

func ListRoles

func ListRoles(name string, password *string) ([]bo.ObRole, error)

func ListTenantDeadLocks

func ListTenantDeadLocks(tenantName string, p *param.QueryTenantDeadLocksParam) (*bo.PaginatedDeadLocks, error)

Compatible with OceanBase versions 4.2.5.x, 4.3.x, and later.

func ListUsers

func ListUsers(tenantName string, password *string, queryParam *param.ListUsersQueryParam) ([]bo.ObUser, error)

func LockTenant

func LockTenant(tenantName string) error

func LockUser

func LockUser(tenantName, userName string, password *string) error

func ModifyRole

func ModifyRole(name, role string, param *param.ModifyRoleParam) error

func ModifyRoleGlobalPrivilege

func ModifyRoleGlobalPrivilege(name, role string, param *param.ModifyRoleGlobalPrivilegeParam) error

func ModifyRoleObjectPrivilege

func ModifyRoleObjectPrivilege(tenantName, role string, param *param.ModifyObjectPrivilegeParam) error

func ModifyTenantPrimaryZone

func ModifyTenantPrimaryZone(tenantName string, param *param.ModifyTenantPrimaryZoneParam) (*task.DagDetailDTO, error)

func ModifyTenantReplica

func ModifyTenantReplica(tenantName string, param *param.ModifyReplicasParam) (*task.DagDetailDTO, error)

func ModifyTenantRootPassword

func ModifyTenantRootPassword(c *gin.Context, tenantName string, pwdParam param.ModifyTenantRootPasswordParam) (error, bool)

func ModifyTenantWhitelist

func ModifyTenantWhitelist(tenantName string, whitelist string) error

func ModifyUserDbPrivilege

func ModifyUserDbPrivilege(tenantName, userName string, p *param.ModifyUserDbPrivilegeParam) error

func ModifyUserGlobalPrivilege

func ModifyUserGlobalPrivilege(tenantName, userName string, p *param.ModifyUserGlobalPrivilegeParam) error

func ModifyUserObjectPrivilege

func ModifyUserObjectPrivilege(tenantName, userName string, p *param.ModifyObjectPrivilegeParam) error

func ModifyUserRole

func ModifyUserRole(tenantName, userName string, p *param.ModifyRoleParam) error

func PatchRoleObjectPrivilege

func PatchRoleObjectPrivilege(name, role string, param *param.ModifyObjectPrivilegeParam) error

func PatchUserObjectPrivilege

func PatchUserObjectPrivilege(tenantName, userName string, p *param.ModifyObjectPrivilegeParam) error

func PersistTenantRootPassword

func PersistTenantRootPassword(c *gin.Context, tenantName, rootPassword string) error

func RegisterTenantTask

func RegisterTenantTask()

func RenameTenant

func RenameTenant(param param.RenameTenantParam) error

func RevokeRoleObjectPrivilege

func RevokeRoleObjectPrivilege(name, role string, param *param.RevokeObjectPrivilegeParam) error

func RevokeUserObjectPrivilege

func RevokeUserObjectPrivilege(tenantName, userName string, p *param.RevokeObjectPrivilegeParam) error

func ScaleInTenantReplicas

func ScaleInTenantReplicas(tenantName string, param *param.ScaleInTenantReplicasParam) (*task.DagDetailDTO, error)

func ScaleOutTenantReplicas

func ScaleOutTenantReplicas(tenantName string, param *param.ScaleOutTenantReplicasParam) (*task.DagDetailDTO, error)

func SetTenantParameters

func SetTenantParameters(tenantName string, parameters map[string]interface{}) error

func SetTenantVariables

func SetTenantVariables(c *gin.Context, tenantName string, param param.SetTenantVariablesParam) error

func TenantMajorCompaction

func TenantMajorCompaction(tenantName string) error

func TenantPreCheck

func TenantPreCheck(tenantName string, password *string) (*bo.ObTenantPreCheckResult, error)

func UnlockTenant

func UnlockTenant(tenantName string) error

func UnlockUser

func UnlockUser(tenantName, userName string, password *string) error

Types

type AlterLocalityTask

type AlterLocalityTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*AlterLocalityTask) Execute

func (t *AlterLocalityTask) Execute() error

type AlterResourcePoolUnitConfTask

type AlterResourcePoolUnitConfTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*AlterResourcePoolUnitConfTask) Execute

func (t *AlterResourcePoolUnitConfTask) Execute() error

type AlterResourcePoolUnitNumTask

type AlterResourcePoolUnitNumTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*AlterResourcePoolUnitNumTask) Execute

func (t *AlterResourcePoolUnitNumTask) Execute() error

type BatchCreateResourcePoolTask

type BatchCreateResourcePoolTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*BatchCreateResourcePoolTask) Execute

func (t *BatchCreateResourcePoolTask) Execute() error

func (*BatchCreateResourcePoolTask) Rollback

func (t *BatchCreateResourcePoolTask) Rollback() error

type BatchDropResourcePoolTask

type BatchDropResourcePoolTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*BatchDropResourcePoolTask) Execute

func (t *BatchDropResourcePoolTask) Execute() error

type CreateTenantTask

type CreateTenantTask struct {
	task.Task
	param.CreateTenantParam
	// contains filtered or unexported fields
}

Create Tenant Task

func (*CreateTenantTask) Execute

func (t *CreateTenantTask) Execute() error

func (*CreateTenantTask) Rollback

func (t *CreateTenantTask) Rollback() error

type DropTenantTask

type DropTenantTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*DropTenantTask) Execute

func (t *DropTenantTask) Execute() error

type ModifyPrimaryZoneTask

type ModifyPrimaryZoneTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*ModifyPrimaryZoneTask) Execute

func (t *ModifyPrimaryZoneTask) Execute() error

type ModifyReplicaOption

type ModifyReplicaOption struct {
	// contains filtered or unexported fields
}

type ModifyTenantWhitelistTask

type ModifyTenantWhitelistTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*ModifyTenantWhitelistTask) Execute

func (t *ModifyTenantWhitelistTask) Execute() error

type ParameterTemplate

type ParameterTemplate struct {
	Scenario    string `json:"scenario"`
	Description string `json:"description"`
}

func GetAllSupportedScenarios

func GetAllSupportedScenarios(language string) (res []ParameterTemplate)

type RecycleTenantTask

type RecycleTenantTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*RecycleTenantTask) Execute

func (t *RecycleTenantTask) Execute() error

type SetRootPwdTask

type SetRootPwdTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*SetRootPwdTask) Execute

func (t *SetRootPwdTask) Execute() error

type SetTenantParamterTask

type SetTenantParamterTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*SetTenantParamterTask) Execute

func (t *SetTenantParamterTask) Execute() error

type SetTenantTimeZoneTask

type SetTenantTimeZoneTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*SetTenantTimeZoneTask) Execute

func (t *SetTenantTimeZoneTask) Execute() error

type SetTenantVariableTask

type SetTenantVariableTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*SetTenantVariableTask) Execute

func (t *SetTenantVariableTask) Execute() error

type SplitResourcePoolTask

type SplitResourcePoolTask struct {
	task.Task
	// contains filtered or unexported fields
}

func (*SplitResourcePoolTask) Execute

func (t *SplitResourcePoolTask) Execute() error

Jump to

Keyboard shortcuts

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