1package emr
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// ResizeClusterV2 invokes the emr.ResizeClusterV2 API synchronously
24// api document: https://help.aliyun.com/api/emr/resizeclusterv2.html
25func (client *Client) ResizeClusterV2(request *ResizeClusterV2Request) (response *ResizeClusterV2Response, err error) {
26	response = CreateResizeClusterV2Response()
27	err = client.DoAction(request, response)
28	return
29}
30
31// ResizeClusterV2WithChan invokes the emr.ResizeClusterV2 API asynchronously
32// api document: https://help.aliyun.com/api/emr/resizeclusterv2.html
33// asynchronous document: https://help.aliyun.com/document_detail/66220.html
34func (client *Client) ResizeClusterV2WithChan(request *ResizeClusterV2Request) (<-chan *ResizeClusterV2Response, <-chan error) {
35	responseChan := make(chan *ResizeClusterV2Response, 1)
36	errChan := make(chan error, 1)
37	err := client.AddAsyncTask(func() {
38		defer close(responseChan)
39		defer close(errChan)
40		response, err := client.ResizeClusterV2(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// ResizeClusterV2WithCallback invokes the emr.ResizeClusterV2 API asynchronously
56// api document: https://help.aliyun.com/api/emr/resizeclusterv2.html
57// asynchronous document: https://help.aliyun.com/document_detail/66220.html
58func (client *Client) ResizeClusterV2WithCallback(request *ResizeClusterV2Request, callback func(response *ResizeClusterV2Response, err error)) <-chan int {
59	result := make(chan int, 1)
60	err := client.AddAsyncTask(func() {
61		var response *ResizeClusterV2Response
62		var err error
63		defer close(result)
64		response, err = client.ResizeClusterV2(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// ResizeClusterV2Request is the request struct for api ResizeClusterV2
77type ResizeClusterV2Request struct {
78	*requests.RpcRequest
79	VswitchId         string                              `position:"Query" name:"VswitchId"`
80	IsOpenPublicIp    requests.Boolean                    `position:"Query" name:"IsOpenPublicIp"`
81	AutoPayOrder      requests.Boolean                    `position:"Query" name:"AutoPayOrder"`
82	HostComponentInfo *[]ResizeClusterV2HostComponentInfo `position:"Query" name:"HostComponentInfo"  type:"Repeated"`
83	HostGroup         *[]ResizeClusterV2HostGroup         `position:"Query" name:"HostGroup"  type:"Repeated"`
84	ClusterId         string                              `position:"Query" name:"ClusterId"`
85}
86
87// ResizeClusterV2HostComponentInfo is a repeated param struct in ResizeClusterV2Request
88type ResizeClusterV2HostComponentInfo struct {
89	HostName          string    `name:"HostName"`
90	ComponentNameList *[]string `name:"ComponentNameList" type:"Repeated"`
91	ServiceName       string    `name:"ServiceName"`
92}
93
94// ResizeClusterV2HostGroup is a repeated param struct in ResizeClusterV2Request
95type ResizeClusterV2HostGroup struct {
96	Period          string `name:"Period"`
97	SysDiskCapacity string `name:"SysDiskCapacity"`
98	HostKeyPairName string `name:"HostKeyPairName"`
99	DiskCapacity    string `name:"DiskCapacity"`
100	SysDiskType     string `name:"SysDiskType"`
101	ClusterId       string `name:"ClusterId"`
102	DiskType        string `name:"DiskType"`
103	HostGroupName   string `name:"HostGroupName"`
104	VswitchId       string `name:"VswitchId"`
105	DiskCount       string `name:"DiskCount"`
106	AutoRenew       string `name:"AutoRenew"`
107	HostGroupId     string `name:"HostGroupId"`
108	NodeCount       string `name:"NodeCount"`
109	InstanceType    string `name:"InstanceType"`
110	Comment         string `name:"Comment"`
111	ChargeType      string `name:"ChargeType"`
112	CreateType      string `name:"CreateType"`
113	HostPassword    string `name:"HostPassword"`
114	HostGroupType   string `name:"HostGroupType"`
115}
116
117// ResizeClusterV2Response is the response struct for api ResizeClusterV2
118type ResizeClusterV2Response struct {
119	*responses.BaseResponse
120	RequestId string `json:"RequestId" xml:"RequestId"`
121	ClusterId string `json:"ClusterId" xml:"ClusterId"`
122}
123
124// CreateResizeClusterV2Request creates a request to invoke ResizeClusterV2 API
125func CreateResizeClusterV2Request() (request *ResizeClusterV2Request) {
126	request = &ResizeClusterV2Request{
127		RpcRequest: &requests.RpcRequest{},
128	}
129	request.InitWithApiInfo("Emr", "2016-04-08", "ResizeClusterV2", "emr", "openAPI")
130	return
131}
132
133// CreateResizeClusterV2Response creates a response to parse from ResizeClusterV2 response
134func CreateResizeClusterV2Response() (response *ResizeClusterV2Response) {
135	response = &ResizeClusterV2Response{
136		BaseResponse: &responses.BaseResponse{},
137	}
138	return
139}
140