1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package firehose
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/firehose/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Updates the specified destination of the specified delivery stream. Use this
15// operation to change the destination type (for example, to replace the Amazon S3
16// destination with Amazon Redshift) or change the parameters associated with a
17// destination (for example, to change the bucket name of the Amazon S3
18// destination). The update might not occur immediately. The target delivery stream
19// remains active while the configurations are updated, so data writes to the
20// delivery stream can continue during this process. The updated configurations are
21// usually effective within a few minutes. Switching between Amazon ES and other
22// services is not supported. For an Amazon ES destination, you can only update to
23// another Amazon ES destination. If the destination type is the same, Kinesis Data
24// Firehose merges the configuration parameters specified with the destination
25// configuration that already exists on the delivery stream. If any of the
26// parameters are not specified in the call, the existing values are retained. For
27// example, in the Amazon S3 destination, if EncryptionConfiguration is not
28// specified, then the existing EncryptionConfiguration is maintained on the
29// destination. If the destination type is not the same, for example, changing the
30// destination from Amazon S3 to Amazon Redshift, Kinesis Data Firehose does not
31// merge any parameters. In this case, all parameters must be specified. Kinesis
32// Data Firehose uses CurrentDeliveryStreamVersionId to avoid race conditions and
33// conflicting merges. This is a required field, and the service updates the
34// configuration only if the existing configuration has a version ID that matches.
35// After the update is applied successfully, the version ID is updated, and can be
36// retrieved using DescribeDeliveryStream. Use the new version ID to set
37// CurrentDeliveryStreamVersionId in the next call.
38func (c *Client) UpdateDestination(ctx context.Context, params *UpdateDestinationInput, optFns ...func(*Options)) (*UpdateDestinationOutput, error) {
39	if params == nil {
40		params = &UpdateDestinationInput{}
41	}
42
43	result, metadata, err := c.invokeOperation(ctx, "UpdateDestination", params, optFns, addOperationUpdateDestinationMiddlewares)
44	if err != nil {
45		return nil, err
46	}
47
48	out := result.(*UpdateDestinationOutput)
49	out.ResultMetadata = metadata
50	return out, nil
51}
52
53type UpdateDestinationInput struct {
54
55	// Obtain this value from the VersionId result of DeliveryStreamDescription. This
56	// value is required, and helps the service perform conditional operations. For
57	// example, if there is an interleaving update and this value is null, then the
58	// update destination fails. After the update is successful, the VersionId value is
59	// updated. The service then performs a merge of the old configuration with the new
60	// configuration.
61	//
62	// This member is required.
63	CurrentDeliveryStreamVersionId *string
64
65	// The name of the delivery stream.
66	//
67	// This member is required.
68	DeliveryStreamName *string
69
70	// The ID of the destination.
71	//
72	// This member is required.
73	DestinationId *string
74
75	// Describes an update for a destination in Amazon ES.
76	ElasticsearchDestinationUpdate *types.ElasticsearchDestinationUpdate
77
78	// Describes an update for a destination in Amazon S3.
79	ExtendedS3DestinationUpdate *types.ExtendedS3DestinationUpdate
80
81	// Describes an update to the specified HTTP endpoint destination.
82	HttpEndpointDestinationUpdate *types.HttpEndpointDestinationUpdate
83
84	// Describes an update for a destination in Amazon Redshift.
85	RedshiftDestinationUpdate *types.RedshiftDestinationUpdate
86
87	// [Deprecated] Describes an update for a destination in Amazon S3.
88	//
89	// Deprecated: This member has been deprecated.
90	S3DestinationUpdate *types.S3DestinationUpdate
91
92	// Describes an update for a destination in Splunk.
93	SplunkDestinationUpdate *types.SplunkDestinationUpdate
94}
95
96type UpdateDestinationOutput struct {
97	// Metadata pertaining to the operation's result.
98	ResultMetadata middleware.Metadata
99}
100
101func addOperationUpdateDestinationMiddlewares(stack *middleware.Stack, options Options) (err error) {
102	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateDestination{}, middleware.After)
103	if err != nil {
104		return err
105	}
106	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateDestination{}, middleware.After)
107	if err != nil {
108		return err
109	}
110	if err = addSetLoggerMiddleware(stack, options); err != nil {
111		return err
112	}
113	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
117		return err
118	}
119	if err = addResolveEndpointMiddleware(stack, options); err != nil {
120		return err
121	}
122	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
123		return err
124	}
125	if err = addRetryMiddlewares(stack, options); err != nil {
126		return err
127	}
128	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
129		return err
130	}
131	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
132		return err
133	}
134	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
135		return err
136	}
137	if err = addClientUserAgent(stack); err != nil {
138		return err
139	}
140	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
141		return err
142	}
143	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
144		return err
145	}
146	if err = addOpUpdateDestinationValidationMiddleware(stack); err != nil {
147		return err
148	}
149	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateDestination(options.Region), middleware.Before); err != nil {
150		return err
151	}
152	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
153		return err
154	}
155	if err = addResponseErrorMiddleware(stack); err != nil {
156		return err
157	}
158	if err = addRequestResponseLogging(stack, options); err != nil {
159		return err
160	}
161	return nil
162}
163
164func newServiceMetadataMiddleware_opUpdateDestination(region string) *awsmiddleware.RegisterServiceMetadata {
165	return &awsmiddleware.RegisterServiceMetadata{
166		Region:        region,
167		ServiceID:     ServiceID,
168		SigningName:   "firehose",
169		OperationName: "UpdateDestination",
170	}
171}
172