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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Updates the bandwidth rate limits of a gateway. You can update both the upload
14// and download bandwidth rate limit or specify only one of the two. If you don't
15// set a bandwidth rate limit, the existing rate limit remains. This operation is
16// supported for the stored volume, cached volume, and tape gateway types. By
17// default, a gateway's bandwidth rate limits are not set. If you don't set any
18// limit, the gateway does not have any limitations on its bandwidth usage and
19// could potentially use the maximum available bandwidth. To specify which gateway
20// to update, use the Amazon Resource Name (ARN) of the gateway in your request.
21func (c *Client) UpdateBandwidthRateLimit(ctx context.Context, params *UpdateBandwidthRateLimitInput, optFns ...func(*Options)) (*UpdateBandwidthRateLimitOutput, error) {
22	if params == nil {
23		params = &UpdateBandwidthRateLimitInput{}
24	}
25
26	result, metadata, err := c.invokeOperation(ctx, "UpdateBandwidthRateLimit", params, optFns, c.addOperationUpdateBandwidthRateLimitMiddlewares)
27	if err != nil {
28		return nil, err
29	}
30
31	out := result.(*UpdateBandwidthRateLimitOutput)
32	out.ResultMetadata = metadata
33	return out, nil
34}
35
36// A JSON object containing one or more of the following fields:
37//
38// *
39// UpdateBandwidthRateLimitInput$AverageDownloadRateLimitInBitsPerSec
40//
41// *
42// UpdateBandwidthRateLimitInput$AverageUploadRateLimitInBitsPerSec
43type UpdateBandwidthRateLimitInput struct {
44
45	// The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to
46	// return a list of gateways for your account and Region.
47	//
48	// This member is required.
49	GatewayARN *string
50
51	// The average download bandwidth rate limit in bits per second.
52	AverageDownloadRateLimitInBitsPerSec *int64
53
54	// The average upload bandwidth rate limit in bits per second.
55	AverageUploadRateLimitInBitsPerSec *int64
56
57	noSmithyDocumentSerde
58}
59
60// A JSON object containing the Amazon Resource Name (ARN) of the gateway whose
61// throttle information was updated.
62type UpdateBandwidthRateLimitOutput struct {
63
64	// The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to
65	// return a list of gateways for your account and Region.
66	GatewayARN *string
67
68	// Metadata pertaining to the operation's result.
69	ResultMetadata middleware.Metadata
70
71	noSmithyDocumentSerde
72}
73
74func (c *Client) addOperationUpdateBandwidthRateLimitMiddlewares(stack *middleware.Stack, options Options) (err error) {
75	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateBandwidthRateLimit{}, middleware.After)
76	if err != nil {
77		return err
78	}
79	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateBandwidthRateLimit{}, middleware.After)
80	if err != nil {
81		return err
82	}
83	if err = addSetLoggerMiddleware(stack, options); err != nil {
84		return err
85	}
86	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
87		return err
88	}
89	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
90		return err
91	}
92	if err = addResolveEndpointMiddleware(stack, options); err != nil {
93		return err
94	}
95	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
96		return err
97	}
98	if err = addRetryMiddlewares(stack, options); err != nil {
99		return err
100	}
101	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
102		return err
103	}
104	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
108		return err
109	}
110	if err = addClientUserAgent(stack); err != nil {
111		return err
112	}
113	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = addOpUpdateBandwidthRateLimitValidationMiddleware(stack); err != nil {
120		return err
121	}
122	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateBandwidthRateLimit(options.Region), middleware.Before); err != nil {
123		return err
124	}
125	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
126		return err
127	}
128	if err = addResponseErrorMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addRequestResponseLogging(stack, options); err != nil {
132		return err
133	}
134	return nil
135}
136
137func newServiceMetadataMiddleware_opUpdateBandwidthRateLimit(region string) *awsmiddleware.RegisterServiceMetadata {
138	return &awsmiddleware.RegisterServiceMetadata{
139		Region:        region,
140		ServiceID:     ServiceID,
141		SigningName:   "storagegateway",
142		OperationName: "UpdateBandwidthRateLimit",
143	}
144}
145