dts

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

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 = "rds.bj.baidubce.com"
	REQUEST_DTS_URL  = "/task"
	API_DTS_URL      = "/api/dts/"
)

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) 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) 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) 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) 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

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"`
}

type CreateDtsArgs

type CreateDtsArgs struct {
	ProductType        string `json:"productType"`
	Type               string `json:"type"`
	Standard           string `json:"standard"`
	SourceInstanceType string `json:"sourceInstanceType"`
	TargetInstanceType string `json:"targetInstanceType"`
	CrossRegionTag     int    `json:"crossRegionTag"`
}

type CreateDtsResult

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

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"`
}

type DynamicInfo

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

type GetPreCheckResult

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

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 string        `json:"isTruncated"`
	NextMarker  string        `json:"nextMarker"`
	Task        []DtsTaskMeta `json:"task"`
}

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 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 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"`
}

Jump to

Keyboard shortcuts

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