1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package datapipeline
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/datapipeline/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Validates the specified pipeline definition to ensure that it is well formed and
15// can be run without error. Example 1 This example sets an valid pipeline
16// configuration and returns success. POST / HTTP/1.1 Content-Type:
17// application/x-amz-json-1.1 X-Amz-Target: DataPipeline.ValidatePipelineDefinition
18// Content-Length: 936 Host: datapipeline.us-east-1.amazonaws.com X-Amz-Date: Mon,
19// 12 Nov 2012 17:49:52 GMT Authorization: AuthParams {"pipelineId":
20// "df-06372391ZG65EXAMPLE", "pipelineObjects": [ {"id": "Default", "name":
21// "Default", "fields": [ {"key": "workerGroup", "stringValue": "MyworkerGroup"} ]
22// }, {"id": "Schedule", "name": "Schedule", "fields": [ {"key": "startDateTime",
23// "stringValue": "2012-09-25T17:00:00"}, {"key": "type", "stringValue":
24// "Schedule"}, {"key": "period", "stringValue": "1 hour"}, {"key": "endDateTime",
25// "stringValue": "2012-09-25T18:00:00"} ] }, {"id": "SayHello", "name":
26// "SayHello", "fields": [ {"key": "type", "stringValue": "ShellCommandActivity"},
27// {"key": "command", "stringValue": "echo hello"}, {"key": "parent", "refValue":
28// "Default"}, {"key": "schedule", "refValue": "Schedule"} ] } ] }
29// x-amzn-RequestId: 92c9f347-0776-11e2-8a14-21bb8a1f50ef Content-Type:
30// application/x-amz-json-1.1 Content-Length: 18 Date: Mon, 12 Nov 2012 17:50:53
31// GMT {"errored": false} Example 2 This example sets an invalid pipeline
32// configuration and returns the associated set of validation errors. POST /
33// HTTP/1.1 Content-Type: application/x-amz-json-1.1 X-Amz-Target:
34// DataPipeline.ValidatePipelineDefinition Content-Length: 903 Host:
35// datapipeline.us-east-1.amazonaws.com X-Amz-Date: Mon, 12 Nov 2012 17:49:52 GMT
36// Authorization: AuthParams {"pipelineId": "df-06372391ZG65EXAMPLE",
37// "pipelineObjects": [ {"id": "Default", "name": "Default", "fields": [ {"key":
38// "workerGroup", "stringValue": "MyworkerGroup"} ] }, {"id": "Schedule", "name":
39// "Schedule", "fields": [ {"key": "startDateTime", "stringValue": "bad-time"},
40// {"key": "type", "stringValue": "Schedule"}, {"key": "period", "stringValue": "1
41// hour"}, {"key": "endDateTime", "stringValue": "2012-09-25T18:00:00"} ] }, {"id":
42// "SayHello", "name": "SayHello", "fields": [ {"key": "type", "stringValue":
43// "ShellCommandActivity"}, {"key": "command", "stringValue": "echo hello"},
44// {"key": "parent", "refValue": "Default"}, {"key": "schedule", "refValue":
45// "Schedule"} ] } ] } x-amzn-RequestId: 496a1f5a-0e6a-11e2-a61c-bd6312c92ddd
46// Content-Type: application/x-amz-json-1.1 Content-Length: 278 Date: Mon, 12 Nov
47// 2012 17:50:53 GMT {"errored": true, "validationErrors": [ {"errors":
48// ["INVALID_FIELD_VALUE: 'startDateTime' value must be a literal datetime
49// value."], "id": "Schedule"} ] }
50func (c *Client) ValidatePipelineDefinition(ctx context.Context, params *ValidatePipelineDefinitionInput, optFns ...func(*Options)) (*ValidatePipelineDefinitionOutput, error) {
51	if params == nil {
52		params = &ValidatePipelineDefinitionInput{}
53	}
54
55	result, metadata, err := c.invokeOperation(ctx, "ValidatePipelineDefinition", params, optFns, addOperationValidatePipelineDefinitionMiddlewares)
56	if err != nil {
57		return nil, err
58	}
59
60	out := result.(*ValidatePipelineDefinitionOutput)
61	out.ResultMetadata = metadata
62	return out, nil
63}
64
65// Contains the parameters for ValidatePipelineDefinition.
66type ValidatePipelineDefinitionInput struct {
67
68	// The ID of the pipeline.
69	//
70	// This member is required.
71	PipelineId *string
72
73	// The objects that define the pipeline changes to validate against the pipeline.
74	//
75	// This member is required.
76	PipelineObjects []types.PipelineObject
77
78	// The parameter objects used with the pipeline.
79	ParameterObjects []types.ParameterObject
80
81	// The parameter values used with the pipeline.
82	ParameterValues []types.ParameterValue
83}
84
85// Contains the output of ValidatePipelineDefinition.
86type ValidatePipelineDefinitionOutput struct {
87
88	// Indicates whether there were validation errors.
89	//
90	// This member is required.
91	Errored bool
92
93	// Any validation errors that were found.
94	ValidationErrors []types.ValidationError
95
96	// Any validation warnings that were found.
97	ValidationWarnings []types.ValidationWarning
98
99	// Metadata pertaining to the operation's result.
100	ResultMetadata middleware.Metadata
101}
102
103func addOperationValidatePipelineDefinitionMiddlewares(stack *middleware.Stack, options Options) (err error) {
104	err = stack.Serialize.Add(&awsAwsjson11_serializeOpValidatePipelineDefinition{}, middleware.After)
105	if err != nil {
106		return err
107	}
108	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpValidatePipelineDefinition{}, middleware.After)
109	if err != nil {
110		return err
111	}
112	if err = addSetLoggerMiddleware(stack, options); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
119		return err
120	}
121	if err = addResolveEndpointMiddleware(stack, options); err != nil {
122		return err
123	}
124	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
125		return err
126	}
127	if err = addRetryMiddlewares(stack, options); err != nil {
128		return err
129	}
130	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
131		return err
132	}
133	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
134		return err
135	}
136	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
137		return err
138	}
139	if err = addClientUserAgent(stack); err != nil {
140		return err
141	}
142	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
143		return err
144	}
145	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addOpValidatePipelineDefinitionValidationMiddleware(stack); err != nil {
149		return err
150	}
151	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opValidatePipelineDefinition(options.Region), middleware.Before); err != nil {
152		return err
153	}
154	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
155		return err
156	}
157	if err = addResponseErrorMiddleware(stack); err != nil {
158		return err
159	}
160	if err = addRequestResponseLogging(stack, options); err != nil {
161		return err
162	}
163	return nil
164}
165
166func newServiceMetadataMiddleware_opValidatePipelineDefinition(region string) *awsmiddleware.RegisterServiceMetadata {
167	return &awsmiddleware.RegisterServiceMetadata{
168		Region:        region,
169		ServiceID:     ServiceID,
170		SigningName:   "datapipeline",
171		OperationName: "ValidatePipelineDefinition",
172	}
173}
174