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