فهرست منبع

DMS-ENTERPRISE SDK Auto Released By yuyang.cjx,Version:1.42.0

Signed-off-by: yixiong.jxy <yixiong.jxy@alibaba-inc.com>
yixiong.jxy 7 سال پیش
والد
کامیت
20402d33af

+ 5 - 0
ChangeLog.txt

@@ -1,3 +1,8 @@
+2018-11-26 Version: 1.42.0
+1, Add RegisterInstance interface, Support admin or DBA user to register new db instance.
+2, Add RegisterUser Interface, Support admin user to register new user.
+3, Add GetOpLog Interface, Support admin user to get operation log.
+
 2018-11-22 Version: 1.41.2
 1, Increase the scene field
 

+ 81 - 0
services/dms-enterprise/client.go

@@ -0,0 +1,81 @@
+package dms_enterprise
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
+)
+
+// Client is the sdk client struct, each func corresponds to an OpenAPI
+type Client struct {
+	sdk.Client
+}
+
+// NewClient creates a sdk client with environment variables
+func NewClient() (client *Client, err error) {
+	client = &Client{}
+	err = client.Init()
+	return
+}
+
+// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential
+// this is the common api to create a sdk client
+func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithOptions(regionId, config, credential)
+	return
+}
+
+// NewClientWithAccessKey is a shortcut to create sdk client with accesskey
+// usage: https://help.aliyun.com/document_detail/66217.html
+func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
+	return
+}
+
+// NewClientWithStsToken is a shortcut to create sdk client with sts token
+// usage: https://help.aliyun.com/document_detail/66222.html
+func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
+	return
+}
+
+// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
+// usage: https://help.aliyun.com/document_detail/66222.html
+func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
+	return
+}
+
+// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
+// usage: https://help.aliyun.com/document_detail/66223.html
+func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithEcsRamRole(regionId, roleName)
+	return
+}
+
+// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
+// attention: rsa key pair auth is only Japan regions available
+func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
+	return
+}

+ 113 - 0
services/dms-enterprise/get_op_log.go

@@ -0,0 +1,113 @@
+package dms_enterprise
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// GetOpLog invokes the dms_enterprise.GetOpLog API synchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/getoplog.html
+func (client *Client) GetOpLog(request *GetOpLogRequest) (response *GetOpLogResponse, err error) {
+	response = CreateGetOpLogResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// GetOpLogWithChan invokes the dms_enterprise.GetOpLog API asynchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/getoplog.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetOpLogWithChan(request *GetOpLogRequest) (<-chan *GetOpLogResponse, <-chan error) {
+	responseChan := make(chan *GetOpLogResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.GetOpLog(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// GetOpLogWithCallback invokes the dms_enterprise.GetOpLog API asynchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/getoplog.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetOpLogWithCallback(request *GetOpLogRequest, callback func(response *GetOpLogResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *GetOpLogResponse
+		var err error
+		defer close(result)
+		response, err = client.GetOpLog(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// GetOpLogRequest is the request struct for api GetOpLog
+type GetOpLogRequest struct {
+	*requests.RpcRequest
+	Module     string           `position:"Query" name:"Module"`
+	PageSize   requests.Integer `position:"Query" name:"PageSize"`
+	EndTime    string           `position:"Query" name:"EndTime"`
+	StartTime  string           `position:"Query" name:"StartTime"`
+	Tid        requests.Integer `position:"Query" name:"Tid"`
+	PageNumber requests.Integer `position:"Query" name:"PageNumber"`
+}
+
+// GetOpLogResponse is the response struct for api GetOpLog
+type GetOpLogResponse struct {
+	*responses.BaseResponse
+	RequestId    string       `json:"RequestId" xml:"RequestId"`
+	Success      bool         `json:"Success" xml:"Success"`
+	ErrorMessage string       `json:"ErrorMessage" xml:"ErrorMessage"`
+	ErrorCode    string       `json:"ErrorCode" xml:"ErrorCode"`
+	TotalCount   int          `json:"TotalCount" xml:"TotalCount"`
+	OpLogDetails OpLogDetails `json:"OpLogDetails" xml:"OpLogDetails"`
+}
+
+// CreateGetOpLogRequest creates a request to invoke GetOpLog API
+func CreateGetOpLogRequest() (request *GetOpLogRequest) {
+	request = &GetOpLogRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("dms-enterprise", "2018-11-01", "GetOpLog", "dmsenterprise", "openAPI")
+	return
+}
+
+// CreateGetOpLogResponse creates a response to parse from GetOpLog response
+func CreateGetOpLogResponse() (response *GetOpLogResponse) {
+	response = &GetOpLogResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 123 - 0
services/dms-enterprise/register_instance.go

@@ -0,0 +1,123 @@
+package dms_enterprise
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// RegisterInstance invokes the dms_enterprise.RegisterInstance API synchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/registerinstance.html
+func (client *Client) RegisterInstance(request *RegisterInstanceRequest) (response *RegisterInstanceResponse, err error) {
+	response = CreateRegisterInstanceResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// RegisterInstanceWithChan invokes the dms_enterprise.RegisterInstance API asynchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/registerinstance.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) RegisterInstanceWithChan(request *RegisterInstanceRequest) (<-chan *RegisterInstanceResponse, <-chan error) {
+	responseChan := make(chan *RegisterInstanceResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.RegisterInstance(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// RegisterInstanceWithCallback invokes the dms_enterprise.RegisterInstance API asynchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/registerinstance.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) RegisterInstanceWithCallback(request *RegisterInstanceRequest, callback func(response *RegisterInstanceResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *RegisterInstanceResponse
+		var err error
+		defer close(result)
+		response, err = client.RegisterInstance(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// RegisterInstanceRequest is the request struct for api RegisterInstance
+type RegisterInstanceRequest struct {
+	*requests.RpcRequest
+	EcsInstanceId    string           `position:"Query" name:"EcsInstanceId"`
+	EcsRegion        string           `position:"Query" name:"EcsRegion"`
+	ExportTimeout    requests.Integer `position:"Query" name:"ExportTimeout"`
+	DatabasePassword string           `position:"Query" name:"DatabasePassword"`
+	InstanceAlias    string           `position:"Query" name:"InstanceAlias"`
+	NetworkType      string           `position:"Query" name:"NetworkType"`
+	Tid              requests.Integer `position:"Query" name:"Tid"`
+	Sid              string           `position:"Query" name:"Sid"`
+	DatabaseUser     string           `position:"Query" name:"DatabaseUser"`
+	Port             requests.Integer `position:"Query" name:"Port"`
+	VpcId            string           `position:"Query" name:"VpcId"`
+	InstanceSource   string           `position:"Query" name:"InstanceSource"`
+	EnvType          string           `position:"Query" name:"EnvType"`
+	Host             string           `position:"Query" name:"Host"`
+	InstanceType     string           `position:"Query" name:"InstanceType"`
+	QueryTimeout     requests.Integer `position:"Query" name:"QueryTimeout"`
+	DbaUid           requests.Integer `position:"Query" name:"DbaUid"`
+	SafeRule         string           `position:"Query" name:"SafeRule"`
+}
+
+// RegisterInstanceResponse is the response struct for api RegisterInstance
+type RegisterInstanceResponse struct {
+	*responses.BaseResponse
+	RequestId    string `json:"RequestId" xml:"RequestId"`
+	Success      bool   `json:"Success" xml:"Success"`
+	ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"`
+	ErrorCode    string `json:"ErrorCode" xml:"ErrorCode"`
+}
+
+// CreateRegisterInstanceRequest creates a request to invoke RegisterInstance API
+func CreateRegisterInstanceRequest() (request *RegisterInstanceRequest) {
+	request = &RegisterInstanceRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("dms-enterprise", "2018-11-01", "RegisterInstance", "dmsenterprise", "openAPI")
+	return
+}
+
+// CreateRegisterInstanceResponse creates a response to parse from RegisterInstance response
+func CreateRegisterInstanceResponse() (response *RegisterInstanceResponse) {
+	response = &RegisterInstanceResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 109 - 0
services/dms-enterprise/register_user.go

@@ -0,0 +1,109 @@
+package dms_enterprise
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// RegisterUser invokes the dms_enterprise.RegisterUser API synchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/registeruser.html
+func (client *Client) RegisterUser(request *RegisterUserRequest) (response *RegisterUserResponse, err error) {
+	response = CreateRegisterUserResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// RegisterUserWithChan invokes the dms_enterprise.RegisterUser API asynchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/registeruser.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) RegisterUserWithChan(request *RegisterUserRequest) (<-chan *RegisterUserResponse, <-chan error) {
+	responseChan := make(chan *RegisterUserResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.RegisterUser(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// RegisterUserWithCallback invokes the dms_enterprise.RegisterUser API asynchronously
+// api document: https://help.aliyun.com/api/dms-enterprise/registeruser.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) RegisterUserWithCallback(request *RegisterUserRequest, callback func(response *RegisterUserResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *RegisterUserResponse
+		var err error
+		defer close(result)
+		response, err = client.RegisterUser(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// RegisterUserRequest is the request struct for api RegisterUser
+type RegisterUserRequest struct {
+	*requests.RpcRequest
+	RoleNames string           `position:"Query" name:"RoleNames"`
+	Uid       requests.Integer `position:"Query" name:"Uid"`
+	UserNick  string           `position:"Query" name:"UserNick"`
+	Tid       requests.Integer `position:"Query" name:"Tid"`
+}
+
+// RegisterUserResponse is the response struct for api RegisterUser
+type RegisterUserResponse struct {
+	*responses.BaseResponse
+	RequestId    string `json:"RequestId" xml:"RequestId"`
+	Success      bool   `json:"Success" xml:"Success"`
+	ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"`
+	ErrorCode    string `json:"ErrorCode" xml:"ErrorCode"`
+}
+
+// CreateRegisterUserRequest creates a request to invoke RegisterUser API
+func CreateRegisterUserRequest() (request *RegisterUserRequest) {
+	request = &RegisterUserRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("dms-enterprise", "2018-11-01", "RegisterUser", "dmsenterprise", "openAPI")
+	return
+}
+
+// CreateRegisterUserResponse creates a response to parse from RegisterUser response
+func CreateRegisterUserResponse() (response *RegisterUserResponse) {
+	response = &RegisterUserResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 27 - 0
services/dms-enterprise/struct_op_log_detail.go

@@ -0,0 +1,27 @@
+package dms_enterprise
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// OpLogDetail is a nested struct in dms_enterprise response
+type OpLogDetail struct {
+	UserId    int    `json:"UserId" xml:"UserId"`
+	UserNick  string `json:"UserNick" xml:"UserNick"`
+	Module    string `json:"Module" xml:"Module"`
+	OpContent string `json:"OpContent" xml:"OpContent"`
+	OpTime    string `json:"OpTime" xml:"OpTime"`
+	Database  string `json:"Database" xml:"Database"`
+	OrderId   int    `json:"OrderId" xml:"OrderId"`
+}

+ 21 - 0
services/dms-enterprise/struct_op_log_details.go

@@ -0,0 +1,21 @@
+package dms_enterprise
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// OpLogDetails is a nested struct in dms_enterprise response
+type OpLogDetails struct {
+	OpLogDetail []OpLogDetail `json:"OpLogDetail" xml:"OpLogDetail"`
+}