Przeglądaj źródła

DDOSCOO SDK Auto Released By yiduo.qyd,Version:1.53.15

Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
haowei.yao 6 lat temu
rodzic
commit
395bf76af6

+ 3 - 0
ChangeLog.txt

@@ -1,3 +1,6 @@
+2019-03-07 Version: 1.53.15
+1, Publish instance describe and release apis.
+
 2019-03-06 Version: 1.53.14
 1, Release ActionTrail Go API.
 

+ 81 - 0
services/ddoscoo/client.go

@@ -0,0 +1,81 @@
+package ddoscoo
+
+//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
+}

+ 117 - 0
services/ddoscoo/describe_instances.go

@@ -0,0 +1,117 @@
+package ddoscoo
+
+//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"
+)
+
+// DescribeInstances invokes the ddoscoo.DescribeInstances API synchronously
+// api document: https://help.aliyun.com/api/ddoscoo/describeinstances.html
+func (client *Client) DescribeInstances(request *DescribeInstancesRequest) (response *DescribeInstancesResponse, err error) {
+	response = CreateDescribeInstancesResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// DescribeInstancesWithChan invokes the ddoscoo.DescribeInstances API asynchronously
+// api document: https://help.aliyun.com/api/ddoscoo/describeinstances.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) DescribeInstancesWithChan(request *DescribeInstancesRequest) (<-chan *DescribeInstancesResponse, <-chan error) {
+	responseChan := make(chan *DescribeInstancesResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.DescribeInstances(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// DescribeInstancesWithCallback invokes the ddoscoo.DescribeInstances API asynchronously
+// api document: https://help.aliyun.com/api/ddoscoo/describeinstances.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) DescribeInstancesWithCallback(request *DescribeInstancesRequest, callback func(response *DescribeInstancesResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *DescribeInstancesResponse
+		var err error
+		defer close(result)
+		response, err = client.DescribeInstances(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// DescribeInstancesRequest is the request struct for api DescribeInstances
+type DescribeInstancesRequest struct {
+	*requests.RpcRequest
+	SourceIp    string                  `position:"Query" name:"SourceIp"`
+	InstanceIds string                  `position:"Query" name:"InstanceIds"`
+	PageNo      string                  `position:"Query" name:"PageNo"`
+	Ip          string                  `position:"Query" name:"Ip"`
+	PageSize    string                  `position:"Query" name:"PageSize"`
+	Remark      string                  `position:"Query" name:"Remark"`
+	Tag         *[]DescribeInstancesTag `position:"Query" name:"Tag"  type:"Repeated"`
+}
+
+// DescribeInstancesTag is a repeated param struct in DescribeInstancesRequest
+type DescribeInstancesTag struct {
+	Value string `name:"Value"`
+	Key   string `name:"Key"`
+}
+
+// DescribeInstancesResponse is the response struct for api DescribeInstances
+type DescribeInstancesResponse struct {
+	*responses.BaseResponse
+	RequestId string     `json:"RequestId" xml:"RequestId"`
+	Total     int        `json:"Total" xml:"Total"`
+	Instances []Instance `json:"Instances" xml:"Instances"`
+}
+
+// CreateDescribeInstancesRequest creates a request to invoke DescribeInstances API
+func CreateDescribeInstancesRequest() (request *DescribeInstancesRequest) {
+	request = &DescribeInstancesRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("ddoscoo", "2017-12-28", "DescribeInstances", "ddoscoo", "openAPI")
+	return
+}
+
+// CreateDescribeInstancesResponse creates a response to parse from DescribeInstances response
+func CreateDescribeInstancesResponse() (response *DescribeInstancesResponse) {
+	response = &DescribeInstancesResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 104 - 0
services/ddoscoo/release_instance.go

@@ -0,0 +1,104 @@
+package ddoscoo
+
+//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"
+)
+
+// ReleaseInstance invokes the ddoscoo.ReleaseInstance API synchronously
+// api document: https://help.aliyun.com/api/ddoscoo/releaseinstance.html
+func (client *Client) ReleaseInstance(request *ReleaseInstanceRequest) (response *ReleaseInstanceResponse, err error) {
+	response = CreateReleaseInstanceResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// ReleaseInstanceWithChan invokes the ddoscoo.ReleaseInstance API asynchronously
+// api document: https://help.aliyun.com/api/ddoscoo/releaseinstance.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) ReleaseInstanceWithChan(request *ReleaseInstanceRequest) (<-chan *ReleaseInstanceResponse, <-chan error) {
+	responseChan := make(chan *ReleaseInstanceResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.ReleaseInstance(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// ReleaseInstanceWithCallback invokes the ddoscoo.ReleaseInstance API asynchronously
+// api document: https://help.aliyun.com/api/ddoscoo/releaseinstance.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) ReleaseInstanceWithCallback(request *ReleaseInstanceRequest, callback func(response *ReleaseInstanceResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *ReleaseInstanceResponse
+		var err error
+		defer close(result)
+		response, err = client.ReleaseInstance(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// ReleaseInstanceRequest is the request struct for api ReleaseInstance
+type ReleaseInstanceRequest struct {
+	*requests.RpcRequest
+	InstanceId string `position:"Query" name:"InstanceId"`
+	SourceIp   string `position:"Query" name:"SourceIp"`
+}
+
+// ReleaseInstanceResponse is the response struct for api ReleaseInstance
+type ReleaseInstanceResponse struct {
+	*responses.BaseResponse
+	RequestId string `json:"RequestId" xml:"RequestId"`
+}
+
+// CreateReleaseInstanceRequest creates a request to invoke ReleaseInstance API
+func CreateReleaseInstanceRequest() (request *ReleaseInstanceRequest) {
+	request = &ReleaseInstanceRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("ddoscoo", "2017-12-28", "ReleaseInstance", "ddoscoo", "openAPI")
+	return
+}
+
+// CreateReleaseInstanceResponse creates a response to parse from ReleaseInstance response
+func CreateReleaseInstanceResponse() (response *ReleaseInstanceResponse) {
+	response = &ReleaseInstanceResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 27 - 0
services/ddoscoo/struct_instance.go

@@ -0,0 +1,27 @@
+package ddoscoo
+
+//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.
+
+// Instance is a nested struct in ddoscoo response
+type Instance struct {
+	InstanceId string `json:"InstanceId" xml:"InstanceId"`
+	Remark     string `json:"Remark" xml:"Remark"`
+	Status     int    `json:"Status" xml:"Status"`
+	DebtStatus int    `json:"DebtStatus" xml:"DebtStatus"`
+	ExpireTime int    `json:"ExpireTime" xml:"ExpireTime"`
+	GmtCreate  int    `json:"GmtCreate" xml:"GmtCreate"`
+	Edition    int    `json:"Edition" xml:"Edition"`
+}