/
api_op_PutPipelineDefinition.go
209 lines (189 loc) · 8.01 KB
/
api_op_PutPipelineDefinition.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// Code generated by smithy-go-codegen DO NOT EDIT.
package datapipeline
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/service/datapipeline/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds tasks, schedules, and preconditions to the specified pipeline. You can use
// PutPipelineDefinition to populate a new pipeline. PutPipelineDefinition also
// validates the configuration as it adds it to the pipeline. Changes to the
// pipeline are saved unless one of the following three validation errors exists in
// the pipeline.
// - An object is missing a name or identifier field.
// - A string or reference field is empty.
// - The number of objects in the pipeline exceeds the maximum allowed objects.
// - The pipeline is in a FINISHED state.
//
// Pipeline object definitions are passed to the PutPipelineDefinition action and
// returned by the GetPipelineDefinition action. Example 1 This example sets an
// valid pipeline configuration and returns success. POST / HTTP/1.1 Content-Type:
// application/x-amz-json-1.1 X-Amz-Target: DataPipeline.PutPipelineDefinition
// Content-Length: 914 Host: datapipeline.us-east-1.amazonaws.com X-Amz-Date: Mon,
// 12 Nov 2012 17:49:52 GMT Authorization: AuthParams {"pipelineId":
// "df-0937003356ZJEXAMPLE", "pipelineObjects": [ {"id": "Default", "name":
// "Default", "fields": [ {"key": "workerGroup", "stringValue": "workerGroup"} ] },
// {"id": "Schedule", "name": "Schedule", "fields": [ {"key": "startDateTime",
// "stringValue": "2012-12-12T00:00:00"}, {"key": "type", "stringValue":
// "Schedule"}, {"key": "period", "stringValue": "1 hour"}, {"key": "endDateTime",
// "stringValue": "2012-12-21T18:00:00"} ] }, {"id": "SayHello", "name":
// "SayHello", "fields": [ {"key": "type", "stringValue": "ShellCommandActivity"},
// {"key": "command", "stringValue": "echo hello"}, {"key": "parent", "refValue":
// "Default"}, {"key": "schedule", "refValue": "Schedule"} ] } ] } HTTP/1.1 200
// x-amzn-RequestId: f74afc14-0754-11e2-af6f-6bc7a6be60d9 Content-Type:
// application/x-amz-json-1.1 Content-Length: 18 Date: Mon, 12 Nov 2012 17:50:53
// GMT {"errored": false} Example 2 This example sets an invalid pipeline
// configuration (the value for workerGroup is an empty string) and returns an
// error message. POST / HTTP/1.1 Content-Type: application/x-amz-json-1.1
// X-Amz-Target: DataPipeline.PutPipelineDefinition Content-Length: 903 Host:
// datapipeline.us-east-1.amazonaws.com X-Amz-Date: Mon, 12 Nov 2012 17:49:52 GMT
// Authorization: AuthParams {"pipelineId": "df-06372391ZG65EXAMPLE",
// "pipelineObjects": [ {"id": "Default", "name": "Default", "fields": [ {"key":
// "workerGroup", "stringValue": ""} ] }, {"id": "Schedule", "name": "Schedule",
// "fields": [ {"key": "startDateTime", "stringValue": "2012-09-25T17:00:00"},
// {"key": "type", "stringValue": "Schedule"}, {"key": "period", "stringValue": "1
// hour"}, {"key": "endDateTime", "stringValue": "2012-09-25T18:00:00"} ] }, {"id":
// "SayHello", "name": "SayHello", "fields": [ {"key": "type", "stringValue":
// "ShellCommandActivity"}, {"key": "command", "stringValue": "echo hello"},
// {"key": "parent", "refValue": "Default"}, {"key": "schedule", "refValue":
// "Schedule"} ] } ] } HTTP/1.1 200 x-amzn-RequestId:
// f74afc14-0754-11e2-af6f-6bc7a6be60d9 Content-Type: application/x-amz-json-1.1
// Content-Length: 18 Date: Mon, 12 Nov 2012 17:50:53 GMT {"__type":
// "com.amazon.setl.webservice#InvalidRequestException", "message": "Pipeline
// definition has errors: Could not save the pipeline definition due to FATAL
// errors: [com.amazon.setl.webservice.ValidationError@108d7ea9] Please call
// Validate to validate your pipeline"}
func (c *Client) PutPipelineDefinition(ctx context.Context, params *PutPipelineDefinitionInput, optFns ...func(*Options)) (*PutPipelineDefinitionOutput, error) {
if params == nil {
params = &PutPipelineDefinitionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PutPipelineDefinition", params, optFns, c.addOperationPutPipelineDefinitionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PutPipelineDefinitionOutput)
out.ResultMetadata = metadata
return out, nil
}
// Contains the parameters for PutPipelineDefinition.
type PutPipelineDefinitionInput struct {
// The ID of the pipeline.
//
// This member is required.
PipelineId *string
// The objects that define the pipeline. These objects overwrite the existing
// pipeline definition.
//
// This member is required.
PipelineObjects []types.PipelineObject
// The parameter objects used with the pipeline.
ParameterObjects []types.ParameterObject
// The parameter values used with the pipeline.
ParameterValues []types.ParameterValue
noSmithyDocumentSerde
}
// Contains the output of PutPipelineDefinition.
type PutPipelineDefinitionOutput struct {
// Indicates whether there were validation errors, and the pipeline definition is
// stored but cannot be activated until you correct the pipeline and call
// PutPipelineDefinition to commit the corrected pipeline.
//
// This member is required.
Errored bool
// The validation errors that are associated with the objects defined in
// pipelineObjects .
ValidationErrors []types.ValidationError
// The validation warnings that are associated with the objects defined in
// pipelineObjects .
ValidationWarnings []types.ValidationWarning
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutPipelineDefinitionMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutPipelineDefinition{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutPipelineDefinition{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutPipelineDefinition"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = addClientRequestID(stack); err != nil {
return err
}
if err = addComputeContentLength(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = addComputePayloadSHA256(stack); err != nil {
return err
}
if err = addRetry(stack, options); err != nil {
return err
}
if err = addRawResponseToMetadata(stack); err != nil {
return err
}
if err = addRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutPipelineDefinitionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutPipelineDefinition(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opPutPipelineDefinition(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "PutPipelineDefinition",
}
}