create_cluster_v2.go 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. package emr
  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. // CreateClusterV2 invokes the emr.CreateClusterV2 API synchronously
  21. // api document: https://help.aliyun.com/api/emr/createclusterv2.html
  22. func (client *Client) CreateClusterV2(request *CreateClusterV2Request) (response *CreateClusterV2Response, err error) {
  23. response = CreateCreateClusterV2Response()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // CreateClusterV2WithChan invokes the emr.CreateClusterV2 API asynchronously
  28. // api document: https://help.aliyun.com/api/emr/createclusterv2.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) CreateClusterV2WithChan(request *CreateClusterV2Request) (<-chan *CreateClusterV2Response, <-chan error) {
  31. responseChan := make(chan *CreateClusterV2Response, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.CreateClusterV2(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. // CreateClusterV2WithCallback invokes the emr.CreateClusterV2 API asynchronously
  51. // api document: https://help.aliyun.com/api/emr/createclusterv2.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) CreateClusterV2WithCallback(request *CreateClusterV2Request, callback func(response *CreateClusterV2Response, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *CreateClusterV2Response
  57. var err error
  58. defer close(result)
  59. response, err = client.CreateClusterV2(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. // CreateClusterV2Request is the request struct for api CreateClusterV2
  71. type CreateClusterV2Request struct {
  72. *requests.RpcRequest
  73. AutoPayOrder requests.Boolean `position:"Query" name:"AutoPayOrder"`
  74. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  75. LogPath string `position:"Query" name:"LogPath"`
  76. MasterPwd string `position:"Query" name:"MasterPwd"`
  77. Configurations string `position:"Query" name:"Configurations"`
  78. IoOptimized requests.Boolean `position:"Query" name:"IoOptimized"`
  79. SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
  80. SshEnable requests.Boolean `position:"Query" name:"SshEnable"`
  81. EasEnable requests.Boolean `position:"Query" name:"EasEnable"`
  82. KeyPairName string `position:"Query" name:"KeyPairName"`
  83. MetaStoreType string `position:"Query" name:"MetaStoreType"`
  84. SecurityGroupName string `position:"Query" name:"SecurityGroupName"`
  85. DepositType string `position:"Query" name:"DepositType"`
  86. MachineType string `position:"Query" name:"MachineType"`
  87. HostComponentInfo *[]CreateClusterV2HostComponentInfo `position:"Query" name:"HostComponentInfo" type:"Repeated"`
  88. BootstrapAction *[]CreateClusterV2BootstrapAction `position:"Query" name:"BootstrapAction" type:"Repeated"`
  89. UseLocalMetaDb requests.Boolean `position:"Query" name:"UseLocalMetaDb"`
  90. MetaStoreConf string `position:"Query" name:"MetaStoreConf"`
  91. EmrVer string `position:"Query" name:"EmrVer"`
  92. UserInfo *[]CreateClusterV2UserInfo `position:"Query" name:"UserInfo" type:"Repeated"`
  93. UserDefinedEmrEcsRole string `position:"Query" name:"UserDefinedEmrEcsRole"`
  94. AuthorizeContent string `position:"Query" name:"AuthorizeContent"`
  95. IsOpenPublicIp requests.Boolean `position:"Query" name:"IsOpenPublicIp"`
  96. Period requests.Integer `position:"Query" name:"Period"`
  97. WhiteListType string `position:"Query" name:"WhiteListType"`
  98. RelatedClusterId string `position:"Query" name:"RelatedClusterId"`
  99. InstanceGeneration string `position:"Query" name:"InstanceGeneration"`
  100. VSwitchId string `position:"Query" name:"VSwitchId"`
  101. ClusterType string `position:"Query" name:"ClusterType"`
  102. AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"`
  103. OptionSoftWareList *[]string `position:"Query" name:"OptionSoftWareList" type:"Repeated"`
  104. VpcId string `position:"Query" name:"VpcId"`
  105. NetType string `position:"Query" name:"NetType"`
  106. Name string `position:"Query" name:"Name"`
  107. HostGroup *[]CreateClusterV2HostGroup `position:"Query" name:"HostGroup" type:"Repeated"`
  108. ZoneId string `position:"Query" name:"ZoneId"`
  109. ChargeType string `position:"Query" name:"ChargeType"`
  110. UseCustomHiveMetaDB requests.Boolean `position:"Query" name:"UseCustomHiveMetaDB"`
  111. Config *[]CreateClusterV2Config `position:"Query" name:"Config" type:"Repeated"`
  112. HighAvailabilityEnable requests.Boolean `position:"Query" name:"HighAvailabilityEnable"`
  113. InitCustomHiveMetaDB requests.Boolean `position:"Query" name:"InitCustomHiveMetaDB"`
  114. }
  115. // CreateClusterV2HostComponentInfo is a repeated param struct in CreateClusterV2Request
  116. type CreateClusterV2HostComponentInfo struct {
  117. HostName string `name:"HostName"`
  118. ComponentNameList *[]string `name:"ComponentNameList" type:"Repeated"`
  119. ServiceName string `name:"ServiceName"`
  120. }
  121. // CreateClusterV2BootstrapAction is a repeated param struct in CreateClusterV2Request
  122. type CreateClusterV2BootstrapAction struct {
  123. Path string `name:"Path"`
  124. Arg string `name:"Arg"`
  125. Name string `name:"Name"`
  126. }
  127. // CreateClusterV2UserInfo is a repeated param struct in CreateClusterV2Request
  128. type CreateClusterV2UserInfo struct {
  129. Password string `name:"Password"`
  130. UserId string `name:"UserId"`
  131. UserName string `name:"UserName"`
  132. }
  133. // CreateClusterV2HostGroup is a repeated param struct in CreateClusterV2Request
  134. type CreateClusterV2HostGroup struct {
  135. Period string `name:"Period"`
  136. SysDiskCapacity string `name:"SysDiskCapacity"`
  137. DiskCapacity string `name:"DiskCapacity"`
  138. SysDiskType string `name:"SysDiskType"`
  139. ClusterId string `name:"ClusterId"`
  140. DiskType string `name:"DiskType"`
  141. HostGroupName string `name:"HostGroupName"`
  142. VSwitchId string `name:"VSwitchId"`
  143. DiskCount string `name:"DiskCount"`
  144. AutoRenew string `name:"AutoRenew"`
  145. GpuDriver string `name:"GpuDriver"`
  146. HostGroupId string `name:"HostGroupId"`
  147. NodeCount string `name:"NodeCount"`
  148. InstanceType string `name:"InstanceType"`
  149. Comment string `name:"Comment"`
  150. ChargeType string `name:"ChargeType"`
  151. CreateType string `name:"CreateType"`
  152. HostGroupType string `name:"HostGroupType"`
  153. }
  154. // CreateClusterV2Config is a repeated param struct in CreateClusterV2Request
  155. type CreateClusterV2Config struct {
  156. ConfigKey string `name:"ConfigKey"`
  157. FileName string `name:"FileName"`
  158. Encrypt string `name:"Encrypt"`
  159. Replace string `name:"Replace"`
  160. ConfigValue string `name:"ConfigValue"`
  161. ServiceName string `name:"ServiceName"`
  162. }
  163. // CreateClusterV2Response is the response struct for api CreateClusterV2
  164. type CreateClusterV2Response struct {
  165. *responses.BaseResponse
  166. RequestId string `json:"RequestId" xml:"RequestId"`
  167. ClusterId string `json:"ClusterId" xml:"ClusterId"`
  168. EmrOrderId string `json:"EmrOrderId" xml:"EmrOrderId"`
  169. MasterOrderId string `json:"MasterOrderId" xml:"MasterOrderId"`
  170. CoreOrderId string `json:"CoreOrderId" xml:"CoreOrderId"`
  171. }
  172. // CreateCreateClusterV2Request creates a request to invoke CreateClusterV2 API
  173. func CreateCreateClusterV2Request() (request *CreateClusterV2Request) {
  174. request = &CreateClusterV2Request{
  175. RpcRequest: &requests.RpcRequest{},
  176. }
  177. request.InitWithApiInfo("Emr", "2016-04-08", "CreateClusterV2", "emr", "openAPI")
  178. return
  179. }
  180. // CreateCreateClusterV2Response creates a response to parse from CreateClusterV2 response
  181. func CreateCreateClusterV2Response() (response *CreateClusterV2Response) {
  182. response = &CreateClusterV2Response{
  183. BaseResponse: &responses.BaseResponse{},
  184. }
  185. return
  186. }