create_cluster_template.go 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. // CreateClusterTemplate invokes the emr.CreateClusterTemplate API synchronously
  21. // api document: https://help.aliyun.com/api/emr/createclustertemplate.html
  22. func (client *Client) CreateClusterTemplate(request *CreateClusterTemplateRequest) (response *CreateClusterTemplateResponse, err error) {
  23. response = CreateCreateClusterTemplateResponse()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // CreateClusterTemplateWithChan invokes the emr.CreateClusterTemplate API asynchronously
  28. // api document: https://help.aliyun.com/api/emr/createclustertemplate.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) CreateClusterTemplateWithChan(request *CreateClusterTemplateRequest) (<-chan *CreateClusterTemplateResponse, <-chan error) {
  31. responseChan := make(chan *CreateClusterTemplateResponse, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.CreateClusterTemplate(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. // CreateClusterTemplateWithCallback invokes the emr.CreateClusterTemplate API asynchronously
  51. // api document: https://help.aliyun.com/api/emr/createclustertemplate.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) CreateClusterTemplateWithCallback(request *CreateClusterTemplateRequest, callback func(response *CreateClusterTemplateResponse, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *CreateClusterTemplateResponse
  57. var err error
  58. defer close(result)
  59. response, err = client.CreateClusterTemplate(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. // CreateClusterTemplateRequest is the request struct for api CreateClusterTemplate
  71. type CreateClusterTemplateRequest struct {
  72. *requests.RpcRequest
  73. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  74. LogPath string `position:"Query" name:"LogPath"`
  75. MasterPwd string `position:"Query" name:"MasterPwd"`
  76. Configurations string `position:"Query" name:"Configurations"`
  77. IoOptimized requests.Boolean `position:"Query" name:"IoOptimized"`
  78. SecurityGroupId string `position:"Query" name:"SecurityGroupId"`
  79. SshEnable requests.Boolean `position:"Query" name:"SshEnable"`
  80. EasEnable requests.Boolean `position:"Query" name:"EasEnable"`
  81. SecurityGroupName string `position:"Query" name:"SecurityGroupName"`
  82. DepositType string `position:"Query" name:"DepositType"`
  83. MachineType string `position:"Query" name:"MachineType"`
  84. BootstrapAction *[]CreateClusterTemplateBootstrapAction `position:"Query" name:"BootstrapAction" type:"Repeated"`
  85. UseLocalMetaDb requests.Boolean `position:"Query" name:"UseLocalMetaDb"`
  86. EmrVer string `position:"Query" name:"EmrVer"`
  87. TemplateName string `position:"Query" name:"TemplateName"`
  88. UserDefinedEmrEcsRole string `position:"Query" name:"UserDefinedEmrEcsRole"`
  89. IsOpenPublicIp requests.Boolean `position:"Query" name:"IsOpenPublicIp"`
  90. Period requests.Integer `position:"Query" name:"Period"`
  91. InstanceGeneration string `position:"Query" name:"InstanceGeneration"`
  92. VSwitchId string `position:"Query" name:"VSwitchId"`
  93. ClusterType string `position:"Query" name:"ClusterType"`
  94. AutoRenew requests.Boolean `position:"Query" name:"AutoRenew"`
  95. OptionSoftWareList *[]string `position:"Query" name:"OptionSoftWareList" type:"Repeated"`
  96. VpcId string `position:"Query" name:"VpcId"`
  97. NetType string `position:"Query" name:"NetType"`
  98. HostGroup *[]CreateClusterTemplateHostGroup `position:"Query" name:"HostGroup" type:"Repeated"`
  99. ZoneId string `position:"Query" name:"ZoneId"`
  100. UseCustomHiveMetaDb requests.Boolean `position:"Query" name:"UseCustomHiveMetaDb"`
  101. Config *[]CreateClusterTemplateConfig `position:"Query" name:"Config" type:"Repeated"`
  102. HighAvailabilityEnable requests.Boolean `position:"Query" name:"HighAvailabilityEnable"`
  103. InitCustomHiveMetaDb requests.Boolean `position:"Query" name:"InitCustomHiveMetaDb"`
  104. }
  105. // CreateClusterTemplateBootstrapAction is a repeated param struct in CreateClusterTemplateRequest
  106. type CreateClusterTemplateBootstrapAction struct {
  107. Path string `name:"Path"`
  108. Arg string `name:"Arg"`
  109. Name string `name:"Name"`
  110. }
  111. // CreateClusterTemplateHostGroup is a repeated param struct in CreateClusterTemplateRequest
  112. type CreateClusterTemplateHostGroup struct {
  113. Period string `name:"Period"`
  114. SysDiskCapacity string `name:"SysDiskCapacity"`
  115. DiskCapacity string `name:"DiskCapacity"`
  116. SysDiskType string `name:"SysDiskType"`
  117. ClusterId string `name:"ClusterId"`
  118. DiskType string `name:"DiskType"`
  119. HostGroupName string `name:"HostGroupName"`
  120. VSwitchId string `name:"VSwitchId"`
  121. DiskCount string `name:"DiskCount"`
  122. AutoRenew string `name:"AutoRenew"`
  123. HostGroupId string `name:"HostGroupId"`
  124. NodeCount string `name:"NodeCount"`
  125. InstanceType string `name:"InstanceType"`
  126. Comment string `name:"Comment"`
  127. ChargeType string `name:"ChargeType"`
  128. MultiInstanceTypes string `name:"MultiInstanceTypes"`
  129. CreateType string `name:"CreateType"`
  130. HostGroupType string `name:"HostGroupType"`
  131. }
  132. // CreateClusterTemplateConfig is a repeated param struct in CreateClusterTemplateRequest
  133. type CreateClusterTemplateConfig struct {
  134. ConfigKey string `name:"ConfigKey"`
  135. FileName string `name:"FileName"`
  136. Encrypt string `name:"Encrypt"`
  137. Replace string `name:"Replace"`
  138. ConfigValue string `name:"ConfigValue"`
  139. ServiceName string `name:"ServiceName"`
  140. }
  141. // CreateClusterTemplateResponse is the response struct for api CreateClusterTemplate
  142. type CreateClusterTemplateResponse struct {
  143. *responses.BaseResponse
  144. RequestId string `json:"RequestId" xml:"RequestId"`
  145. ClusterTemplateId string `json:"ClusterTemplateId" xml:"ClusterTemplateId"`
  146. }
  147. // CreateCreateClusterTemplateRequest creates a request to invoke CreateClusterTemplate API
  148. func CreateCreateClusterTemplateRequest() (request *CreateClusterTemplateRequest) {
  149. request = &CreateClusterTemplateRequest{
  150. RpcRequest: &requests.RpcRequest{},
  151. }
  152. request.InitWithApiInfo("Emr", "2016-04-08", "CreateClusterTemplate", "emr", "openAPI")
  153. return
  154. }
  155. // CreateCreateClusterTemplateResponse creates a response to parse from CreateClusterTemplate response
  156. func CreateCreateClusterTemplateResponse() (response *CreateClusterTemplateResponse) {
  157. response = &CreateClusterTemplateResponse{
  158. BaseResponse: &responses.BaseResponse{},
  159. }
  160. return
  161. }