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