create_cluster_v2.go 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. SecurityGroupName string `position:"Query" name:"SecurityGroupName"`
  84. DepositType string `position:"Query" name:"DepositType"`
  85. MachineType string `position:"Query" name:"MachineType"`
  86. HostComponentInfo *[]CreateClusterV2HostComponentInfo `position:"Query" name:"HostComponentInfo" type:"Repeated"`
  87. BootstrapAction *[]CreateClusterV2BootstrapAction `position:"Query" name:"BootstrapAction" type:"Repeated"`
  88. UseLocalMetaDb requests.Boolean `position:"Query" name:"UseLocalMetaDb"`
  89. EmrVer string `position:"Query" name:"EmrVer"`
  90. UserInfo *[]CreateClusterV2UserInfo `position:"Query" name:"UserInfo" type:"Repeated"`
  91. UserDefinedEmrEcsRole string `position:"Query" name:"UserDefinedEmrEcsRole"`
  92. AuthorizeContent string `position:"Query" name:"AuthorizeContent"`
  93. IsOpenPublicIp requests.Boolean `position:"Query" name:"IsOpenPublicIp"`
  94. Period requests.Integer `position:"Query" name:"Period"`
  95. WhiteListType string `position:"Query" name:"WhiteListType"`
  96. RelatedClusterId string `position:"Query" name:"RelatedClusterId"`
  97. InstanceGeneration string `position:"Query" name:"InstanceGeneration"`
  98. VSwitchId string `position:"Query" name:"VSwitchId"`
  99. ClusterType string `position:"Query" name:"ClusterType"`
  100. AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"`
  101. OptionSoftWareList *[]string `position:"Query" name:"OptionSoftWareList" type:"Repeated"`
  102. VpcId string `position:"Query" name:"VpcId"`
  103. NetType string `position:"Query" name:"NetType"`
  104. Name string `position:"Query" name:"Name"`
  105. HostGroup *[]CreateClusterV2HostGroup `position:"Query" name:"HostGroup" type:"Repeated"`
  106. ZoneId string `position:"Query" name:"ZoneId"`
  107. ChargeType string `position:"Query" name:"ChargeType"`
  108. UseCustomHiveMetaDB requests.Boolean `position:"Query" name:"UseCustomHiveMetaDB"`
  109. Config *[]CreateClusterV2Config `position:"Query" name:"Config" type:"Repeated"`
  110. HighAvailabilityEnable requests.Boolean `position:"Query" name:"HighAvailabilityEnable"`
  111. InitCustomHiveMetaDB requests.Boolean `position:"Query" name:"InitCustomHiveMetaDB"`
  112. }
  113. // CreateClusterV2HostComponentInfo is a repeated param struct in CreateClusterV2Request
  114. type CreateClusterV2HostComponentInfo struct {
  115. HostName string `name:"HostName"`
  116. ComponentNameList *[]string `name:"ComponentNameList" type:"Repeated"`
  117. ServiceName string `name:"ServiceName"`
  118. }
  119. // CreateClusterV2BootstrapAction is a repeated param struct in CreateClusterV2Request
  120. type CreateClusterV2BootstrapAction struct {
  121. Path string `name:"Path"`
  122. Arg string `name:"Arg"`
  123. Name string `name:"Name"`
  124. }
  125. // CreateClusterV2UserInfo is a repeated param struct in CreateClusterV2Request
  126. type CreateClusterV2UserInfo struct {
  127. Password string `name:"Password"`
  128. UserId string `name:"UserId"`
  129. UserName string `name:"UserName"`
  130. }
  131. // CreateClusterV2HostGroup is a repeated param struct in CreateClusterV2Request
  132. type CreateClusterV2HostGroup struct {
  133. Period string `name:"Period"`
  134. SysDiskCapacity string `name:"SysDiskCapacity"`
  135. DiskCapacity string `name:"DiskCapacity"`
  136. SysDiskType string `name:"SysDiskType"`
  137. ClusterId string `name:"ClusterId"`
  138. DiskType string `name:"DiskType"`
  139. HostGroupName string `name:"HostGroupName"`
  140. VSwitchId string `name:"VSwitchId"`
  141. DiskCount string `name:"DiskCount"`
  142. AutoRenew string `name:"AutoRenew"`
  143. GpuDriver string `name:"GpuDriver"`
  144. HostGroupId string `name:"HostGroupId"`
  145. NodeCount string `name:"NodeCount"`
  146. InstanceType string `name:"InstanceType"`
  147. Comment string `name:"Comment"`
  148. ChargeType string `name:"ChargeType"`
  149. CreateType string `name:"CreateType"`
  150. HostGroupType string `name:"HostGroupType"`
  151. }
  152. // CreateClusterV2Config is a repeated param struct in CreateClusterV2Request
  153. type CreateClusterV2Config struct {
  154. ConfigKey string `name:"ConfigKey"`
  155. FileName string `name:"FileName"`
  156. Encrypt string `name:"Encrypt"`
  157. Replace string `name:"Replace"`
  158. ConfigValue string `name:"ConfigValue"`
  159. ServiceName string `name:"ServiceName"`
  160. }
  161. // CreateClusterV2Response is the response struct for api CreateClusterV2
  162. type CreateClusterV2Response struct {
  163. *responses.BaseResponse
  164. RequestId string `json:"RequestId" xml:"RequestId"`
  165. ClusterId string `json:"ClusterId" xml:"ClusterId"`
  166. EmrOrderId string `json:"EmrOrderId" xml:"EmrOrderId"`
  167. MasterOrderId string `json:"MasterOrderId" xml:"MasterOrderId"`
  168. CoreOrderId string `json:"CoreOrderId" xml:"CoreOrderId"`
  169. }
  170. // CreateCreateClusterV2Request creates a request to invoke CreateClusterV2 API
  171. func CreateCreateClusterV2Request() (request *CreateClusterV2Request) {
  172. request = &CreateClusterV2Request{
  173. RpcRequest: &requests.RpcRequest{},
  174. }
  175. request.InitWithApiInfo("Emr", "2016-04-08", "CreateClusterV2", "emr", "openAPI")
  176. return
  177. }
  178. // CreateCreateClusterV2Response creates a response to parse from CreateClusterV2 response
  179. func CreateCreateClusterV2Response() (response *CreateClusterV2Response) {
  180. response = &CreateClusterV2Response{
  181. BaseResponse: &responses.BaseResponse{},
  182. }
  183. return
  184. }