1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package kinesisanalytics
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/kinesisanalytics/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// This documentation is for version 1 of the Amazon Kinesis Data Analytics API,
15// which only supports SQL applications. Version 2 of the API supports SQL and Java
16// applications. For more information about version 2, see Amazon Kinesis Data
17// Analytics API V2 Documentation. Adds an external destination to your Amazon
18// Kinesis Analytics application. If you want Amazon Kinesis Analytics to deliver
19// data from an in-application stream within your application to an external
20// destination (such as an Amazon Kinesis stream, an Amazon Kinesis Firehose
21// delivery stream, or an AWS Lambda function), you add the relevant configuration
22// to your application using this operation. You can configure one or more outputs
23// for your application. Each output configuration maps an in-application stream
24// and an external destination. You can use one of the output configurations to
25// deliver data from your in-application error stream to an external destination so
26// that you can analyze the errors. For more information, see Understanding
27// Application Output (Destination)
28// (https://docs.aws.amazon.com/kinesisanalytics/latest/dev/how-it-works-output.html).
29// Any configuration update, including adding a streaming source using this
30// operation, results in a new version of the application. You can use the
31// DescribeApplication
32// (https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html)
33// operation to find the current application version. For the limits on the number
34// of application inputs and outputs you can configure, see Limits
35// (https://docs.aws.amazon.com/kinesisanalytics/latest/dev/limits.html). This
36// operation requires permissions to perform the
37// kinesisanalytics:AddApplicationOutput action.
38func (c *Client) AddApplicationOutput(ctx context.Context, params *AddApplicationOutputInput, optFns ...func(*Options)) (*AddApplicationOutputOutput, error) {
39	if params == nil {
40		params = &AddApplicationOutputInput{}
41	}
42
43	result, metadata, err := c.invokeOperation(ctx, "AddApplicationOutput", params, optFns, addOperationAddApplicationOutputMiddlewares)
44	if err != nil {
45		return nil, err
46	}
47
48	out := result.(*AddApplicationOutputOutput)
49	out.ResultMetadata = metadata
50	return out, nil
51}
52
53//
54type AddApplicationOutputInput struct {
55
56	// Name of the application to which you want to add the output configuration.
57	//
58	// This member is required.
59	ApplicationName *string
60
61	// Version of the application to which you want to add the output configuration.
62	// You can use the DescribeApplication
63	// (https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html)
64	// operation to get the current application version. If the version specified is
65	// not the current version, the ConcurrentModificationException is returned.
66	//
67	// This member is required.
68	CurrentApplicationVersionId *int64
69
70	// An array of objects, each describing one output configuration. In the output
71	// configuration, you specify the name of an in-application stream, a destination
72	// (that is, an Amazon Kinesis stream, an Amazon Kinesis Firehose delivery stream,
73	// or an AWS Lambda function), and record the formation to use when writing to the
74	// destination.
75	//
76	// This member is required.
77	Output *types.Output
78}
79
80//
81type AddApplicationOutputOutput struct {
82	// Metadata pertaining to the operation's result.
83	ResultMetadata middleware.Metadata
84}
85
86func addOperationAddApplicationOutputMiddlewares(stack *middleware.Stack, options Options) (err error) {
87	err = stack.Serialize.Add(&awsAwsjson11_serializeOpAddApplicationOutput{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAddApplicationOutput{}, middleware.After)
92	if err != nil {
93		return err
94	}
95	if err = addSetLoggerMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
99		return err
100	}
101	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
102		return err
103	}
104	if err = addResolveEndpointMiddleware(stack, options); err != nil {
105		return err
106	}
107	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
108		return err
109	}
110	if err = addRetryMiddlewares(stack, options); err != nil {
111		return err
112	}
113	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
114		return err
115	}
116	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
120		return err
121	}
122	if err = addClientUserAgent(stack); err != nil {
123		return err
124	}
125	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addOpAddApplicationOutputValidationMiddleware(stack); err != nil {
132		return err
133	}
134	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddApplicationOutput(options.Region), middleware.Before); err != nil {
135		return err
136	}
137	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addResponseErrorMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addRequestResponseLogging(stack, options); err != nil {
144		return err
145	}
146	return nil
147}
148
149func newServiceMetadataMiddleware_opAddApplicationOutput(region string) *awsmiddleware.RegisterServiceMetadata {
150	return &awsmiddleware.RegisterServiceMetadata{
151		Region:        region,
152		ServiceID:     ServiceID,
153		SigningName:   "kinesisanalytics",
154		OperationName: "AddApplicationOutput",
155	}
156}
157