describe_subscription_instances.go 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //Licensed under the Apache License, Version 2.0 (the "License");
  2. //you may not use this file except in compliance with the License.
  3. //You may obtain a copy of the License at
  4. //
  5. //http://www.apache.org/licenses/LICENSE-2.0
  6. //
  7. //Unless required by applicable law or agreed to in writing, software
  8. //distributed under the License is distributed on an "AS IS" BASIS,
  9. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. //See the License for the specific language governing permissions and
  11. //limitations under the License.
  12. //
  13. // Code generated by Alibaba Cloud SDK Code Generator.
  14. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  15. package dts
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. // DescribeSubscriptionInstances invokes the dts.DescribeSubscriptionInstances API synchronously
  21. // api document: https://help.aliyun.com/api/dts/describesubscriptioninstances.html
  22. func (client *Client) DescribeSubscriptionInstances(request *DescribeSubscriptionInstancesRequest) (response *DescribeSubscriptionInstancesResponse, err error) {
  23. response = CreateDescribeSubscriptionInstancesResponse()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // DescribeSubscriptionInstancesWithChan invokes the dts.DescribeSubscriptionInstances API asynchronously
  28. // api document: https://help.aliyun.com/api/dts/describesubscriptioninstances.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) DescribeSubscriptionInstancesWithChan(request *DescribeSubscriptionInstancesRequest) (<-chan *DescribeSubscriptionInstancesResponse, <-chan error) {
  31. responseChan := make(chan *DescribeSubscriptionInstancesResponse, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.DescribeSubscriptionInstances(request)
  37. if err != nil {
  38. errChan <- err
  39. } else {
  40. responseChan <- response
  41. }
  42. })
  43. if err != nil {
  44. errChan <- err
  45. close(responseChan)
  46. close(errChan)
  47. }
  48. return responseChan, errChan
  49. }
  50. // DescribeSubscriptionInstancesWithCallback invokes the dts.DescribeSubscriptionInstances API asynchronously
  51. // api document: https://help.aliyun.com/api/dts/describesubscriptioninstances.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) DescribeSubscriptionInstancesWithCallback(request *DescribeSubscriptionInstancesRequest, callback func(response *DescribeSubscriptionInstancesResponse, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *DescribeSubscriptionInstancesResponse
  57. var err error
  58. defer close(result)
  59. response, err = client.DescribeSubscriptionInstances(request)
  60. callback(response, err)
  61. result <- 1
  62. })
  63. if err != nil {
  64. defer close(result)
  65. callback(nil, err)
  66. result <- 0
  67. }
  68. return result
  69. }
  70. // DescribeSubscriptionInstancesRequest is the request struct for api DescribeSubscriptionInstances
  71. type DescribeSubscriptionInstancesRequest struct {
  72. *requests.RpcRequest
  73. PageSize requests.Integer `position:"Query" name:"PageSize"`
  74. PageNum requests.Integer `position:"Query" name:"PageNum"`
  75. SubscriptionInstanceName string `position:"Query" name:"SubscriptionInstanceName"`
  76. ClientToken string `position:"Query" name:"ClientToken"`
  77. OwnerId string `position:"Query" name:"OwnerId"`
  78. }
  79. // DescribeSubscriptionInstancesResponse is the response struct for api DescribeSubscriptionInstances
  80. type DescribeSubscriptionInstancesResponse struct {
  81. *responses.BaseResponse
  82. PageNumber int `json:"PageNumber" xml:"PageNumber"`
  83. TotalRecordCount int64 `json:"TotalRecordCount" xml:"TotalRecordCount"`
  84. PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"`
  85. SubscriptionInstances DescribeSubscriptionInstancesSubscriptionInstances0 `json:"SubscriptionInstances" xml:"SubscriptionInstances"`
  86. }
  87. type DescribeSubscriptionInstancesSubscriptionInstances0 struct {
  88. SubscriptionInstance []DescribeSubscriptionInstancesSubscriptionInstance1 `json:"SubscriptionInstance" xml:"SubscriptionInstance"`
  89. }
  90. type DescribeSubscriptionInstancesSubscriptionInstance1 struct {
  91. SubscriptionInstanceID string `json:"SubscriptionInstanceID" xml:"SubscriptionInstanceID"`
  92. SubscriptionInstanceName string `json:"SubscriptionInstanceName" xml:"SubscriptionInstanceName"`
  93. PayType string `json:"PayType" xml:"PayType"`
  94. Status string `json:"Status" xml:"Status"`
  95. ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"`
  96. ConsumptionCheckpoint string `json:"ConsumptionCheckpoint" xml:"ConsumptionCheckpoint"`
  97. BeginTimestamp string `json:"BeginTimestamp" xml:"BeginTimestamp"`
  98. EndTimestamp string `json:"EndTimestamp" xml:"EndTimestamp"`
  99. ConsumptionClient string `json:"ConsumptionClient" xml:"ConsumptionClient"`
  100. SubscriptionObject []DescribeSubscriptionInstancesSubscriptionObject1 `json:"SubscriptionObject" xml:"SubscriptionObject"`
  101. SourceEndpoint DescribeSubscriptionInstancesSourceEndpoint1 `json:"SourceEndpoint" xml:"SourceEndpoint"`
  102. SubscriptionDataType DescribeSubscriptionInstancesSubscriptionDataType1 `json:"SubscriptionDataType" xml:"SubscriptionDataType"`
  103. }
  104. type DescribeSubscriptionInstancesSubscriptionObject1 struct {
  105. SynchronousObject []DescribeSubscriptionInstancesSynchronousObject2 `json:"SynchronousObject" xml:"SynchronousObject"`
  106. }
  107. type DescribeSubscriptionInstancesSynchronousObject2 struct {
  108. DatabaseName string `json:"DatabaseName" xml:"DatabaseName"`
  109. WholeDatabase string `json:"WholeDatabase" xml:"WholeDatabase"`
  110. TableList []string `json:"TableList" xml:"TableList"`
  111. }
  112. type DescribeSubscriptionInstancesSourceEndpoint1 struct {
  113. InstanceID string `json:"InstanceID" xml:"InstanceID"`
  114. InstanceType string `json:"InstanceType" xml:"InstanceType"`
  115. }
  116. type DescribeSubscriptionInstancesSubscriptionDataType1 struct {
  117. DDL bool `json:"DDL" xml:"DDL"`
  118. DML bool `json:"DML" xml:"DML"`
  119. }
  120. // CreateDescribeSubscriptionInstancesRequest creates a request to invoke DescribeSubscriptionInstances API
  121. func CreateDescribeSubscriptionInstancesRequest() (request *DescribeSubscriptionInstancesRequest) {
  122. request = &DescribeSubscriptionInstancesRequest{
  123. RpcRequest: &requests.RpcRequest{},
  124. }
  125. request.InitWithApiInfo("Dts", "2018-08-01", "DescribeSubscriptionInstances", "dts", "openAPI")
  126. return
  127. }
  128. // CreateDescribeSubscriptionInstancesResponse creates a response to parse from DescribeSubscriptionInstances response
  129. func CreateDescribeSubscriptionInstancesResponse() (response *DescribeSubscriptionInstancesResponse) {
  130. response = &DescribeSubscriptionInstancesResponse{
  131. BaseResponse: &responses.BaseResponse{},
  132. }
  133. return
  134. }