describe_migration_jobs.go 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. // DescribeMigrationJobs invokes the dts.DescribeMigrationJobs API synchronously
  21. // api document: https://help.aliyun.com/api/dts/describemigrationjobs.html
  22. func (client *Client) DescribeMigrationJobs(request *DescribeMigrationJobsRequest) (response *DescribeMigrationJobsResponse, err error) {
  23. response = CreateDescribeMigrationJobsResponse()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // DescribeMigrationJobsWithChan invokes the dts.DescribeMigrationJobs API asynchronously
  28. // api document: https://help.aliyun.com/api/dts/describemigrationjobs.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) DescribeMigrationJobsWithChan(request *DescribeMigrationJobsRequest) (<-chan *DescribeMigrationJobsResponse, <-chan error) {
  31. responseChan := make(chan *DescribeMigrationJobsResponse, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.DescribeMigrationJobs(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. // DescribeMigrationJobsWithCallback invokes the dts.DescribeMigrationJobs API asynchronously
  51. // api document: https://help.aliyun.com/api/dts/describemigrationjobs.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) DescribeMigrationJobsWithCallback(request *DescribeMigrationJobsRequest, callback func(response *DescribeMigrationJobsResponse, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *DescribeMigrationJobsResponse
  57. var err error
  58. defer close(result)
  59. response, err = client.DescribeMigrationJobs(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. // DescribeMigrationJobsRequest is the request struct for api DescribeMigrationJobs
  71. type DescribeMigrationJobsRequest struct {
  72. *requests.RpcRequest
  73. PageSize requests.Integer `position:"Query" name:"PageSize"`
  74. PageNum requests.Integer `position:"Query" name:"PageNum"`
  75. MigrationJobName string `position:"Query" name:"MigrationJobName"`
  76. OwnerId string `position:"Query" name:"OwnerId"`
  77. }
  78. // DescribeMigrationJobsResponse is the response struct for api DescribeMigrationJobs
  79. type DescribeMigrationJobsResponse struct {
  80. *responses.BaseResponse
  81. PageNumber int `json:"PageNumber" xml:"PageNumber"`
  82. TotalRecordCount int64 `json:"TotalRecordCount" xml:"TotalRecordCount"`
  83. PageRecordCount int `json:"PageRecordCount" xml:"PageRecordCount"`
  84. MigrationJobs DescribeMigrationJobsMigrationJobs0 `json:"MigrationJobs" xml:"MigrationJobs"`
  85. }
  86. type DescribeMigrationJobsMigrationJobs0 struct {
  87. MigrationJob []DescribeMigrationJobsMigrationJob1 `json:"MigrationJob" xml:"MigrationJob"`
  88. }
  89. type DescribeMigrationJobsMigrationJob1 struct {
  90. MigrationJobID string `json:"MigrationJobID" xml:"MigrationJobID"`
  91. MigrationJobName string `json:"MigrationJobName" xml:"MigrationJobName"`
  92. PayType string `json:"PayType" xml:"PayType"`
  93. MigrationJobClass string `json:"MigrationJobClass" xml:"MigrationJobClass"`
  94. MigrationJobStatus string `json:"MigrationJobStatus" xml:"MigrationJobStatus"`
  95. MigrationObject []DescribeMigrationJobsMigrationObject1 `json:"MigrationObject" xml:"MigrationObject"`
  96. SourceEndpoint DescribeMigrationJobsSourceEndpoint1 `json:"SourceEndpoint" xml:"SourceEndpoint"`
  97. DestinationEndpoint DescribeMigrationJobsDestinationEndpoint1 `json:"DestinationEndpoint" xml:"DestinationEndpoint"`
  98. MigrationMode DescribeMigrationJobsMigrationMode1 `json:"MigrationMode" xml:"MigrationMode"`
  99. Precheck DescribeMigrationJobsPrecheck1 `json:"Precheck" xml:"Precheck"`
  100. StructureInitialization DescribeMigrationJobsStructureInitialization1 `json:"StructureInitialization" xml:"StructureInitialization"`
  101. DataInitialization DescribeMigrationJobsDataInitialization1 `json:"DataInitialization" xml:"DataInitialization"`
  102. DataSynchronization DescribeMigrationJobsDataSynchronization1 `json:"DataSynchronization" xml:"DataSynchronization"`
  103. }
  104. type DescribeMigrationJobsMigrationObject1 struct {
  105. SynchronousObject []DescribeMigrationJobsSynchronousObject2 `json:"SynchronousObject" xml:"SynchronousObject"`
  106. }
  107. type DescribeMigrationJobsSynchronousObject2 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 DescribeMigrationJobsSourceEndpoint1 struct {
  113. InstanceID string `json:"InstanceID" xml:"InstanceID"`
  114. InstanceType string `json:"InstanceType" xml:"InstanceType"`
  115. EngineName string `json:"EngineName" xml:"EngineName"`
  116. IP string `json:"IP" xml:"IP"`
  117. Port string `json:"Port" xml:"Port"`
  118. DatabaseName string `json:"DatabaseName" xml:"DatabaseName"`
  119. OracleSID string `json:"OracleSID" xml:"OracleSID"`
  120. UserName string `json:"UserName" xml:"UserName"`
  121. }
  122. type DescribeMigrationJobsDestinationEndpoint1 struct {
  123. InstanceID string `json:"InstanceID" xml:"InstanceID"`
  124. InstanceType string `json:"InstanceType" xml:"InstanceType"`
  125. EngineName string `json:"EngineName" xml:"EngineName"`
  126. IP string `json:"IP" xml:"IP"`
  127. Port string `json:"Port" xml:"Port"`
  128. DatabaseName string `json:"DatabaseName" xml:"DatabaseName"`
  129. OracleSID string `json:"OracleSID" xml:"OracleSID"`
  130. UserName string `json:"UserName" xml:"UserName"`
  131. }
  132. type DescribeMigrationJobsMigrationMode1 struct {
  133. StructureInitialization bool `json:"StructureInitialization" xml:"StructureInitialization"`
  134. DataInitialization bool `json:"DataInitialization" xml:"DataInitialization"`
  135. DataSynchronization bool `json:"DataSynchronization" xml:"DataSynchronization"`
  136. }
  137. type DescribeMigrationJobsPrecheck1 struct {
  138. Status string `json:"Status" xml:"Status"`
  139. Percent string `json:"Percent" xml:"Percent"`
  140. }
  141. type DescribeMigrationJobsStructureInitialization1 struct {
  142. Status string `json:"Status" xml:"Status"`
  143. Percent string `json:"Percent" xml:"Percent"`
  144. ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"`
  145. Progress string `json:"Progress" xml:"Progress"`
  146. }
  147. type DescribeMigrationJobsDataInitialization1 struct {
  148. Status string `json:"Status" xml:"Status"`
  149. Percent string `json:"Percent" xml:"Percent"`
  150. ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"`
  151. Progress string `json:"Progress" xml:"Progress"`
  152. }
  153. type DescribeMigrationJobsDataSynchronization1 struct {
  154. Status string `json:"Status" xml:"Status"`
  155. Percent string `json:"Percent" xml:"Percent"`
  156. ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"`
  157. Delay string `json:"Delay" xml:"Delay"`
  158. }
  159. // CreateDescribeMigrationJobsRequest creates a request to invoke DescribeMigrationJobs API
  160. func CreateDescribeMigrationJobsRequest() (request *DescribeMigrationJobsRequest) {
  161. request = &DescribeMigrationJobsRequest{
  162. RpcRequest: &requests.RpcRequest{},
  163. }
  164. request.InitWithApiInfo("Dts", "2018-08-01", "DescribeMigrationJobs", "dts", "openAPI")
  165. return
  166. }
  167. // CreateDescribeMigrationJobsResponse creates a response to parse from DescribeMigrationJobs response
  168. func CreateDescribeMigrationJobsResponse() (response *DescribeMigrationJobsResponse) {
  169. response = &DescribeMigrationJobsResponse{
  170. BaseResponse: &responses.BaseResponse{},
  171. }
  172. return
  173. }