dts

package
v0.9.180 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package dts defines the DTS services of BCE. The supported APIs are all defined in sub-package

dts.go - the dts APIs definition supported by the DTS service

Index

Constants

View Source
const (
	URI_PREFIX       = bce.URI_PREFIX + "v1"
	DEFAULT_ENDPOINT = "dts.baidubce.com"
	REQUEST_DTS_URL  = "/task"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckResult

type CheckResult struct {
	Name         string `json:"name"`
	Status       string `json:"status"`
	Message      string `json:"message"`
	Subscription string `json:"subscription"`
}

type Client

type Client struct {
	*bce.BceClient
}

Client of DTS service is a kind of BceClient, so derived from BceClient

func NewClient

func NewClient(ak, sk, endPoint string) (*Client, error)

func (*Client) ConfigDts

func (c *Client) ConfigDts(taskId string, args *ConfigArgs) (*ConfigDtsResult, error)

ConfigDts - config a dtsTask with the specific parameters

PARAMS:

  • taskId: the specific dtsTask's ID
  • args: the arguments to config a dtsTask

RETURNS:

  • *ConfigDtsResult: the result of config dtsTask, contains the dtsTask's ID
  • error: nil if success otherwise the specific error

func (*Client) CreateDts

func (c *Client) CreateDts(args *CreateDtsArgs) (*CreateDtsResult, error)

CreateDts - create a dtsTask with the specific parameters

PARAMS:

  • args: the arguments to create a dtsTask

RETURNS:

  • *CreateDtsResult: the result of create dtsTask, contains new dtsTask's ID
  • error: nil if success otherwise the specific error

func (*Client) DeleteDts

func (c *Client) DeleteDts(taskId string) error

DeleteDts - delete a dtsTask

PARAMS:

  • taskId: the specific taskId

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) GetDetail

func (c *Client) GetDetail(taskId string) (*DtsTaskMeta, error)

GetDetail - get a specific dtsTask's detail

PARAMS:

  • taskId: the specific dtsTask's ID

RETURNS:

  • *DtsTaskMeta: the specific dtsTask's detail
  • error: nil if success otherwise the specific error

func (*Client) GetPreCheck

func (c *Client) GetPreCheck(taskId string) (*GetPreCheckResult, error)

GetPreCheck - get a precheck result

PARAMS:

  • taskId: the specific dtsTask's ID

RETURNS:

  • *GetPreCheckResult: the specific dtsTask's precheck result
  • error: nil if success otherwise the specific error

func (*Client) GetSchema added in v0.9.103

func (c *Client) GetSchema(args *GetSchemaArgs) (*GetSchemaResponse, error)

GetSchema - get schema

PARAMS:

  • args: connection param

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) GetVpcs added in v0.9.111

func (c *Client) GetVpcs(region string) (*DtsVpcsResult, error)

func (*Client) ListDts

func (c *Client) ListDts(args *ListDtsArgs) (*ListDtsResult, error)

ListDts - list all dtsTask with the specific type

PARAMS:

  • args: the arguments to list all dtsTask with the specific type

RETURNS:

  • *ListDtsResult: the result of list all dtsTask, contains all dtsTask' detail
  • error: nil if success otherwise the specific error

func (*Client) ListDtsWithPage added in v0.9.103

func (c *Client) ListDtsWithPage(args *ListDtsWithPageArgs) (*ListDtsWithPageResult, error)

ListDtsWithPage - list all dtsTask with page

PARAMS:

  • args: the arguments to list all dtsTask with page

RETURNS:

  • *ListDtsResult: the result of list all dtsTask, contains all dtsTask' detail
  • error: nil if success otherwise the specific error

func (*Client) PauseDts

func (c *Client) PauseDts(taskId string) error

PauseDts - pause a dtsTask

PARAMS:

  • taskId: the specific dtsTask's ID

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PreCheck

func (c *Client) PreCheck(taskId string) (*PreCheckResult, error)

PreCheck - precheck a dtsTask

PARAMS:

  • taskId: the specific dtsTask's ID

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) ResizeTaskStandard added in v0.9.103

func (c *Client) ResizeTaskStandard(taskId string, args *ResizeTaskStandardArgs) (*ResizeTaskStandardResponse, error)

ResizeTaskStandard - resize task standard

PARAMS:

  • args: resize task standard param

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) ShutdownDts

func (c *Client) ShutdownDts(taskId string) error

ShutdownDts - shutdown a dtsTask

PARAMS:

  • taskId: the specific dtsTask's ID

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SkipPreCheck added in v0.9.103

func (c *Client) SkipPreCheck(taskId string) (*SkipPreCheckResponse, error)

SkipPreCheck - skip precheck of a dts task

PARAMS:

  • taskId: the specific dtsTask's ID

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) StartDts

func (c *Client) StartDts(taskId string) error

StartDts - start a dtsTask

PARAMS:

  • taskId: the specific dtsTask's ID

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) UpdateTaskName added in v0.9.103

func (c *Client) UpdateTaskName(taskId string, args *UpdateTaskNameArgs) error

UpdateTaskName - update task name

PARAMS:

  • args: update task name param

RETURNS:

  • error: nil if success otherwise the specific error

type ConfigArgs

type ConfigArgs struct {
	Type          string       `json:"type,omitempty"`
	DtsId         string       `json:"dtsId,omitempty"`
	TaskName      string       `json:"taskName"`
	DataType      []string     `json:"dataType"`
	SrcConnection Connection   `json:"srcConnection"`
	DstConnection Connection   `json:"dstConnection"`
	SchemaMapping []Schema     `json:"schemaMapping"`
	Granularity   string       `json:"granularity,omitempty"`
	ProductType   string       `json:"productType,omitempty"`
	QueueType     string       `json:"queueType,omitempty"`
	InitPosition  InitPosition `json:"initPosition,omitempty"`
	NetType       string       `json:"netType,omitempty"`
	Admin         string       `json:"admin,omitempty"`
}

type ConfigDtsResult

type ConfigDtsResult struct {
	DtsId string `json:"dtsId"`
}

type Connection

type Connection struct {
	Region          string `json:"region"`
	DbType          string `json:"dbType"`
	DbUser          string `json:"dbUser"`
	DbPass          string `json:"dbPass"`
	DbPort          int    `json:"dbPort"`
	DbHost          string `json:"dbHost"`
	InstanceId      string `json:"instanceId"`
	DbServer        string `json:"dbServer,omitempty"`
	InstanceType    string `json:"instanceType"`
	InstanceShortId string `json:"instanceShortId,omitempty"`
	FieldWhitelist  string `json:"field_whitelist,omitempty"`
	FieldBlacklist  string `json:"field_blacklist,omitempty"`
	StartTime       string `json:"startTime,omitempty"`
	EndTime         string `json:"endTime,omitempty"`
	SqlType         string `json:"sqlType,omitempty"`
	VpcId           string `json:"vpcId"`
	VpcName         string `json:"vpcName"`
	VpcCidr         string `json:"vpcCidr"`
	VpcShortId      string `json:"vpcShortId"`
}

type CreateDtsArgs

type CreateDtsArgs struct {
	ClientToken        string    `json:"-"`
	ProductType        string    `json:"productType"`
	Type               string    `json:"type"`
	Standard           string    `json:"standard"`
	SourceInstanceType string    `json:"sourceInstanceType"`
	TargetInstanceType string    `json:"targetInstanceType"`
	CrossRegionTag     int       `json:"crossRegionTag"`
	DirectionType      string    `json:"directionType"`
	OrderInfo          OrderInfo `json:"orderInfo"`
}

type CreateDtsResult

type CreateDtsResult struct {
	DtsTasks []DtsId `json:"dtsTasks"`
}

type Dst added in v0.9.111

type Dst struct {
	InstanceType string `json:"instanceType"`
	DbType       string `json:"dbType"`
}

type DtsId

type DtsId struct {
	DtsId string `json:"dtsId"`
}

type DtsTaskMeta

type DtsTaskMeta struct {
	DtsId               string       `json:"dtsId"`
	TaskName            string       `json:"taskName"`
	Status              string       `json:"status"`
	DataType            []string     `json:"dataType"`
	Region              string       `json:"region"`
	CreateTime          string       `json:"createTime"`
	SrcConnection       Connection   `json:"srcConnection"`
	DstConnection       Connection   `json:"dstConnection"`
	SchemaMapping       []Schema     `json:"schemaMapping,omitempty"`
	RunningTime         int          `json:"runningTime"`
	SubStatus           []SubStatus  `json:"subStatus,omitempty"`
	DynamicInfo         DynamicInfo  `json:"dynamicInfo,omitempty"`
	Errmsg              string       `json:"errmsg,omitempty"`
	SdkRealtimeProgress string       `json:"sdkRealtimeProgress,omitempty"`
	Granularity         string       `json:"granularity,omitempty"`
	SubDataScope        SubDataScope `json:"subDataScope,omitempty"`
	PayInfo             PayInfo      `json:"payInfo,omitempty"`
	LockStatus          string       `json:"lockStatus,omitempty"`
	DtsIdPos            string       `json:"dtsIdPos,omitempty"`
	DtsIdNeg            string       `json:"dtsIdNeg,omitempty"`
	DtsTaskPos          *DtsTaskMeta `json:"dtsTaskPos"`
	DtsTaskNeg          *DtsTaskMeta `json:"dtsTaskNeg"`
}

type DtsVpcsResult added in v0.9.111

type DtsVpcsResult struct {
	Vpcs []VpcVo `json:"vpcs"`
}

type DynamicInfo

type DynamicInfo struct {
	Schema    []SchemaInfo `json:"schema"`
	Base      []SchemaInfo `json:"base"`
	Increment Increment    `json:"increment"`
}

type GetPreCheckResult

type GetPreCheckResult struct {
	Success bool          `json:"success"`
	Result  []CheckResult `json:"result"`
}

type GetSchemaArgs added in v0.9.103

type GetSchemaArgs struct {
	Connection Connection `json:"connection"`
}

type GetSchemaResponse added in v0.9.103

type GetSchemaResponse struct {
	Success bool            `json:"success"`
	Result  GetSchemaResult `json:"result"`
}

type GetSchemaResult added in v0.9.103

type GetSchemaResult struct {
	SchemaAll map[string]ObjectInDb `json:"schemaAll"`
}

type Increment added in v0.9.103

type Increment struct {
	Delay      int64  `json:"delay"`
	Position   string `json:"position"`
	SyncStatus string `json:"syncStatus"`
}

type InitPosition

type InitPosition struct {
	Type     string `json:"type"`
	Position string `json:"position"`
}

type ListDtsArgs

type ListDtsArgs struct {
	Type        string `json:"type"`
	Status      string `json:"status,omitempty"`
	Marker      string `json:"marker,omitempty"`
	MaxKeys     int    `json:"maxKeys,omitempty"`
	Keyword     string `json:"keyword,omitempty"`
	KeywordType string `json:"keywordType,omitempty"`
}

type ListDtsResult

type ListDtsResult struct {
	Marker      string        `json:"marker"`
	MaxKeys     int           `json:"maxKeys"`
	IsTruncated bool          `json:"isTruncated"`
	NextMarker  string        `json:"nextMarker"`
	Task        []DtsTaskMeta `json:"task"`
}

type ListDtsWithPageArgs added in v0.9.103

type ListDtsWithPageArgs struct {
	Types    []string     `json:"types"`
	Filters  []ListFilter `json:"filters"`
	Order    string       `json:"order"`
	OrderBy  string       `json:"orderBy"`
	PageNo   int          `json:"pageNo"`
	PageSize int          `json:"pageSize"`
}

type ListDtsWithPageResult added in v0.9.103

type ListDtsWithPageResult struct {
	OrderBy    string        `json:"orderBy"`
	Order      string        `json:"order"`
	PageNo     int           `json:"pageNo"`
	PageSize   int           `json:"pageSize"`
	TotalCount int           `json:"totalCount"`
	Result     []DtsTaskMeta `json:"result"`
}

type ListFilter added in v0.9.103

type ListFilter struct {
	KeywordType string `json:"keywordType"`
	Keyword     string `json:"keyword"`
}

type ObjectInDb added in v0.9.103

type ObjectInDb struct {
	Tables     []string `json:"tables"`
	Views      []string `json:"views"`
	Procedures []string `json:"procedures"`
	Functions  []string `json:"functions"`
}

type OrderInfo added in v0.9.111

type OrderInfo struct {
	Src Src `json:"src"`
	Dst Dst `json:"dst"`
}

type PayInfo

type PayInfo struct {
	ProductType        string `json:"productType"`
	SourceInstanceType string `json:"sourceInstanceType"`
	TargetInstanceType string `json:"targetInstanceType"`
	CrossRegionTag     int    `json:"crossRegionTag"`
	CreateTime         int    `json:"createTime"`
	Standard           string `json:"standard"`
	EndTime            string `json:"endTime"`
}

type PreCheckResult

type PreCheckResult struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

type ResizeTaskStandardArgs added in v0.9.103

type ResizeTaskStandardArgs struct {
	ClientToken string `json:"-"`
	Standard    string `json:"standard"`
}

type ResizeTaskStandardResponse added in v0.9.103

type ResizeTaskStandardResponse struct {
	OrderId string `json:"orderId"`
}

type Schema

type Schema struct {
	Type  string `json:"type"`
	Src   string `json:"src"`
	Dst   string `json:"dst"`
	Where string `json:"where"`
}

type SchemaInfo

type SchemaInfo struct {
	Current          string `json:"current"`
	Count            string `json:"count"`
	Speed            string `json:"speed"`
	ExpectFinishTime string `json:"expectFinishTime"`
}

type SkipPreCheckResponse added in v0.9.103

type SkipPreCheckResponse struct {
	Success bool   `json:"success"`
	Result  string `json:"result"`
}

type Src added in v0.9.111

type Src struct {
	InstanceType string `json:"instanceType"`
	DbType       string `json:"dbType"`
	SliceNum     string `json:"sliceNum"`
}

type SubDataScope

type SubDataScope struct {
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
}

type SubStatus

type SubStatus struct {
	S string `json:"s"`
	B string `json:"b"`
	I string `json:"i"`
}

type UpdateTaskNameArgs added in v0.9.103

type UpdateTaskNameArgs struct {
	TaskName string `json:"taskName"`
}

type VpcVo added in v0.9.111

type VpcVo struct {
	VpcId   string `json:"vpcId"`
	ShortId string `json:"shortId"`
	Name    string `json:"name"`
	Cidr    string `json:"cidr"`
}

Jump to

Keyboard shortcuts

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