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