1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package rds 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/rds/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Describes all available options. 16func (c *Client) DescribeOptionGroupOptions(ctx context.Context, params *DescribeOptionGroupOptionsInput, optFns ...func(*Options)) (*DescribeOptionGroupOptionsOutput, error) { 17 if params == nil { 18 params = &DescribeOptionGroupOptionsInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "DescribeOptionGroupOptions", params, optFns, addOperationDescribeOptionGroupOptionsMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*DescribeOptionGroupOptionsOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31// 32type DescribeOptionGroupOptionsInput struct { 33 34 // A required parameter. Options available for the given engine name are described. 35 // Valid Values: 36 // 37 // * mariadb 38 // 39 // * mysql 40 // 41 // * oracle-ee 42 // 43 // * oracle-se2 44 // 45 // * oracle-se1 46 // 47 // * 48 // oracle-se 49 // 50 // * postgres 51 // 52 // * sqlserver-ee 53 // 54 // * sqlserver-se 55 // 56 // * sqlserver-ex 57 // 58 // * 59 // sqlserver-web 60 // 61 // This member is required. 62 EngineName *string 63 64 // This parameter isn't currently supported. 65 Filters []types.Filter 66 67 // If specified, filters the results to include only options for the specified 68 // major engine version. 69 MajorEngineVersion *string 70 71 // An optional pagination token provided by a previous request. If this parameter 72 // is specified, the response includes only records beyond the marker, up to the 73 // value specified by MaxRecords. 74 Marker *string 75 76 // The maximum number of records to include in the response. If more records exist 77 // than the specified MaxRecords value, a pagination token called a marker is 78 // included in the response so that you can retrieve the remaining results. 79 // Default: 100 Constraints: Minimum 20, maximum 100. 80 MaxRecords *int32 81} 82 83// 84type DescribeOptionGroupOptionsOutput struct { 85 86 // An optional pagination token provided by a previous request. If this parameter 87 // is specified, the response includes only records beyond the marker, up to the 88 // value specified by MaxRecords. 89 Marker *string 90 91 // List of available option group options. 92 OptionGroupOptions []types.OptionGroupOption 93 94 // Metadata pertaining to the operation's result. 95 ResultMetadata middleware.Metadata 96} 97 98func addOperationDescribeOptionGroupOptionsMiddlewares(stack *middleware.Stack, options Options) (err error) { 99 err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeOptionGroupOptions{}, middleware.After) 100 if err != nil { 101 return err 102 } 103 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeOptionGroupOptions{}, middleware.After) 104 if err != nil { 105 return err 106 } 107 if err = addSetLoggerMiddleware(stack, options); err != nil { 108 return err 109 } 110 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 111 return err 112 } 113 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 114 return err 115 } 116 if err = addResolveEndpointMiddleware(stack, options); err != nil { 117 return err 118 } 119 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 120 return err 121 } 122 if err = addRetryMiddlewares(stack, options); err != nil { 123 return err 124 } 125 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 126 return err 127 } 128 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 129 return err 130 } 131 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 132 return err 133 } 134 if err = addClientUserAgent(stack); err != nil { 135 return err 136 } 137 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 138 return err 139 } 140 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 141 return err 142 } 143 if err = addOpDescribeOptionGroupOptionsValidationMiddleware(stack); err != nil { 144 return err 145 } 146 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeOptionGroupOptions(options.Region), middleware.Before); err != nil { 147 return err 148 } 149 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addResponseErrorMiddleware(stack); err != nil { 153 return err 154 } 155 if err = addRequestResponseLogging(stack, options); err != nil { 156 return err 157 } 158 return nil 159} 160 161// DescribeOptionGroupOptionsAPIClient is a client that implements the 162// DescribeOptionGroupOptions operation. 163type DescribeOptionGroupOptionsAPIClient interface { 164 DescribeOptionGroupOptions(context.Context, *DescribeOptionGroupOptionsInput, ...func(*Options)) (*DescribeOptionGroupOptionsOutput, error) 165} 166 167var _ DescribeOptionGroupOptionsAPIClient = (*Client)(nil) 168 169// DescribeOptionGroupOptionsPaginatorOptions is the paginator options for 170// DescribeOptionGroupOptions 171type DescribeOptionGroupOptionsPaginatorOptions struct { 172 // The maximum number of records to include in the response. If more records exist 173 // than the specified MaxRecords value, a pagination token called a marker is 174 // included in the response so that you can retrieve the remaining results. 175 // Default: 100 Constraints: Minimum 20, maximum 100. 176 Limit int32 177 178 // Set to true if pagination should stop if the service returns a pagination token 179 // that matches the most recent token provided to the service. 180 StopOnDuplicateToken bool 181} 182 183// DescribeOptionGroupOptionsPaginator is a paginator for 184// DescribeOptionGroupOptions 185type DescribeOptionGroupOptionsPaginator struct { 186 options DescribeOptionGroupOptionsPaginatorOptions 187 client DescribeOptionGroupOptionsAPIClient 188 params *DescribeOptionGroupOptionsInput 189 nextToken *string 190 firstPage bool 191} 192 193// NewDescribeOptionGroupOptionsPaginator returns a new 194// DescribeOptionGroupOptionsPaginator 195func NewDescribeOptionGroupOptionsPaginator(client DescribeOptionGroupOptionsAPIClient, params *DescribeOptionGroupOptionsInput, optFns ...func(*DescribeOptionGroupOptionsPaginatorOptions)) *DescribeOptionGroupOptionsPaginator { 196 if params == nil { 197 params = &DescribeOptionGroupOptionsInput{} 198 } 199 200 options := DescribeOptionGroupOptionsPaginatorOptions{} 201 if params.MaxRecords != nil { 202 options.Limit = *params.MaxRecords 203 } 204 205 for _, fn := range optFns { 206 fn(&options) 207 } 208 209 return &DescribeOptionGroupOptionsPaginator{ 210 options: options, 211 client: client, 212 params: params, 213 firstPage: true, 214 } 215} 216 217// HasMorePages returns a boolean indicating whether more pages are available 218func (p *DescribeOptionGroupOptionsPaginator) HasMorePages() bool { 219 return p.firstPage || p.nextToken != nil 220} 221 222// NextPage retrieves the next DescribeOptionGroupOptions page. 223func (p *DescribeOptionGroupOptionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeOptionGroupOptionsOutput, error) { 224 if !p.HasMorePages() { 225 return nil, fmt.Errorf("no more pages available") 226 } 227 228 params := *p.params 229 params.Marker = p.nextToken 230 231 var limit *int32 232 if p.options.Limit > 0 { 233 limit = &p.options.Limit 234 } 235 params.MaxRecords = limit 236 237 result, err := p.client.DescribeOptionGroupOptions(ctx, ¶ms, optFns...) 238 if err != nil { 239 return nil, err 240 } 241 p.firstPage = false 242 243 prevToken := p.nextToken 244 p.nextToken = result.Marker 245 246 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 247 p.nextToken = nil 248 } 249 250 return result, nil 251} 252 253func newServiceMetadataMiddleware_opDescribeOptionGroupOptions(region string) *awsmiddleware.RegisterServiceMetadata { 254 return &awsmiddleware.RegisterServiceMetadata{ 255 Region: region, 256 ServiceID: ServiceID, 257 SigningName: "rds", 258 OperationName: "DescribeOptionGroupOptions", 259 } 260} 261