1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package cloudwatchevents
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/cloudwatchevents/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Starts the specified replay. Events are not necessarily replayed in the exact
16// same order that they were added to the archive. A replay processes events to
17// replay based on the time in the event, and replays them using 1 minute
18// intervals. If you specify an EventStartTime and an EventEndTime that covers a 20
19// minute time range, the events are replayed from the first minute of that 20
20// minute range first. Then the events from the second minute are replayed. You can
21// use DescribeReplay to determine the progress of a replay. The value returned for
22// EventLastReplayedTime indicates the time within the specified time range
23// associated with the last event replayed.
24func (c *Client) StartReplay(ctx context.Context, params *StartReplayInput, optFns ...func(*Options)) (*StartReplayOutput, error) {
25	if params == nil {
26		params = &StartReplayInput{}
27	}
28
29	result, metadata, err := c.invokeOperation(ctx, "StartReplay", params, optFns, addOperationStartReplayMiddlewares)
30	if err != nil {
31		return nil, err
32	}
33
34	out := result.(*StartReplayOutput)
35	out.ResultMetadata = metadata
36	return out, nil
37}
38
39type StartReplayInput struct {
40
41	// A ReplayDestination object that includes details about the destination for the
42	// replay.
43	//
44	// This member is required.
45	Destination *types.ReplayDestination
46
47	// A time stamp for the time to stop replaying events. Only events that occurred
48	// between the EventStartTime and EventEndTime are replayed.
49	//
50	// This member is required.
51	EventEndTime *time.Time
52
53	// The ARN of the archive to replay events from.
54	//
55	// This member is required.
56	EventSourceArn *string
57
58	// A time stamp for the time to start replaying events. Only events that occurred
59	// between the EventStartTime and EventEndTime are replayed.
60	//
61	// This member is required.
62	EventStartTime *time.Time
63
64	// The name of the replay to start.
65	//
66	// This member is required.
67	ReplayName *string
68
69	// A description for the replay to start.
70	Description *string
71}
72
73type StartReplayOutput struct {
74
75	// The ARN of the replay.
76	ReplayArn *string
77
78	// The time at which the replay started.
79	ReplayStartTime *time.Time
80
81	// The state of the replay.
82	State types.ReplayState
83
84	// The reason that the replay is in the state.
85	StateReason *string
86
87	// Metadata pertaining to the operation's result.
88	ResultMetadata middleware.Metadata
89}
90
91func addOperationStartReplayMiddlewares(stack *middleware.Stack, options Options) (err error) {
92	err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartReplay{}, middleware.After)
93	if err != nil {
94		return err
95	}
96	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartReplay{}, middleware.After)
97	if err != nil {
98		return err
99	}
100	if err = addSetLoggerMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
104		return err
105	}
106	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
107		return err
108	}
109	if err = addResolveEndpointMiddleware(stack, options); err != nil {
110		return err
111	}
112	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
113		return err
114	}
115	if err = addRetryMiddlewares(stack, options); err != nil {
116		return err
117	}
118	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
122		return err
123	}
124	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
125		return err
126	}
127	if err = addClientUserAgent(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
131		return err
132	}
133	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addOpStartReplayValidationMiddleware(stack); err != nil {
137		return err
138	}
139	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartReplay(options.Region), middleware.Before); err != nil {
140		return err
141	}
142	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addResponseErrorMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addRequestResponseLogging(stack, options); err != nil {
149		return err
150	}
151	return nil
152}
153
154func newServiceMetadataMiddleware_opStartReplay(region string) *awsmiddleware.RegisterServiceMetadata {
155	return &awsmiddleware.RegisterServiceMetadata{
156		Region:        region,
157		ServiceID:     ServiceID,
158		SigningName:   "events",
159		OperationName: "StartReplay",
160	}
161}
162