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