1package dataworks_public
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// CreateFile invokes the dataworks_public.CreateFile API synchronously
24func (client *Client) CreateFile(request *CreateFileRequest) (response *CreateFileResponse, err error) {
25	response = CreateCreateFileResponse()
26	err = client.DoAction(request, response)
27	return
28}
29
30// CreateFileWithChan invokes the dataworks_public.CreateFile API asynchronously
31func (client *Client) CreateFileWithChan(request *CreateFileRequest) (<-chan *CreateFileResponse, <-chan error) {
32	responseChan := make(chan *CreateFileResponse, 1)
33	errChan := make(chan error, 1)
34	err := client.AddAsyncTask(func() {
35		defer close(responseChan)
36		defer close(errChan)
37		response, err := client.CreateFile(request)
38		if err != nil {
39			errChan <- err
40		} else {
41			responseChan <- response
42		}
43	})
44	if err != nil {
45		errChan <- err
46		close(responseChan)
47		close(errChan)
48	}
49	return responseChan, errChan
50}
51
52// CreateFileWithCallback invokes the dataworks_public.CreateFile API asynchronously
53func (client *Client) CreateFileWithCallback(request *CreateFileRequest, callback func(response *CreateFileResponse, err error)) <-chan int {
54	result := make(chan int, 1)
55	err := client.AddAsyncTask(func() {
56		var response *CreateFileResponse
57		var err error
58		defer close(result)
59		response, err = client.CreateFile(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
71// CreateFileRequest is the request struct for api CreateFile
72type CreateFileRequest struct {
73	*requests.RpcRequest
74	FileType                requests.Integer `position:"Body" name:"FileType"`
75	DependentNodeIdList     string           `position:"Body" name:"DependentNodeIdList"`
76	Content                 string           `position:"Body" name:"Content"`
77	ProjectIdentifier       string           `position:"Body" name:"ProjectIdentifier"`
78	ResourceGroupId         requests.Integer `position:"Body" name:"ResourceGroupId"`
79	ProjectId               requests.Integer `position:"Body" name:"ProjectId"`
80	StartEffectDate         requests.Integer `position:"Body" name:"StartEffectDate"`
81	CycleType               string           `position:"Body" name:"CycleType"`
82	Owner                   string           `position:"Body" name:"Owner"`
83	AutoRerunIntervalMillis requests.Integer `position:"Body" name:"AutoRerunIntervalMillis"`
84	InputList               string           `position:"Body" name:"InputList"`
85	RerunMode               string           `position:"Body" name:"RerunMode"`
86	ConnectionName          string           `position:"Body" name:"ConnectionName"`
87	ParaValue               string           `position:"Body" name:"ParaValue"`
88	ResourceGroupIdentifier string           `position:"Body" name:"ResourceGroupIdentifier"`
89	AutoRerunTimes          requests.Integer `position:"Body" name:"AutoRerunTimes"`
90	CronExpress             string           `position:"Body" name:"CronExpress"`
91	EndEffectDate           requests.Integer `position:"Body" name:"EndEffectDate"`
92	FileName                string           `position:"Body" name:"FileName"`
93	Stop                    requests.Boolean `position:"Body" name:"Stop"`
94	DependentType           string           `position:"Body" name:"DependentType"`
95	FileFolderPath          string           `position:"Body" name:"FileFolderPath"`
96	FileDescription         string           `position:"Body" name:"FileDescription"`
97	AutoParsing             requests.Boolean `position:"Body" name:"AutoParsing"`
98}
99
100// CreateFileResponse is the response struct for api CreateFile
101type CreateFileResponse struct {
102	*responses.BaseResponse
103	RequestId      string `json:"RequestId" xml:"RequestId"`
104	Success        bool   `json:"Success" xml:"Success"`
105	ErrorCode      string `json:"ErrorCode" xml:"ErrorCode"`
106	ErrorMessage   string `json:"ErrorMessage" xml:"ErrorMessage"`
107	Data           int64  `json:"Data" xml:"Data"`
108	HttpStatusCode int    `json:"HttpStatusCode" xml:"HttpStatusCode"`
109}
110
111// CreateCreateFileRequest creates a request to invoke CreateFile API
112func CreateCreateFileRequest() (request *CreateFileRequest) {
113	request = &CreateFileRequest{
114		RpcRequest: &requests.RpcRequest{},
115	}
116	request.InitWithApiInfo("dataworks-public", "2020-05-18", "CreateFile", "", "")
117	request.Method = requests.POST
118	return
119}
120
121// CreateCreateFileResponse creates a response to parse from CreateFile response
122func CreateCreateFileResponse() (response *CreateFileResponse) {
123	response = &CreateFileResponse{
124		BaseResponse: &responses.BaseResponse{},
125	}
126	return
127}
128