1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package storagegateway
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/storagegateway/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Updates a snapshot schedule configured for a gateway volume. This operation is
15// only supported in the cached volume and stored volume gateway types. The default
16// snapshot schedule for volume is once every 24 hours, starting at the creation
17// time of the volume. You can use this API to change the snapshot schedule
18// configured for the volume. In the request you must identify the gateway volume
19// whose snapshot schedule you want to update, and the schedule information,
20// including when you want the snapshot to begin on a day and the frequency (in
21// hours) of snapshots.
22func (c *Client) UpdateSnapshotSchedule(ctx context.Context, params *UpdateSnapshotScheduleInput, optFns ...func(*Options)) (*UpdateSnapshotScheduleOutput, error) {
23	if params == nil {
24		params = &UpdateSnapshotScheduleInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "UpdateSnapshotSchedule", params, optFns, c.addOperationUpdateSnapshotScheduleMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*UpdateSnapshotScheduleOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37// A JSON object containing one or more of the following fields:
38//
39// *
40// UpdateSnapshotScheduleInput$Description
41//
42// *
43// UpdateSnapshotScheduleInput$RecurrenceInHours
44//
45// *
46// UpdateSnapshotScheduleInput$StartAt
47//
48// * UpdateSnapshotScheduleInput$VolumeARN
49type UpdateSnapshotScheduleInput struct {
50
51	// Frequency of snapshots. Specify the number of hours between snapshots.
52	//
53	// This member is required.
54	RecurrenceInHours *int32
55
56	// The hour of the day at which the snapshot schedule begins represented as hh,
57	// where hh is the hour (0 to 23). The hour of the day is in the time zone of the
58	// gateway.
59	//
60	// This member is required.
61	StartAt *int32
62
63	// The Amazon Resource Name (ARN) of the volume. Use the ListVolumes operation to
64	// return a list of gateway volumes.
65	//
66	// This member is required.
67	VolumeARN *string
68
69	// Optional description of the snapshot that overwrites the existing description.
70	Description *string
71
72	// A list of up to 50 tags that can be assigned to a snapshot. Each tag is a
73	// key-value pair. Valid characters for key and value are letters, spaces, and
74	// numbers representable in UTF-8 format, and the following special characters: + -
75	// = . _ : / @. The maximum length of a tag's key is 128 characters, and the
76	// maximum length for a tag's value is 256.
77	Tags []types.Tag
78
79	noSmithyDocumentSerde
80}
81
82// A JSON object containing the Amazon Resource Name (ARN) of the updated storage
83// volume.
84type UpdateSnapshotScheduleOutput struct {
85
86	// The Amazon Resource Name (ARN) of the volume. Use the ListVolumes operation to
87	// return a list of gateway volumes.
88	VolumeARN *string
89
90	// Metadata pertaining to the operation's result.
91	ResultMetadata middleware.Metadata
92
93	noSmithyDocumentSerde
94}
95
96func (c *Client) addOperationUpdateSnapshotScheduleMiddlewares(stack *middleware.Stack, options Options) (err error) {
97	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateSnapshotSchedule{}, middleware.After)
98	if err != nil {
99		return err
100	}
101	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateSnapshotSchedule{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	if err = addSetLoggerMiddleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
109		return err
110	}
111	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
112		return err
113	}
114	if err = addResolveEndpointMiddleware(stack, options); err != nil {
115		return err
116	}
117	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
118		return err
119	}
120	if err = addRetryMiddlewares(stack, options); err != nil {
121		return err
122	}
123	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
127		return err
128	}
129	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
130		return err
131	}
132	if err = addClientUserAgent(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addOpUpdateSnapshotScheduleValidationMiddleware(stack); err != nil {
142		return err
143	}
144	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateSnapshotSchedule(options.Region), middleware.Before); err != nil {
145		return err
146	}
147	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addResponseErrorMiddleware(stack); err != nil {
151		return err
152	}
153	if err = addRequestResponseLogging(stack, options); err != nil {
154		return err
155	}
156	return nil
157}
158
159func newServiceMetadataMiddleware_opUpdateSnapshotSchedule(region string) *awsmiddleware.RegisterServiceMetadata {
160	return &awsmiddleware.RegisterServiceMetadata{
161		Region:        region,
162		ServiceID:     ServiceID,
163		SigningName:   "storagegateway",
164		OperationName: "UpdateSnapshotSchedule",
165	}
166}
167