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// ModifyExecutionPlan invokes the emr.ModifyExecutionPlan API synchronously
24// api document: https://help.aliyun.com/api/emr/modifyexecutionplan.html
25func (client *Client) ModifyExecutionPlan(request *ModifyExecutionPlanRequest) (response *ModifyExecutionPlanResponse, err error) {
26	response = CreateModifyExecutionPlanResponse()
27	err = client.DoAction(request, response)
28	return
29}
30
31// ModifyExecutionPlanWithChan invokes the emr.ModifyExecutionPlan API asynchronously
32// api document: https://help.aliyun.com/api/emr/modifyexecutionplan.html
33// asynchronous document: https://help.aliyun.com/document_detail/66220.html
34func (client *Client) ModifyExecutionPlanWithChan(request *ModifyExecutionPlanRequest) (<-chan *ModifyExecutionPlanResponse, <-chan error) {
35	responseChan := make(chan *ModifyExecutionPlanResponse, 1)
36	errChan := make(chan error, 1)
37	err := client.AddAsyncTask(func() {
38		defer close(responseChan)
39		defer close(errChan)
40		response, err := client.ModifyExecutionPlan(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// ModifyExecutionPlanWithCallback invokes the emr.ModifyExecutionPlan API asynchronously
56// api document: https://help.aliyun.com/api/emr/modifyexecutionplan.html
57// asynchronous document: https://help.aliyun.com/document_detail/66220.html
58func (client *Client) ModifyExecutionPlanWithCallback(request *ModifyExecutionPlanRequest, callback func(response *ModifyExecutionPlanResponse, err error)) <-chan int {
59	result := make(chan int, 1)
60	err := client.AddAsyncTask(func() {
61		var response *ModifyExecutionPlanResponse
62		var err error
63		defer close(result)
64		response, err = client.ModifyExecutionPlan(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// ModifyExecutionPlanRequest is the request struct for api ModifyExecutionPlan
77type ModifyExecutionPlanRequest struct {
78	*requests.RpcRequest
79	ResourceOwnerId        requests.Integer                      `position:"Query" name:"ResourceOwnerId"`
80	LogPath                string                                `position:"Query" name:"LogPath"`
81	TimeInterval           requests.Integer                      `position:"Query" name:"TimeInterval"`
82	ClusterName            string                                `position:"Query" name:"ClusterName"`
83	Configurations         string                                `position:"Query" name:"Configurations"`
84	IoOptimized            requests.Boolean                      `position:"Query" name:"IoOptimized"`
85	SecurityGroupId        string                                `position:"Query" name:"SecurityGroupId"`
86	EasEnable              requests.Boolean                      `position:"Query" name:"EasEnable"`
87	CreateClusterOnDemand  requests.Boolean                      `position:"Query" name:"CreateClusterOnDemand"`
88	StartTime              requests.Integer                      `position:"Query" name:"StartTime"`
89	JobIdList              *[]string                             `position:"Query" name:"JobIdList"  type:"Repeated"`
90	DayOfMonth             string                                `position:"Query" name:"DayOfMonth"`
91	BootstrapAction        *[]ModifyExecutionPlanBootstrapAction `position:"Query" name:"BootstrapAction"  type:"Repeated"`
92	UseLocalMetaDb         requests.Boolean                      `position:"Query" name:"UseLocalMetaDb"`
93	EmrVer                 string                                `position:"Query" name:"EmrVer"`
94	Id                     string                                `position:"Query" name:"Id"`
95	UserDefinedEmrEcsRole  string                                `position:"Query" name:"UserDefinedEmrEcsRole"`
96	IsOpenPublicIp         requests.Boolean                      `position:"Query" name:"IsOpenPublicIp"`
97	ExecutionPlanVersion   requests.Integer                      `position:"Query" name:"ExecutionPlanVersion"`
98	ClusterId              string                                `position:"Query" name:"ClusterId"`
99	TimeUnit               string                                `position:"Query" name:"TimeUnit"`
100	InstanceGeneration     string                                `position:"Query" name:"InstanceGeneration"`
101	ClusterType            string                                `position:"Query" name:"ClusterType"`
102	VSwitchId              string                                `position:"Query" name:"VSwitchId"`
103	OptionSoftWareList     *[]string                             `position:"Query" name:"OptionSoftWareList"  type:"Repeated"`
104	VpcId                  string                                `position:"Query" name:"VpcId"`
105	NetType                string                                `position:"Query" name:"NetType"`
106	WorkflowDefinition     string                                `position:"Query" name:"WorkflowDefinition"`
107	EcsOrder               *[]ModifyExecutionPlanEcsOrder        `position:"Query" name:"EcsOrder"  type:"Repeated"`
108	Name                   string                                `position:"Query" name:"Name"`
109	ZoneId                 string                                `position:"Query" name:"ZoneId"`
110	DayOfWeek              string                                `position:"Query" name:"DayOfWeek"`
111	UseCustomHiveMetaDB    requests.Boolean                      `position:"Query" name:"UseCustomHiveMetaDB"`
112	Strategy               string                                `position:"Query" name:"Strategy"`
113	Config                 *[]ModifyExecutionPlanConfig          `position:"Query" name:"Config"  type:"Repeated"`
114	HighAvailabilityEnable requests.Boolean                      `position:"Query" name:"HighAvailabilityEnable"`
115	InitCustomHiveMetaDB   requests.Boolean                      `position:"Query" name:"InitCustomHiveMetaDB"`
116	LogEnable              requests.Boolean                      `position:"Query" name:"LogEnable"`
117}
118
119// ModifyExecutionPlanBootstrapAction is a repeated param struct in ModifyExecutionPlanRequest
120type ModifyExecutionPlanBootstrapAction struct {
121	Path string `name:"Path"`
122	Arg  string `name:"Arg"`
123	Name string `name:"Name"`
124}
125
126// ModifyExecutionPlanEcsOrder is a repeated param struct in ModifyExecutionPlanRequest
127type ModifyExecutionPlanEcsOrder struct {
128	NodeType     string `name:"NodeType"`
129	DiskCount    string `name:"DiskCount"`
130	NodeCount    string `name:"NodeCount"`
131	DiskCapacity string `name:"DiskCapacity"`
132	Index        string `name:"Index"`
133	InstanceType string `name:"InstanceType"`
134	DiskType     string `name:"DiskType"`
135}
136
137// ModifyExecutionPlanConfig is a repeated param struct in ModifyExecutionPlanRequest
138type ModifyExecutionPlanConfig struct {
139	ConfigKey   string `name:"ConfigKey"`
140	FileName    string `name:"FileName"`
141	Encrypt     string `name:"Encrypt"`
142	Replace     string `name:"Replace"`
143	ConfigValue string `name:"ConfigValue"`
144	ServiceName string `name:"ServiceName"`
145}
146
147// ModifyExecutionPlanResponse is the response struct for api ModifyExecutionPlan
148type ModifyExecutionPlanResponse struct {
149	*responses.BaseResponse
150	RequestId string `json:"RequestId" xml:"RequestId"`
151}
152
153// CreateModifyExecutionPlanRequest creates a request to invoke ModifyExecutionPlan API
154func CreateModifyExecutionPlanRequest() (request *ModifyExecutionPlanRequest) {
155	request = &ModifyExecutionPlanRequest{
156		RpcRequest: &requests.RpcRequest{},
157	}
158	request.InitWithApiInfo("Emr", "2016-04-08", "ModifyExecutionPlan", "emr", "openAPI")
159	return
160}
161
162// CreateModifyExecutionPlanResponse creates a response to parse from ModifyExecutionPlan response
163func CreateModifyExecutionPlanResponse() (response *ModifyExecutionPlanResponse) {
164	response = &ModifyExecutionPlanResponse{
165		BaseResponse: &responses.BaseResponse{},
166	}
167	return
168}
169