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