jobs

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeleteTypeTerminate      = "terminate"
	DeleteTypeForceTerminate = "force_terminate"
	DeleteTypeDelete         = "delete"
)

Variables

View Source
var RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en-us"},
}

Functions

func Delete

func Delete(c *golangsdk.ServiceClient, opts BatchDeleteJobReq) *golangsdk.ErrResult

func Update

func Update(c *golangsdk.ServiceClient, opts UpdateReq) (*golangsdk.Result, error)

Types

type ActionResp

type ActionResp struct {
	Results []ActionResult `json:"results"`
	Count   int            `json:"count"`
}

func LimitSpeed

func LimitSpeed(c *golangsdk.ServiceClient, opts BatchLimitSpeedReq) (*ActionResp, error)

func Start

func Start(c *golangsdk.ServiceClient, opts StartJobReq) (*ActionResp, error)

func TestConnections

func TestConnections(c *golangsdk.ServiceClient, opts TestConnectionsReq) (*ActionResp, error)

type ActionResult

type ActionResult struct {
	Id string `json:"id"`
	// success
	// failed
	Status    string `json:"status"`
	ErrorCode string `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
	// only valid in TestConnection
	Success bool `json:"success"`
}

type AlarmNotifyInfo

type AlarmNotifyInfo struct {
	DelayTime     *int               `json:"delay_time,omitempty"`
	RtoDelay      *int               `json:"rto_delay,omitempty"`
	RpoDelay      *int               `json:"rpo_delay,omitempty"`
	AlarmToUser   bool               `json:"alarm_to_user" required:"true"`
	Subscriptions []SubscriptionInfo `json:"subscriptions,omitempty"`
}

type BatchCreateJobReq

type BatchCreateJobReq struct {
	Jobs []CreateJobReq `json:"jobs" required:"true"`
}

type BatchDeleteJobReq

type BatchDeleteJobReq struct {
	Jobs []DeleteJobReq `json:"jobs" required:"true"`
}

type BatchLimitSpeedReq

type BatchLimitSpeedReq struct {
	SpeedLimits []LimitSpeedReq `json:"speed_limits" required:"true"`
}

type BatchPrecheckReq

type BatchPrecheckReq struct {
	Jobs []PreCheckInfo `json:"jobs" required:"true"`
}

type CheckItem

type CheckItem struct {
	Item          string                 `json:"item"`
	Result        string                 `json:"result"`
	FailedReason  string                 `json:"failed_reason"`
	Data          string                 `json:"data"`
	RawErrorMsg   string                 `json:"raw_error_msg"`
	Group         string                 `json:"group"`
	FailedSubJobs []PrecheckFailSubJobVO `json:"failed_sub_jobs"`
}

type ChildrenJobInfo

type ChildrenJobInfo struct {
	BillingTag       string `json:"billing_tag"`
	CreateTime       string `json:"create_time"`
	DbUseType        string `json:"db_use_type"`
	Description      string `json:"description"`
	EngineType       string `json:"engine_type"`
	ErrorMsg         string `json:"error_msg"`
	Id               string `json:"id"`
	JobDirection     string `json:"job_direction"`
	Name             string `json:"name"`
	NetType          string `json:"net_type"`
	NodeNewFramework string `json:"node_newFramework"`
	Status           string `json:"status"`
	TaskType         string `json:"task_type"`
}

type CreateJobReq

type CreateJobReq struct {
	BindEip          *bool              `json:"bind_eip,omitempty"`
	DbUseType        string             `json:"db_use_type" required:"true"`
	Name             string             `json:"name" required:"true"`
	Description      string             `json:"description,omitempty"`
	EngineType       string             `json:"engine_type" required:"true"`
	IsTargetReadonly *bool              `json:"is_target_readonly,omitempty"`
	JobDirection     string             `json:"job_direction" required:"true"`
	NetType          string             `json:"net_type" required:"true"`
	NodeNum          *int               `json:"node_num,omitempty"`
	NodeType         string             `json:"node_type" required:"true"`
	SourceEndpoint   Endpoint           `json:"source_endpoint" required:"true"`
	TargetEndpoint   Endpoint           `json:"target_endpoint" required:"true"`
	TaskType         string             `json:"task_type" required:"true"`
	SubnetId         string             `json:"customize_sutnet_id" required:"true"`
	ProductId        string             `json:"product_id,omitempty"`
	ExpiredDays      string             `json:"expired_days,omitempty"`
	MultiWrite       *bool              `json:"multi_write,omitempty"`
	Tags             []tags.ResourceTag `json:"tags,omitempty"`
	SysTags          []tags.ResourceTag `json:"sys_tags,omitempty"`
}

type CreateJobResp

type CreateJobResp struct {
	Id         string   `json:"id"`
	ChildIds   []string `json:"child_ids"`
	Name       string   `json:"name"`
	Status     string   `json:"status"`
	CreateTime string   `json:"create_time"`
	ErrorCode  string   `json:"error_code"`
	ErrorMsg   string   `json:"error_msg"`
}

type CreateResp

type CreateResp struct {
	Results []CreateJobResp `json:"results"`
	Count   int             `json:"count"`
}

func Create

func Create(c *golangsdk.ServiceClient, opts BatchCreateJobReq) (*CreateResp, error)

type DefaultRootDb

type DefaultRootDb struct {
	DbName     string `json:"db_name"`
	DbEncoding string `json:"db_encoding"`
}

type DeleteJobReq

type DeleteJobReq struct {
	DeleteType string `json:"delete_type" required:"true"`
	JobId      string `json:"job_id" required:"true"`
}

type Endpoint

type Endpoint struct {
	DbType          string `json:"db_type" required:"true"`
	AzCode          string `json:"az_code,omitempty"`
	Region          string `json:"region,omitempty"`
	InstanceId      string `json:"inst_id,omitempty"`
	InstanceName    string `json:"inst_name,omitempty"`
	VpcId           string `json:"vpc_id,omitempty"`
	SubnetId        string `json:"subnet_id,omitempty"`
	SecurityGroupId string `json:"security_group_id,omitempty"`
	ProjectId       string `json:"project_id,omitempty"`

	DbName     string `json:"db_name,omitempty"`
	Ip         string `json:"ip,omitempty"`
	DbPort     *int   `json:"db_port,omitempty"`
	DbUser     string `json:"db_user,omitempty"`
	DbPassword string `json:"db_password,omitempty"`

	SslCertPassword string `json:"ssl_cert_password,omitempty"`
	SslCertCheckSum string `json:"ssl_cert_check_sum,omitempty"`
	SslCertKey      string `json:"ssl_cert_key,omitempty"`
	SslCertName     string `json:"ssl_cert_name,omitempty"`
	SslLink         *bool  `json:"ssl_link,omitempty"`

	SafeMode    *int   `json:"safe_mode,omitempty"`
	MongoHaMode string `json:"mongo_ha_mode,omitempty"`
	Topic       string `json:"topic,omitempty"`
	ClusterMode string `json:"cluster_mode,omitempty"`
}

type InstInfo

type InstInfo struct {
	EngineType string `json:"engine_type"`
	InstType   string `json:"inst_type"`
	Ip         string `json:"ip"`
	PublicIp   string `json:"public_ip"`
	StartTime  string `json:"start_time"`
	Status     string `json:"status"`
	VolumeSize int    `json:"volume_size"`
}

type JobDetail

type JobDetail struct {
	Id                       string           `json:"id"`
	ParentId                 string           `json:"parent_id"`
	Name                     string           `json:"name"`
	Status                   string           `json:"status"`
	Description              string           `json:"description"`
	CreateTime               string           `json:"create_time"`
	TaskType                 string           `json:"task_type"`
	SourceEndpoint           Endpoint         `json:"source_endpoint"`
	DmqEndpoint              Endpoint         `json:"dmq_endpoint"`
	SourceSharding           []Endpoint       `json:"source_sharding"`
	TargetEndpoint           Endpoint         `json:"target_endpoint"`
	NetType                  string           `json:"net_type"`
	FailedReason             string           `json:"failed_reason"`
	InstInfo                 InstInfo         `json:"inst_info"`
	ActualStartTime          string           `json:"actual_start_time"`
	FullTransferCompleteTime string           `json:"full_transfer_complete_time"`
	UpdateTime               string           `json:"update_time"`
	JobDirection             string           `json:"job_direction"`
	DbUseType                string           `json:"db_use_type"`
	NeedRestart              bool             `json:"need_restart"`
	IsTargetReadonly         bool             `json:"is_target_readonly"`
	ConflictPolicy           string           `json:"conflict_policy"`
	FilterDdlPolicy          string           `json:"filter_ddl_policy"`
	SpeedLimit               []SpeedLimitInfo `json:"speed_limit"`
	SchemaType               string           `json:"schema_type"`
	NodeNum                  string           `json:"node_num"`
	ObjectSwitch             bool             `json:"object_switch"`
	MasterJobId              string           `json:"master_job_id"`
	FullMode                 string           `json:"full_mode"`
	StructTrans              bool             `json:"struct_trans"`
	IndexTrans               bool             `json:"index_trans"`
	ReplaceDefiner           bool             `json:"replace_definer"`
	MigrateUser              bool             `json:"migrate_user"`
	SyncDatabase             bool             `json:"sync_database"`
	ErrorCode                string           `json:"error_code"`
	ErrorMessage             string           `json:"error_message"`
	TargetRootDb             DefaultRootDb    `json:"target_root_db"`
	AzCode                   string           `json:"az_code"`
	VpcId                    string           `json:"vpc_id"`
	SubnetId                 string           `json:"subnet_id"`
	SecurityGroupId          string           `json:"security_group_id"`
	MultiWrite               bool             `json:"multi_write"`
	SupportIpV6              bool             `json:"support_ip_v6"`
	InheritId                string           `json:"inherit_id"`
	Gtid                     string           `json:"gtid"`
	AlarmNotify              string           `json:"alarm_notify"`
	IncreStartPosition       string           `json:"incre_start_position"`
}

type JobDetailResp

type JobDetailResp struct {
	Count   int         `json:"count"`
	Results []JobDetail `json:"results"`
}

func Get

func Get(c *golangsdk.ServiceClient, opts QueryJobReq) (*JobDetailResp, error)

type JobInfo

type JobInfo struct {
	Id               string            `json:"id"`
	Name             string            `json:"name"`
	Status           string            `json:"status"`
	Description      string            `json:"description"`
	CreateTime       string            `json:"create_time"`
	EngineType       string            `json:"engine_type"`
	NetType          string            `json:"net_type"`
	BillingTag       bool              `json:"billing_tag"`
	JobDirection     string            `json:"job_direction"`
	DbUseType        string            `json:"db_use_type"`
	TaskType         string            `json:"task_type"`
	Children         []ChildrenJobInfo `json:"children"`
	NodeNewFramework bool              `json:"node_newFramework"`
}

type JobStatus

type JobStatus struct {
	Id           string `json:"id"`
	Status       string `json:"status"`
	ErrorCode    string `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type JobsListResp

type JobsListResp struct {
	TotalRecord int       `json:"total_record"`
	Jobs        []JobInfo `json:"jobs"`
}

func List

func List(c *golangsdk.ServiceClient, opts ListJobsReq) (*JobsListResp, error)

type LimitSpeedReq

type LimitSpeedReq struct {
	JobId      string           `json:"job_id" required:"true"`
	SpeedLimit []SpeedLimitInfo `json:"speed_limit" required:"true"`
}

type ListJobsReq

type ListJobsReq struct {
	CurPage             int    `json:"cur_page" required:"true"`
	PerPage             int    `json:"per_page" required:"true"`
	DbUseType           string `json:"db_use_type" required:"true"`
	EngineType          string `json:"engine_type,omitempty"`
	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
	// name  or id
	Name        string `json:"name,omitempty"`
	NetType     string `json:"net_type,omitempty"`
	ServiceName string `json:"service_name,omitempty"`
	Status      string `json:"status,omitempty"`

	Tags []tags.ResourceTag `json:"tags,omitempty"`
}

type PageReq

type PageReq struct {
	CurPage int `json:"cur_page,omitempty"`
	PerPage int `json:"per_page,omitempty"`
}

type PreCheckDetail

type PreCheckDetail struct {
	Id         string `json:"id"`
	PrecheckId string `json:"precheck_id"`
	Status     string `json:"status"`
	ErrorCode  string `json:"error_code"`
	ErrorMsg   string `json:"error_msg"`
}

type PreCheckInfo

type PreCheckInfo struct {
	JobId        string `json:"job_id" required:"true"`
	PrecheckMode string `json:"precheck_mode" required:"true"`
}

type PrecheckFailSubJobVO

type PrecheckFailSubJobVO struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	CheckResult string `json:"check_result"`
}

type PrecheckResp

type PrecheckResp struct {
	Results []PreCheckDetail `json:"results"`
	Count   int              `json:"count"`
}

func PreCheckJobs

func PreCheckJobs(c *golangsdk.ServiceClient, opts BatchPrecheckReq) (*PrecheckResp, error)

type PrecheckResult

type PrecheckResult struct {
	PrecheckId      string      `json:"precheck_id"`
	Result          bool        `json:"result"`
	Process         string      `json:"process"`
	TotalPassedRate string      `json:"total_passed_rate"`
	RdsInstanceId   string      `json:"rds_instance_id"`
	JobDirection    string      `json:"job_direction"`
	PrecheckResult  []CheckItem `json:"precheck_result"`
	ErrorMsg        string      `json:"error_msg"`
	ErrorCode       string      `json:"error_code"`
}

type PrecheckResultResp

type PrecheckResultResp struct {
	Count   int              `json:"count"`
	Results []PrecheckResult `json:"results"`
}

func CheckResults

func CheckResults(c *golangsdk.ServiceClient, opts QueryPrecheckResultReq) (*PrecheckResultResp, error)

type QueryJobReq

type QueryJobReq struct {
	Jobs    []string `json:"jobs" required:"true"`
	PageReq PageReq  `json:"page_req,omitempty"`
}

type QueryPrecheckResultReq

type QueryPrecheckResultReq struct {
	Jobs []string `json:"jobs" required:"true"`
}

type SpeedLimitInfo

type SpeedLimitInfo struct {
	// format: hh:mm
	Begin string `json:"begin" required:"true"`
	// format: hh:mm
	End string `json:"end" required:"true"`
	// range: 1~9999 , unit: MB/s
	Speed string `json:"speed" required:"true"`
}

type StartInfo

type StartInfo struct {
	JobId     string `json:"job_id" required:"true"`
	StartTime string `json:"start_time,omitempty"`
}

type StartJobReq

type StartJobReq struct {
	Jobs []StartInfo `json:"jobs" required:"true"`
}

type StatusResp

type StatusResp struct {
	Count   int         `json:"count"`
	Results []JobStatus `json:"results"`
}

func Status

func Status(c *golangsdk.ServiceClient, opts QueryJobReq) (*StatusResp, error)

type SubscriptionInfo

type SubscriptionInfo struct {
	Endpoints []string `json:"endpoints" required:"true"`
	// sms; email
	Protocol string `json:"protocol" required:"true"`
}

type TestConnectionsReq

type TestConnectionsReq struct {
	Jobs []TestEndPoint `json:"jobs" required:"true"`
}

type TestEndPoint

type TestEndPoint struct {
	JobId   string `json:"id" required:"true"`
	NetType string `json:"net_type" required:"true"`
	// source DB:so, target DB:ta
	EndPointType string `json:"end_point_type" required:"true"`

	DbType     string `json:"db_type" required:"true"`
	Ip         string `json:"ip" required:"true"`
	DbUser     string `json:"db_user" required:"true"`
	DbPassword string `json:"db_password" required:"true"`
	//when type is Mongo、DDS, must be `0`
	DbPort *int   `json:"db_port,omitempty"`
	DbName string `json:"db_name,omitempty"`

	Region    string `json:"region,omitempty"`
	ProjectId string `json:"project_id,omitempty"`
	InstId    string `json:"inst_id,omitempty"`
	VpcId     string `json:"vpc_id,omitempty"`
	SubnetId  string `json:"subnet_id,omitempty"`

	SslLink         *bool  `json:"ssl_link,omitempty"`
	SslCertKey      string `json:"ssl_cert_key,omitempty"`
	SslCertName     string `json:"ssl_cert_name,omitempty"`
	SslCertCheckSum string `json:"ssl_cert_check_sum,omitempty"`
	SslCertPassword string `json:"ssl_cert_password,omitempty"`
}

type UpdateJobReq

type UpdateJobReq struct {
	JobId          string    `json:"job_id" required:"true"`
	Name           string    `json:"name,omitempty"`
	SourceEndpoint *Endpoint `json:"source_endpoint,omitempty"`
	TargetEndpoint *Endpoint `json:"target_endpoint,omitempty"`
	NodeType       string    `json:"node_type,omitempty"`
	EngineType     string    `json:"engine_type,omitempty"`
	NetType        string    `json:"net_type,omitempty"`
	StoreDbInfo    bool      `json:"store_db_info,omitempty"`

	IsRecreate       *bool  `json:"is_recreate,omitempty"`
	Description      string `json:"description,omitempty"`
	TaskType         string `json:"task_type,omitempty"`
	DbUseType        string `json:"db_use_type,omitempty"`
	JobDirection     string `json:"job_direction,omitempty"`
	IsTargetReadonly *bool  `json:"is_target_readonly,omitempty"`
	ProductId        string `json:"product_id,omitempty"`

	ReplaceDefiner *bool              `json:"replace_definer,omitempty"`
	Tags           []tags.ResourceTag `json:"tags,omitempty"`
	AlarmNotify    *AlarmNotifyInfo   `json:"alarm_notify,omitempty"`
}

type UpdateReq

type UpdateReq struct {
	Jobs []UpdateJobReq `json:"jobs" required:"true"`
}

Jump to

Keyboard shortcuts

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