1package ehpc
2
3//Licensed under the Apache License, Version 2.0 (the "License");
4//you may not use this file except in compliance with the License.
5//You may obtain a copy of the License at
6//
7//http://www.apache.org/licenses/LICENSE-2.0
8//
9//Unless required by applicable law or agreed to in writing, software
10//distributed under the License is distributed on an "AS IS" BASIS,
11//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//See the License for the specific language governing permissions and
13//limitations under the License.
14//
15// Code generated by Alibaba Cloud SDK Code Generator.
16// Changes may cause incorrect behavior and will be lost if the code is regenerated.
17
18import (
19	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
20	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
21)
22
23// CreateCluster invokes the ehpc.CreateCluster API synchronously
24// api document: https://help.aliyun.com/api/ehpc/createcluster.html
25func (client *Client) CreateCluster(request *CreateClusterRequest) (response *CreateClusterResponse, err error) {
26	response = CreateCreateClusterResponse()
27	err = client.DoAction(request, response)
28	return
29}
30
31// CreateClusterWithChan invokes the ehpc.CreateCluster API asynchronously
32// api document: https://help.aliyun.com/api/ehpc/createcluster.html
33// asynchronous document: https://help.aliyun.com/document_detail/66220.html
34func (client *Client) CreateClusterWithChan(request *CreateClusterRequest) (<-chan *CreateClusterResponse, <-chan error) {
35	responseChan := make(chan *CreateClusterResponse, 1)
36	errChan := make(chan error, 1)
37	err := client.AddAsyncTask(func() {
38		defer close(responseChan)
39		defer close(errChan)
40		response, err := client.CreateCluster(request)
41		if err != nil {
42			errChan <- err
43		} else {
44			responseChan <- response
45		}
46	})
47	if err != nil {
48		errChan <- err
49		close(responseChan)
50		close(errChan)
51	}
52	return responseChan, errChan
53}
54
55// CreateClusterWithCallback invokes the ehpc.CreateCluster API asynchronously
56// api document: https://help.aliyun.com/api/ehpc/createcluster.html
57// asynchronous document: https://help.aliyun.com/document_detail/66220.html
58func (client *Client) CreateClusterWithCallback(request *CreateClusterRequest, callback func(response *CreateClusterResponse, err error)) <-chan int {
59	result := make(chan int, 1)
60	err := client.AddAsyncTask(func() {
61		var response *CreateClusterResponse
62		var err error
63		defer close(result)
64		response, err = client.CreateCluster(request)
65		callback(response, err)
66		result <- 1
67	})
68	if err != nil {
69		defer close(result)
70		callback(nil, err)
71		result <- 0
72	}
73	return result
74}
75
76// CreateClusterRequest is the request struct for api CreateCluster
77type CreateClusterRequest struct {
78	*requests.RpcRequest
79	SccClusterId                string                            `position:"Query" name:"SccClusterId"`
80	ImageId                     string                            `position:"Query" name:"ImageId"`
81	AdditionalVolumes           *[]CreateClusterAdditionalVolumes `position:"Query" name:"AdditionalVolumes"  type:"Repeated"`
82	EcsOrderManagerInstanceType string                            `position:"Query" name:"EcsOrder.Manager.InstanceType"`
83	EhpcVersion                 string                            `position:"Query" name:"EhpcVersion"`
84	AccountType                 string                            `position:"Query" name:"AccountType"`
85	SecurityGroupId             string                            `position:"Query" name:"SecurityGroupId"`
86	Description                 string                            `position:"Query" name:"Description"`
87	KeyPairName                 string                            `position:"Query" name:"KeyPairName"`
88	SecurityGroupName           string                            `position:"Query" name:"SecurityGroupName"`
89	EcsOrderComputeInstanceType string                            `position:"Query" name:"EcsOrder.Compute.InstanceType"`
90	JobQueue                    string                            `position:"Query" name:"JobQueue"`
91	ImageOwnerAlias             string                            `position:"Query" name:"ImageOwnerAlias"`
92	VolumeType                  string                            `position:"Query" name:"VolumeType"`
93	DeployMode                  string                            `position:"Query" name:"DeployMode"`
94	EcsOrderManagerCount        requests.Integer                  `position:"Query" name:"EcsOrder.Manager.Count"`
95	ResourceGroupId             string                            `position:"Query" name:"ResourceGroupId"`
96	Password                    string                            `position:"Query" name:"Password"`
97	EcsOrderLoginCount          requests.Integer                  `position:"Query" name:"EcsOrder.Login.Count"`
98	RemoteVisEnable             string                            `position:"Query" name:"RemoteVisEnable"`
99	SystemDiskSize              requests.Integer                  `position:"Query" name:"SystemDiskSize"`
100	ComputeSpotPriceLimit       string                            `position:"Query" name:"ComputeSpotPriceLimit"`
101	AutoRenewPeriod             requests.Integer                  `position:"Query" name:"AutoRenewPeriod"`
102	Period                      requests.Integer                  `position:"Query" name:"Period"`
103	VolumeProtocol              string                            `position:"Query" name:"VolumeProtocol"`
104	ClientVersion               string                            `position:"Query" name:"ClientVersion"`
105	OsTag                       string                            `position:"Query" name:"OsTag"`
106	RemoteDirectory             string                            `position:"Query" name:"RemoteDirectory"`
107	EcsOrderComputeCount        requests.Integer                  `position:"Query" name:"EcsOrder.Compute.Count"`
108	ComputeSpotStrategy         string                            `position:"Query" name:"ComputeSpotStrategy"`
109	PostInstallScript           *[]CreateClusterPostInstallScript `position:"Query" name:"PostInstallScript"  type:"Repeated"`
110	VSwitchId                   string                            `position:"Query" name:"VSwitchId"`
111	PeriodUnit                  string                            `position:"Query" name:"PeriodUnit"`
112	Application                 *[]CreateClusterApplication       `position:"Query" name:"Application"  type:"Repeated"`
113	AutoRenew                   string                            `position:"Query" name:"AutoRenew"`
114	EcsChargeType               string                            `position:"Query" name:"EcsChargeType"`
115	InputFileUrl                string                            `position:"Query" name:"InputFileUrl"`
116	VpcId                       string                            `position:"Query" name:"VpcId"`
117	HaEnable                    requests.Boolean                  `position:"Query" name:"HaEnable"`
118	Name                        string                            `position:"Query" name:"Name"`
119	SchedulerType               string                            `position:"Query" name:"SchedulerType"`
120	VolumeId                    string                            `position:"Query" name:"VolumeId"`
121	VolumeMountpoint            string                            `position:"Query" name:"VolumeMountpoint"`
122	EcsOrderLoginInstanceType   string                            `position:"Query" name:"EcsOrder.Login.InstanceType"`
123	ZoneId                      string                            `position:"Query" name:"ZoneId"`
124}
125
126// CreateClusterAdditionalVolumes is a repeated param struct in CreateClusterRequest
127type CreateClusterAdditionalVolumes struct {
128	VolumeType       string    `name:"VolumeType"`
129	VolumeProtocol   string    `name:"VolumeProtocol"`
130	LocalDirectory   string    `name:"LocalDirectory"`
131	RemoteDirectory  string    `name:"RemoteDirectory"`
132	Roles            *[]string `name:"Roles" type:"Repeated"`
133	VolumeId         string    `name:"VolumeId"`
134	VolumeMountpoint string    `name:"VolumeMountpoint"`
135	Location         string    `name:"Location"`
136	JobQueue         string    `name:"JobQueue"`
137}
138
139// CreateClusterPostInstallScript is a repeated param struct in CreateClusterRequest
140type CreateClusterPostInstallScript struct {
141	Args string `name:"Args"`
142	Url  string `name:"Url"`
143}
144
145// CreateClusterApplication is a repeated param struct in CreateClusterRequest
146type CreateClusterApplication struct {
147	Tag string `name:"Tag"`
148}
149
150// CreateClusterResponse is the response struct for api CreateCluster
151type CreateClusterResponse struct {
152	*responses.BaseResponse
153	RequestId string `json:"RequestId" xml:"RequestId"`
154	ClusterId string `json:"ClusterId" xml:"ClusterId"`
155}
156
157// CreateCreateClusterRequest creates a request to invoke CreateCluster API
158func CreateCreateClusterRequest() (request *CreateClusterRequest) {
159	request = &CreateClusterRequest{
160		RpcRequest: &requests.RpcRequest{},
161	}
162	request.InitWithApiInfo("EHPC", "2018-04-12", "CreateCluster", "ehs", "openAPI")
163	return
164}
165
166// CreateCreateClusterResponse creates a response to parse from CreateCluster response
167func CreateCreateClusterResponse() (response *CreateClusterResponse) {
168	response = &CreateClusterResponse{
169		BaseResponse: &responses.BaseResponse{},
170	}
171	return
172}
173