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