submit_analysis_job.go 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. package mts
  2. //Licensed under the Apache License, Version 2.0 (the "License");
  3. //you may not use this file except in compliance with the License.
  4. //You may obtain a copy of the License at
  5. //
  6. //http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. //Unless required by applicable law or agreed to in writing, software
  9. //distributed under the License is distributed on an "AS IS" BASIS,
  10. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. //See the License for the specific language governing permissions and
  12. //limitations under the License.
  13. //
  14. // Code generated by Alibaba Cloud SDK Code Generator.
  15. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. func (client *Client) SubmitAnalysisJob(request *SubmitAnalysisJobRequest) (response *SubmitAnalysisJobResponse, err error) {
  21. response = CreateSubmitAnalysisJobResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) SubmitAnalysisJobWithChan(request *SubmitAnalysisJobRequest) (<-chan *SubmitAnalysisJobResponse, <-chan error) {
  26. responseChan := make(chan *SubmitAnalysisJobResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.SubmitAnalysisJob(request)
  32. if err != nil {
  33. errChan <- err
  34. } else {
  35. responseChan <- response
  36. }
  37. })
  38. if err != nil {
  39. errChan <- err
  40. close(responseChan)
  41. close(errChan)
  42. }
  43. return responseChan, errChan
  44. }
  45. func (client *Client) SubmitAnalysisJobWithCallback(request *SubmitAnalysisJobRequest, callback func(response *SubmitAnalysisJobResponse, err error)) <-chan int {
  46. result := make(chan int, 1)
  47. err := client.AddAsyncTask(func() {
  48. var response *SubmitAnalysisJobResponse
  49. var err error
  50. defer close(result)
  51. response, err = client.SubmitAnalysisJob(request)
  52. callback(response, err)
  53. result <- 1
  54. })
  55. if err != nil {
  56. defer close(result)
  57. callback(nil, err)
  58. result <- 0
  59. }
  60. return result
  61. }
  62. type SubmitAnalysisJobRequest struct {
  63. *requests.RpcRequest
  64. UserData string `position:"Query" name:"UserData"`
  65. Input string `position:"Query" name:"Input"`
  66. PipelineId string `position:"Query" name:"PipelineId"`
  67. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  68. Priority string `position:"Query" name:"Priority"`
  69. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  70. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  71. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  72. AnalysisConfig string `position:"Query" name:"AnalysisConfig"`
  73. }
  74. type SubmitAnalysisJobResponse struct {
  75. *responses.BaseResponse
  76. RequestId string `json:"RequestId" xml:"RequestId"`
  77. AnalysisJob struct {
  78. Id string `json:"Id" xml:"Id"`
  79. UserData string `json:"UserData" xml:"UserData"`
  80. State string `json:"State" xml:"State"`
  81. Code string `json:"Code" xml:"Code"`
  82. Message string `json:"Message" xml:"Message"`
  83. Percent int `json:"Percent" xml:"Percent"`
  84. CreationTime string `json:"CreationTime" xml:"CreationTime"`
  85. PipelineId string `json:"PipelineId" xml:"PipelineId"`
  86. Priority string `json:"Priority" xml:"Priority"`
  87. InputFile struct {
  88. Bucket string `json:"Bucket" xml:"Bucket"`
  89. Location string `json:"Location" xml:"Location"`
  90. Object string `json:"Object" xml:"Object"`
  91. } `json:"InputFile" xml:"InputFile"`
  92. AnalysisConfig struct {
  93. QualityControl struct {
  94. RateQuality string `json:"RateQuality" xml:"RateQuality"`
  95. MethodStreaming string `json:"MethodStreaming" xml:"MethodStreaming"`
  96. } `json:"QualityControl" xml:"QualityControl"`
  97. PropertiesControl struct {
  98. Deinterlace string `json:"Deinterlace" xml:"Deinterlace"`
  99. Crop struct {
  100. Mode string `json:"Mode" xml:"Mode"`
  101. Width string `json:"Width" xml:"Width"`
  102. Height string `json:"Height" xml:"Height"`
  103. Top string `json:"Top" xml:"Top"`
  104. Left string `json:"Left" xml:"Left"`
  105. } `json:"Crop" xml:"Crop"`
  106. } `json:"PropertiesControl" xml:"PropertiesControl"`
  107. } `json:"AnalysisConfig" xml:"AnalysisConfig"`
  108. MNSMessageResult struct {
  109. MessageId string `json:"MessageId" xml:"MessageId"`
  110. ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"`
  111. ErrorCode string `json:"ErrorCode" xml:"ErrorCode"`
  112. } `json:"MNSMessageResult" xml:"MNSMessageResult"`
  113. TemplateList struct {
  114. Template []struct {
  115. Id string `json:"Id" xml:"Id"`
  116. Name string `json:"Name" xml:"Name"`
  117. State string `json:"State" xml:"State"`
  118. Container struct {
  119. Format string `json:"Format" xml:"Format"`
  120. } `json:"Container" xml:"Container"`
  121. Video struct {
  122. Codec string `json:"Codec" xml:"Codec"`
  123. Profile string `json:"Profile" xml:"Profile"`
  124. Bitrate string `json:"Bitrate" xml:"Bitrate"`
  125. Crf string `json:"Crf" xml:"Crf"`
  126. Width string `json:"Width" xml:"Width"`
  127. Height string `json:"Height" xml:"Height"`
  128. Fps string `json:"Fps" xml:"Fps"`
  129. Gop string `json:"Gop" xml:"Gop"`
  130. Preset string `json:"Preset" xml:"Preset"`
  131. ScanMode string `json:"ScanMode" xml:"ScanMode"`
  132. Bufsize string `json:"Bufsize" xml:"Bufsize"`
  133. Maxrate string `json:"Maxrate" xml:"Maxrate"`
  134. PixFmt string `json:"PixFmt" xml:"PixFmt"`
  135. Degrain string `json:"Degrain" xml:"Degrain"`
  136. Qscale string `json:"Qscale" xml:"Qscale"`
  137. BitrateBnd struct {
  138. Max string `json:"Max" xml:"Max"`
  139. Min string `json:"Min" xml:"Min"`
  140. } `json:"BitrateBnd" xml:"BitrateBnd"`
  141. } `json:"Video" xml:"Video"`
  142. Audio struct {
  143. Codec string `json:"Codec" xml:"Codec"`
  144. Profile string `json:"Profile" xml:"Profile"`
  145. Samplerate string `json:"Samplerate" xml:"Samplerate"`
  146. Bitrate string `json:"Bitrate" xml:"Bitrate"`
  147. Channels string `json:"Channels" xml:"Channels"`
  148. Qscale string `json:"Qscale" xml:"Qscale"`
  149. } `json:"Audio" xml:"Audio"`
  150. TransConfig struct {
  151. TransMode string `json:"TransMode" xml:"TransMode"`
  152. } `json:"TransConfig" xml:"TransConfig"`
  153. MuxConfig struct {
  154. Segment struct {
  155. Duration string `json:"Duration" xml:"Duration"`
  156. } `json:"Segment" xml:"Segment"`
  157. Gif struct {
  158. Loop string `json:"Loop" xml:"Loop"`
  159. FinalDelay string `json:"FinalDelay" xml:"FinalDelay"`
  160. } `json:"Gif" xml:"Gif"`
  161. } `json:"MuxConfig" xml:"MuxConfig"`
  162. } `json:"Template" xml:"Template"`
  163. } `json:"TemplateList" xml:"TemplateList"`
  164. } `json:"AnalysisJob" xml:"AnalysisJob"`
  165. }
  166. func CreateSubmitAnalysisJobRequest() (request *SubmitAnalysisJobRequest) {
  167. request = &SubmitAnalysisJobRequest{
  168. RpcRequest: &requests.RpcRequest{},
  169. }
  170. request.InitWithApiInfo("Mts", "2014-06-18", "SubmitAnalysisJob", "mts", "openAPI")
  171. return
  172. }
  173. func CreateSubmitAnalysisJobResponse() (response *SubmitAnalysisJobResponse) {
  174. response = &SubmitAnalysisJobResponse{
  175. BaseResponse: &responses.BaseResponse{},
  176. }
  177. return
  178. }