Browse Source

POLARDB SDK Auto Released By zhigang.xzg,Version:1.56.13

Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
haowei.yao 6 years ago
parent
commit
770438b324

+ 4 - 0
ChangeLog.txt

@@ -1,3 +1,7 @@
+2019-04-22 Version: 1.56.13
+1, Add CreateDBCluster interface;
+2, Add CreateDBNodes interface;
+
 2019-04-18 Version: 1.56.12
 1, New service
 

+ 28 - 5
services/polardb/client.go

@@ -18,6 +18,7 @@ package polardb
 import (
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
 	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
 )
 
 // Client is the sdk client struct, each func corresponds to an OpenAPI
@@ -32,6 +33,20 @@ func NewClient() (client *Client, err error) {
 	return
 }
 
+// NewClientWithProvider creates a sdk client with providers
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) {
+	client = &Client{}
+	var pc provider.Provider
+	if len(providers) == 0 {
+		pc = provider.DefaultChain
+	} else {
+		pc = provider.NewProviderChain(providers)
+	}
+	err = client.InitWithProviderChain(regionId, pc)
+	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) {
@@ -41,7 +56,7 @@ func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.C
 }
 
 // NewClientWithAccessKey is a shortcut to create sdk client with accesskey
-// usage: https://help.aliyun.com/document_detail/66217.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
@@ -49,7 +64,7 @@ func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (clie
 }
 
 // NewClientWithStsToken is a shortcut to create sdk client with sts token
-// usage: https://help.aliyun.com/document_detail/66222.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
@@ -57,15 +72,23 @@ func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToke
 }
 
 // NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
-// usage: https://help.aliyun.com/document_detail/66222.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
 	return
 }
 
+// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy)
+	return
+}
+
 // NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
-// usage: https://help.aliyun.com/document_detail/66223.html
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithEcsRamRole(regionId, roleName)
@@ -73,7 +96,7 @@ func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client,
 }
 
 // NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
-// attention: rsa key pair auth is only Japan regions available
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
 func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
 	client = &Client{}
 	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)

+ 121 - 0
services/polardb/create_db_cluster.go

@@ -0,0 +1,121 @@
+package polardb
+
+//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"
+)
+
+// CreateDBCluster invokes the polardb.CreateDBCluster API synchronously
+// api document: https://help.aliyun.com/api/polardb/createdbcluster.html
+func (client *Client) CreateDBCluster(request *CreateDBClusterRequest) (response *CreateDBClusterResponse, err error) {
+	response = CreateCreateDBClusterResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// CreateDBClusterWithChan invokes the polardb.CreateDBCluster API asynchronously
+// api document: https://help.aliyun.com/api/polardb/createdbcluster.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) CreateDBClusterWithChan(request *CreateDBClusterRequest) (<-chan *CreateDBClusterResponse, <-chan error) {
+	responseChan := make(chan *CreateDBClusterResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.CreateDBCluster(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// CreateDBClusterWithCallback invokes the polardb.CreateDBCluster API asynchronously
+// api document: https://help.aliyun.com/api/polardb/createdbcluster.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) CreateDBClusterWithCallback(request *CreateDBClusterRequest, callback func(response *CreateDBClusterResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *CreateDBClusterResponse
+		var err error
+		defer close(result)
+		response, err = client.CreateDBCluster(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// CreateDBClusterRequest is the request struct for api CreateDBCluster
+type CreateDBClusterRequest struct {
+	*requests.RpcRequest
+	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
+	DBClusterDescription string           `position:"Query" name:"DBClusterDescription"`
+	Period               string           `position:"Query" name:"Period"`
+	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
+	ClientToken          string           `position:"Query" name:"ClientToken"`
+	OwnerAccount         string           `position:"Query" name:"OwnerAccount"`
+	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
+	UsedTime             string           `position:"Query" name:"UsedTime"`
+	ClusterNetworkType   string           `position:"Query" name:"ClusterNetworkType"`
+	VSwitchId            string           `position:"Query" name:"VSwitchId"`
+	DBNodeClass          string           `position:"Query" name:"DBNodeClass"`
+	Engine               string           `position:"Query" name:"Engine"`
+	VPCId                string           `position:"Query" name:"VPCId"`
+	DBType               string           `position:"Query" name:"DBType"`
+	ZoneId               string           `position:"Query" name:"ZoneId"`
+	DBVersion            string           `position:"Query" name:"DBVersion"`
+	PayType              string           `position:"Query" name:"PayType"`
+}
+
+// CreateDBClusterResponse is the response struct for api CreateDBCluster
+type CreateDBClusterResponse struct {
+	*responses.BaseResponse
+	RequestId   string `json:"RequestId" xml:"RequestId"`
+	DBClusterId string `json:"DBClusterId" xml:"DBClusterId"`
+	OrderId     string `json:"OrderId" xml:"OrderId"`
+}
+
+// CreateCreateDBClusterRequest creates a request to invoke CreateDBCluster API
+func CreateCreateDBClusterRequest() (request *CreateDBClusterRequest) {
+	request = &CreateDBClusterRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("polardb", "2017-08-01", "CreateDBCluster", "polardb", "openAPI")
+	return
+}
+
+// CreateCreateDBClusterResponse creates a response to parse from CreateDBCluster response
+func CreateCreateDBClusterResponse() (response *CreateDBClusterResponse) {
+	response = &CreateDBClusterResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 117 - 0
services/polardb/create_db_nodes.go

@@ -0,0 +1,117 @@
+package polardb
+
+//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"
+)
+
+// CreateDBNodes invokes the polardb.CreateDBNodes API synchronously
+// api document: https://help.aliyun.com/api/polardb/createdbnodes.html
+func (client *Client) CreateDBNodes(request *CreateDBNodesRequest) (response *CreateDBNodesResponse, err error) {
+	response = CreateCreateDBNodesResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// CreateDBNodesWithChan invokes the polardb.CreateDBNodes API asynchronously
+// api document: https://help.aliyun.com/api/polardb/createdbnodes.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) CreateDBNodesWithChan(request *CreateDBNodesRequest) (<-chan *CreateDBNodesResponse, <-chan error) {
+	responseChan := make(chan *CreateDBNodesResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.CreateDBNodes(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// CreateDBNodesWithCallback invokes the polardb.CreateDBNodes API asynchronously
+// api document: https://help.aliyun.com/api/polardb/createdbnodes.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) CreateDBNodesWithCallback(request *CreateDBNodesRequest, callback func(response *CreateDBNodesResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *CreateDBNodesResponse
+		var err error
+		defer close(result)
+		response, err = client.CreateDBNodes(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// CreateDBNodesRequest is the request struct for api CreateDBNodes
+type CreateDBNodesRequest struct {
+	*requests.RpcRequest
+	ResourceOwnerId      requests.Integer       `position:"Query" name:"ResourceOwnerId"`
+	ResourceOwnerAccount string                 `position:"Query" name:"ResourceOwnerAccount"`
+	ClientToken          string                 `position:"Query" name:"ClientToken"`
+	DBClusterId          string                 `position:"Query" name:"DBClusterId"`
+	OwnerAccount         string                 `position:"Query" name:"OwnerAccount"`
+	OwnerId              requests.Integer       `position:"Query" name:"OwnerId"`
+	DBNode               *[]CreateDBNodesDBNode `position:"Query" name:"DBNode"  type:"Repeated"`
+}
+
+// CreateDBNodesDBNode is a repeated param struct in CreateDBNodesRequest
+type CreateDBNodesDBNode struct {
+	TargetClass string `name:"TargetClass"`
+	ZoneId      string `name:"ZoneId"`
+}
+
+// CreateDBNodesResponse is the response struct for api CreateDBNodes
+type CreateDBNodesResponse struct {
+	*responses.BaseResponse
+	RequestId   string `json:"RequestId" xml:"RequestId"`
+	DBClusterId string `json:"DBClusterId" xml:"DBClusterId"`
+	OrderId     string `json:"OrderId" xml:"OrderId"`
+}
+
+// CreateCreateDBNodesRequest creates a request to invoke CreateDBNodes API
+func CreateCreateDBNodesRequest() (request *CreateDBNodesRequest) {
+	request = &CreateDBNodesRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("polardb", "2017-08-01", "CreateDBNodes", "polardb", "openAPI")
+	return
+}
+
+// CreateCreateDBNodesResponse creates a response to parse from CreateDBNodes response
+func CreateCreateDBNodesResponse() (response *CreateDBNodesResponse) {
+	response = &CreateDBNodesResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 111 - 0
services/polardb/delete_db_nodes.go

@@ -0,0 +1,111 @@
+package polardb
+
+//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"
+)
+
+// DeleteDBNodes invokes the polardb.DeleteDBNodes API synchronously
+// api document: https://help.aliyun.com/api/polardb/deletedbnodes.html
+func (client *Client) DeleteDBNodes(request *DeleteDBNodesRequest) (response *DeleteDBNodesResponse, err error) {
+	response = CreateDeleteDBNodesResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// DeleteDBNodesWithChan invokes the polardb.DeleteDBNodes API asynchronously
+// api document: https://help.aliyun.com/api/polardb/deletedbnodes.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) DeleteDBNodesWithChan(request *DeleteDBNodesRequest) (<-chan *DeleteDBNodesResponse, <-chan error) {
+	responseChan := make(chan *DeleteDBNodesResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.DeleteDBNodes(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// DeleteDBNodesWithCallback invokes the polardb.DeleteDBNodes API asynchronously
+// api document: https://help.aliyun.com/api/polardb/deletedbnodes.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) DeleteDBNodesWithCallback(request *DeleteDBNodesRequest, callback func(response *DeleteDBNodesResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *DeleteDBNodesResponse
+		var err error
+		defer close(result)
+		response, err = client.DeleteDBNodes(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// DeleteDBNodesRequest is the request struct for api DeleteDBNodes
+type DeleteDBNodesRequest struct {
+	*requests.RpcRequest
+	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
+	DBNodeId             *[]string        `position:"Query" name:"DBNodeId"  type:"Repeated"`
+	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
+	ClientToken          string           `position:"Query" name:"ClientToken"`
+	DBClusterId          string           `position:"Query" name:"DBClusterId"`
+	OwnerAccount         string           `position:"Query" name:"OwnerAccount"`
+	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
+}
+
+// DeleteDBNodesResponse is the response struct for api DeleteDBNodes
+type DeleteDBNodesResponse struct {
+	*responses.BaseResponse
+	RequestId   string `json:"RequestId" xml:"RequestId"`
+	DBClusterId string `json:"DBClusterId" xml:"DBClusterId"`
+	OrderId     string `json:"OrderId" xml:"OrderId"`
+}
+
+// CreateDeleteDBNodesRequest creates a request to invoke DeleteDBNodes API
+func CreateDeleteDBNodesRequest() (request *DeleteDBNodesRequest) {
+	request = &DeleteDBNodesRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("polardb", "2017-08-01", "DeleteDBNodes", "polardb", "openAPI")
+	return
+}
+
+// CreateDeleteDBNodesResponse creates a response to parse from DeleteDBNodes response
+func CreateDeleteDBNodesResponse() (response *DeleteDBNodesResponse) {
+	response = &DeleteDBNodesResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}