api_op_GetBundles.go raw
1 // Code generated by smithy-go-codegen DO NOT EDIT.
2
3 package lightsail
4
5 import (
6 "context"
7 "fmt"
8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9 "github.com/aws/aws-sdk-go-v2/service/lightsail/types"
10 "github.com/aws/smithy-go/middleware"
11 smithyhttp "github.com/aws/smithy-go/transport/http"
12 )
13
14 // Returns the bundles that you can apply to an Amazon Lightsail instance when you
15 // create it.
16 //
17 // A bundle describes the specifications of an instance, such as the monthly cost,
18 // amount of memory, the number of vCPUs, amount of storage space, and monthly
19 // network data transfer quota.
20 //
21 // Bundles are referred to as instance plans in the Lightsail console.
22 func (c *Client) GetBundles(ctx context.Context, params *GetBundlesInput, optFns ...func(*Options)) (*GetBundlesOutput, error) {
23 if params == nil {
24 params = &GetBundlesInput{}
25 }
26
27 result, metadata, err := c.invokeOperation(ctx, "GetBundles", params, optFns, c.addOperationGetBundlesMiddlewares)
28 if err != nil {
29 return nil, err
30 }
31
32 out := result.(*GetBundlesOutput)
33 out.ResultMetadata = metadata
34 return out, nil
35 }
36
37 type GetBundlesInput struct {
38
39 // Returns a list of bundles that are specific to Lightsail for Research.
40 //
41 // You must use this parameter to view Lightsail for Research bundles.
42 AppCategory types.AppCategory
43
44 // A Boolean value that indicates whether to include inactive (unavailable)
45 // bundles in the response of your request.
46 IncludeInactive *bool
47
48 // The token to advance to the next page of results from your request.
49 //
50 // To get a page token, perform an initial GetBundles request. If your results are
51 // paginated, the response will return a next page token that you can specify as
52 // the page token in a subsequent request.
53 PageToken *string
54
55 noSmithyDocumentSerde
56 }
57
58 type GetBundlesOutput struct {
59
60 // An array of key-value pairs that contains information about the available
61 // bundles.
62 Bundles []types.Bundle
63
64 // The token to advance to the next page of results from your request.
65 //
66 // A next page token is not returned if there are no more results to display.
67 //
68 // To get the next page of results, perform another GetBundles request and specify
69 // the next page token using the pageToken parameter.
70 NextPageToken *string
71
72 // Metadata pertaining to the operation's result.
73 ResultMetadata middleware.Metadata
74
75 noSmithyDocumentSerde
76 }
77
78 func (c *Client) addOperationGetBundlesMiddlewares(stack *middleware.Stack, options Options) (err error) {
79 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
80 return err
81 }
82 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetBundles{}, middleware.After)
83 if err != nil {
84 return err
85 }
86 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetBundles{}, middleware.After)
87 if err != nil {
88 return err
89 }
90 if err := addProtocolFinalizerMiddlewares(stack, options, "GetBundles"); err != nil {
91 return fmt.Errorf("add protocol finalizers: %v", err)
92 }
93
94 if err = addlegacyEndpointContextSetter(stack, options); err != nil {
95 return err
96 }
97 if err = addSetLoggerMiddleware(stack, options); err != nil {
98 return err
99 }
100 if err = addClientRequestID(stack); err != nil {
101 return err
102 }
103 if err = addComputeContentLength(stack); err != nil {
104 return err
105 }
106 if err = addResolveEndpointMiddleware(stack, options); err != nil {
107 return err
108 }
109 if err = addComputePayloadSHA256(stack); err != nil {
110 return err
111 }
112 if err = addRetry(stack, options); err != nil {
113 return err
114 }
115 if err = addRawResponseToMetadata(stack); err != nil {
116 return err
117 }
118 if err = addRecordResponseTiming(stack); err != nil {
119 return err
120 }
121 if err = addSpanRetryLoop(stack, options); err != nil {
122 return err
123 }
124 if err = addClientUserAgent(stack, options); err != nil {
125 return err
126 }
127 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
128 return err
129 }
130 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
131 return err
132 }
133 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
134 return err
135 }
136 if err = addTimeOffsetBuild(stack, c); err != nil {
137 return err
138 }
139 if err = addUserAgentRetryMode(stack, options); err != nil {
140 return err
141 }
142 if err = addCredentialSource(stack, options); err != nil {
143 return err
144 }
145 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBundles(options.Region), middleware.Before); err != nil {
146 return err
147 }
148 if err = addRecursionDetection(stack); err != nil {
149 return err
150 }
151 if err = addRequestIDRetrieverMiddleware(stack); err != nil {
152 return err
153 }
154 if err = addResponseErrorMiddleware(stack); err != nil {
155 return err
156 }
157 if err = addRequestResponseLogging(stack, options); err != nil {
158 return err
159 }
160 if err = addDisableHTTPSMiddleware(stack, options); err != nil {
161 return err
162 }
163 if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
164 return err
165 }
166 if err = addInterceptAttempt(stack, options); err != nil {
167 return err
168 }
169 if err = addInterceptors(stack, options); err != nil {
170 return err
171 }
172 return nil
173 }
174
175 func newServiceMetadataMiddleware_opGetBundles(region string) *awsmiddleware.RegisterServiceMetadata {
176 return &awsmiddleware.RegisterServiceMetadata{
177 Region: region,
178 ServiceID: ServiceID,
179 OperationName: "GetBundles",
180 }
181 }
182