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// Returns a list of DBClusterParameterGroup descriptions. If a
16// DBClusterParameterGroupName parameter is specified, the list will contain only
17// the description of the specified DB cluster parameter group. For more
18// information on Amazon Aurora, see  What Is Amazon Aurora?
19// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
20// in the Amazon Aurora User Guide. This action only applies to Aurora DB clusters.
21func (c *Client) DescribeDBClusterParameterGroups(ctx context.Context, params *DescribeDBClusterParameterGroupsInput, optFns ...func(*Options)) (*DescribeDBClusterParameterGroupsOutput, error) {
22	if params == nil {
23		params = &DescribeDBClusterParameterGroupsInput{}
24	}
25
26	result, metadata, err := c.invokeOperation(ctx, "DescribeDBClusterParameterGroups", params, optFns, addOperationDescribeDBClusterParameterGroupsMiddlewares)
27	if err != nil {
28		return nil, err
29	}
30
31	out := result.(*DescribeDBClusterParameterGroupsOutput)
32	out.ResultMetadata = metadata
33	return out, nil
34}
35
36//
37type DescribeDBClusterParameterGroupsInput struct {
38
39	// The name of a specific DB cluster parameter group to return details for.
40	// Constraints:
41	//
42	// * If supplied, must match the name of an existing
43	// DBClusterParameterGroup.
44	DBClusterParameterGroupName *string
45
46	// This parameter isn't currently supported.
47	Filters []types.Filter
48
49	// An optional pagination token provided by a previous
50	// DescribeDBClusterParameterGroups request. If this parameter is specified, the
51	// response includes only records beyond the marker, up to the value specified by
52	// MaxRecords.
53	Marker *string
54
55	// The maximum number of records to include in the response. If more records exist
56	// than the specified MaxRecords value, a pagination token called a marker is
57	// included in the response so you can retrieve the remaining results. Default: 100
58	// Constraints: Minimum 20, maximum 100.
59	MaxRecords *int32
60}
61
62//
63type DescribeDBClusterParameterGroupsOutput struct {
64
65	// A list of DB cluster parameter groups.
66	DBClusterParameterGroups []types.DBClusterParameterGroup
67
68	// An optional pagination token provided by a previous
69	// DescribeDBClusterParameterGroups request. If this parameter is specified, the
70	// response includes only records beyond the marker, up to the value specified by
71	// MaxRecords.
72	Marker *string
73
74	// Metadata pertaining to the operation's result.
75	ResultMetadata middleware.Metadata
76}
77
78func addOperationDescribeDBClusterParameterGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) {
79	err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDBClusterParameterGroups{}, middleware.After)
80	if err != nil {
81		return err
82	}
83	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDBClusterParameterGroups{}, middleware.After)
84	if err != nil {
85		return err
86	}
87	if err = addSetLoggerMiddleware(stack, options); err != nil {
88		return err
89	}
90	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
91		return err
92	}
93	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
94		return err
95	}
96	if err = addResolveEndpointMiddleware(stack, options); err != nil {
97		return err
98	}
99	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
100		return err
101	}
102	if err = addRetryMiddlewares(stack, options); err != nil {
103		return err
104	}
105	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
109		return err
110	}
111	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
112		return err
113	}
114	if err = addClientUserAgent(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
118		return err
119	}
120	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
121		return err
122	}
123	if err = addOpDescribeDBClusterParameterGroupsValidationMiddleware(stack); err != nil {
124		return err
125	}
126	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDBClusterParameterGroups(options.Region), middleware.Before); err != nil {
127		return err
128	}
129	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addResponseErrorMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addRequestResponseLogging(stack, options); err != nil {
136		return err
137	}
138	return nil
139}
140
141// DescribeDBClusterParameterGroupsAPIClient is a client that implements the
142// DescribeDBClusterParameterGroups operation.
143type DescribeDBClusterParameterGroupsAPIClient interface {
144	DescribeDBClusterParameterGroups(context.Context, *DescribeDBClusterParameterGroupsInput, ...func(*Options)) (*DescribeDBClusterParameterGroupsOutput, error)
145}
146
147var _ DescribeDBClusterParameterGroupsAPIClient = (*Client)(nil)
148
149// DescribeDBClusterParameterGroupsPaginatorOptions is the paginator options for
150// DescribeDBClusterParameterGroups
151type DescribeDBClusterParameterGroupsPaginatorOptions struct {
152	// The maximum number of records to include in the response. If more records exist
153	// than the specified MaxRecords value, a pagination token called a marker is
154	// included in the response so you can retrieve the remaining results. Default: 100
155	// Constraints: Minimum 20, maximum 100.
156	Limit int32
157
158	// Set to true if pagination should stop if the service returns a pagination token
159	// that matches the most recent token provided to the service.
160	StopOnDuplicateToken bool
161}
162
163// DescribeDBClusterParameterGroupsPaginator is a paginator for
164// DescribeDBClusterParameterGroups
165type DescribeDBClusterParameterGroupsPaginator struct {
166	options   DescribeDBClusterParameterGroupsPaginatorOptions
167	client    DescribeDBClusterParameterGroupsAPIClient
168	params    *DescribeDBClusterParameterGroupsInput
169	nextToken *string
170	firstPage bool
171}
172
173// NewDescribeDBClusterParameterGroupsPaginator returns a new
174// DescribeDBClusterParameterGroupsPaginator
175func NewDescribeDBClusterParameterGroupsPaginator(client DescribeDBClusterParameterGroupsAPIClient, params *DescribeDBClusterParameterGroupsInput, optFns ...func(*DescribeDBClusterParameterGroupsPaginatorOptions)) *DescribeDBClusterParameterGroupsPaginator {
176	if params == nil {
177		params = &DescribeDBClusterParameterGroupsInput{}
178	}
179
180	options := DescribeDBClusterParameterGroupsPaginatorOptions{}
181	if params.MaxRecords != nil {
182		options.Limit = *params.MaxRecords
183	}
184
185	for _, fn := range optFns {
186		fn(&options)
187	}
188
189	return &DescribeDBClusterParameterGroupsPaginator{
190		options:   options,
191		client:    client,
192		params:    params,
193		firstPage: true,
194	}
195}
196
197// HasMorePages returns a boolean indicating whether more pages are available
198func (p *DescribeDBClusterParameterGroupsPaginator) HasMorePages() bool {
199	return p.firstPage || p.nextToken != nil
200}
201
202// NextPage retrieves the next DescribeDBClusterParameterGroups page.
203func (p *DescribeDBClusterParameterGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDBClusterParameterGroupsOutput, error) {
204	if !p.HasMorePages() {
205		return nil, fmt.Errorf("no more pages available")
206	}
207
208	params := *p.params
209	params.Marker = p.nextToken
210
211	var limit *int32
212	if p.options.Limit > 0 {
213		limit = &p.options.Limit
214	}
215	params.MaxRecords = limit
216
217	result, err := p.client.DescribeDBClusterParameterGroups(ctx, &params, optFns...)
218	if err != nil {
219		return nil, err
220	}
221	p.firstPage = false
222
223	prevToken := p.nextToken
224	p.nextToken = result.Marker
225
226	if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken {
227		p.nextToken = nil
228	}
229
230	return result, nil
231}
232
233func newServiceMetadataMiddleware_opDescribeDBClusterParameterGroups(region string) *awsmiddleware.RegisterServiceMetadata {
234	return &awsmiddleware.RegisterServiceMetadata{
235		Region:        region,
236		ServiceID:     ServiceID,
237		SigningName:   "rds",
238		OperationName: "DescribeDBClusterParameterGroups",
239	}
240}
241