1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package redshift 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/redshift/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Returns properties of possible node configurations such as node type, number of 16// nodes, and disk usage for the specified action type. 17func (c *Client) DescribeNodeConfigurationOptions(ctx context.Context, params *DescribeNodeConfigurationOptionsInput, optFns ...func(*Options)) (*DescribeNodeConfigurationOptionsOutput, error) { 18 if params == nil { 19 params = &DescribeNodeConfigurationOptionsInput{} 20 } 21 22 result, metadata, err := c.invokeOperation(ctx, "DescribeNodeConfigurationOptions", params, optFns, addOperationDescribeNodeConfigurationOptionsMiddlewares) 23 if err != nil { 24 return nil, err 25 } 26 27 out := result.(*DescribeNodeConfigurationOptionsOutput) 28 out.ResultMetadata = metadata 29 return out, nil 30} 31 32type DescribeNodeConfigurationOptionsInput struct { 33 34 // The action type to evaluate for possible node configurations. Specify 35 // "restore-cluster" to get configuration combinations based on an existing 36 // snapshot. Specify "recommend-node-config" to get configuration recommendations 37 // based on an existing cluster or snapshot. Specify "resize-cluster" to get 38 // configuration combinations for elastic resize based on an existing cluster. 39 // 40 // This member is required. 41 ActionType types.ActionType 42 43 // The identifier of the cluster to evaluate for possible node configurations. 44 ClusterIdentifier *string 45 46 // A set of name, operator, and value items to filter the results. 47 Filters []types.NodeConfigurationOptionsFilter 48 49 // An optional parameter that specifies the starting point to return a set of 50 // response records. When the results of a DescribeNodeConfigurationOptions request 51 // exceed the value specified in MaxRecords, AWS returns a value in the Marker 52 // field of the response. You can retrieve the next set of response records by 53 // providing the returned marker value in the Marker parameter and retrying the 54 // request. 55 Marker *string 56 57 // The maximum number of response records to return in each call. If the number of 58 // remaining response records exceeds the specified MaxRecords value, a value is 59 // returned in a marker field of the response. You can retrieve the next set of 60 // records by retrying the command with the returned marker value. Default: 500 61 // Constraints: minimum 100, maximum 500. 62 MaxRecords *int32 63 64 // The AWS customer account used to create or copy the snapshot. Required if you 65 // are restoring a snapshot you do not own, optional if you own the snapshot. 66 OwnerAccount *string 67 68 // The identifier of the snapshot to evaluate for possible node configurations. 69 SnapshotIdentifier *string 70} 71 72type DescribeNodeConfigurationOptionsOutput struct { 73 74 // A value that indicates the starting point for the next set of response records 75 // in a subsequent request. If a value is returned in a response, you can retrieve 76 // the next set of records by providing this returned marker value in the Marker 77 // parameter and retrying the command. If the Marker field is empty, all response 78 // records have been retrieved for the request. 79 Marker *string 80 81 // A list of valid node configurations. 82 NodeConfigurationOptionList []types.NodeConfigurationOption 83 84 // Metadata pertaining to the operation's result. 85 ResultMetadata middleware.Metadata 86} 87 88func addOperationDescribeNodeConfigurationOptionsMiddlewares(stack *middleware.Stack, options Options) (err error) { 89 err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeNodeConfigurationOptions{}, middleware.After) 90 if err != nil { 91 return err 92 } 93 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeNodeConfigurationOptions{}, middleware.After) 94 if err != nil { 95 return err 96 } 97 if err = addSetLoggerMiddleware(stack, options); err != nil { 98 return err 99 } 100 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 101 return err 102 } 103 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 104 return err 105 } 106 if err = addResolveEndpointMiddleware(stack, options); err != nil { 107 return err 108 } 109 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 110 return err 111 } 112 if err = addRetryMiddlewares(stack, options); err != nil { 113 return err 114 } 115 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 116 return err 117 } 118 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 119 return err 120 } 121 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 122 return err 123 } 124 if err = addClientUserAgent(stack); 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 = addOpDescribeNodeConfigurationOptionsValidationMiddleware(stack); err != nil { 134 return err 135 } 136 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeNodeConfigurationOptions(options.Region), middleware.Before); err != nil { 137 return err 138 } 139 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 140 return err 141 } 142 if err = addResponseErrorMiddleware(stack); err != nil { 143 return err 144 } 145 if err = addRequestResponseLogging(stack, options); err != nil { 146 return err 147 } 148 return nil 149} 150 151// DescribeNodeConfigurationOptionsAPIClient is a client that implements the 152// DescribeNodeConfigurationOptions operation. 153type DescribeNodeConfigurationOptionsAPIClient interface { 154 DescribeNodeConfigurationOptions(context.Context, *DescribeNodeConfigurationOptionsInput, ...func(*Options)) (*DescribeNodeConfigurationOptionsOutput, error) 155} 156 157var _ DescribeNodeConfigurationOptionsAPIClient = (*Client)(nil) 158 159// DescribeNodeConfigurationOptionsPaginatorOptions is the paginator options for 160// DescribeNodeConfigurationOptions 161type DescribeNodeConfigurationOptionsPaginatorOptions struct { 162 // The maximum number of response records to return in each call. If the number of 163 // remaining response records exceeds the specified MaxRecords value, a value is 164 // returned in a marker field of the response. You can retrieve the next set of 165 // records by retrying the command with the returned marker value. Default: 500 166 // Constraints: minimum 100, maximum 500. 167 Limit int32 168 169 // Set to true if pagination should stop if the service returns a pagination token 170 // that matches the most recent token provided to the service. 171 StopOnDuplicateToken bool 172} 173 174// DescribeNodeConfigurationOptionsPaginator is a paginator for 175// DescribeNodeConfigurationOptions 176type DescribeNodeConfigurationOptionsPaginator struct { 177 options DescribeNodeConfigurationOptionsPaginatorOptions 178 client DescribeNodeConfigurationOptionsAPIClient 179 params *DescribeNodeConfigurationOptionsInput 180 nextToken *string 181 firstPage bool 182} 183 184// NewDescribeNodeConfigurationOptionsPaginator returns a new 185// DescribeNodeConfigurationOptionsPaginator 186func NewDescribeNodeConfigurationOptionsPaginator(client DescribeNodeConfigurationOptionsAPIClient, params *DescribeNodeConfigurationOptionsInput, optFns ...func(*DescribeNodeConfigurationOptionsPaginatorOptions)) *DescribeNodeConfigurationOptionsPaginator { 187 if params == nil { 188 params = &DescribeNodeConfigurationOptionsInput{} 189 } 190 191 options := DescribeNodeConfigurationOptionsPaginatorOptions{} 192 if params.MaxRecords != nil { 193 options.Limit = *params.MaxRecords 194 } 195 196 for _, fn := range optFns { 197 fn(&options) 198 } 199 200 return &DescribeNodeConfigurationOptionsPaginator{ 201 options: options, 202 client: client, 203 params: params, 204 firstPage: true, 205 } 206} 207 208// HasMorePages returns a boolean indicating whether more pages are available 209func (p *DescribeNodeConfigurationOptionsPaginator) HasMorePages() bool { 210 return p.firstPage || p.nextToken != nil 211} 212 213// NextPage retrieves the next DescribeNodeConfigurationOptions page. 214func (p *DescribeNodeConfigurationOptionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeNodeConfigurationOptionsOutput, error) { 215 if !p.HasMorePages() { 216 return nil, fmt.Errorf("no more pages available") 217 } 218 219 params := *p.params 220 params.Marker = p.nextToken 221 222 var limit *int32 223 if p.options.Limit > 0 { 224 limit = &p.options.Limit 225 } 226 params.MaxRecords = limit 227 228 result, err := p.client.DescribeNodeConfigurationOptions(ctx, ¶ms, optFns...) 229 if err != nil { 230 return nil, err 231 } 232 p.firstPage = false 233 234 prevToken := p.nextToken 235 p.nextToken = result.Marker 236 237 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 238 p.nextToken = nil 239 } 240 241 return result, nil 242} 243 244func newServiceMetadataMiddleware_opDescribeNodeConfigurationOptions(region string) *awsmiddleware.RegisterServiceMetadata { 245 return &awsmiddleware.RegisterServiceMetadata{ 246 Region: region, 247 ServiceID: ServiceID, 248 SigningName: "redshift", 249 OperationName: "DescribeNodeConfigurationOptions", 250 } 251} 252