1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package redshift 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/redshift/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Returns a detailed list of parameters contained within the specified Amazon 16// Redshift parameter group. For each parameter the response includes information 17// such as parameter name, description, data type, value, whether the parameter 18// value is modifiable, and so on. You can specify source filter to retrieve 19// parameters of only specific type. For example, to retrieve parameters that were 20// modified by a user action such as from ModifyClusterParameterGroup, you can 21// specify source equal to user. For more information about parameters and 22// parameter groups, go to Amazon Redshift Parameter Groups 23// (https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html) 24// in the Amazon Redshift Cluster Management Guide. 25func (c *Client) DescribeClusterParameters(ctx context.Context, params *DescribeClusterParametersInput, optFns ...func(*Options)) (*DescribeClusterParametersOutput, error) { 26 if params == nil { 27 params = &DescribeClusterParametersInput{} 28 } 29 30 result, metadata, err := c.invokeOperation(ctx, "DescribeClusterParameters", params, optFns, addOperationDescribeClusterParametersMiddlewares) 31 if err != nil { 32 return nil, err 33 } 34 35 out := result.(*DescribeClusterParametersOutput) 36 out.ResultMetadata = metadata 37 return out, nil 38} 39 40// 41type DescribeClusterParametersInput struct { 42 43 // The name of a cluster parameter group for which to return details. 44 // 45 // This member is required. 46 ParameterGroupName *string 47 48 // An optional parameter that specifies the starting point to return a set of 49 // response records. When the results of a DescribeClusterParameters request exceed 50 // the value specified in MaxRecords, AWS returns a value in the Marker field of 51 // the response. You can retrieve the next set of response records by providing the 52 // returned marker value in the Marker parameter and retrying the request. 53 Marker *string 54 55 // The maximum number of response records to return in each call. If the number of 56 // remaining response records exceeds the specified MaxRecords value, a value is 57 // returned in a marker field of the response. You can retrieve the next set of 58 // records by retrying the command with the returned marker value. Default: 100 59 // Constraints: minimum 20, maximum 100. 60 MaxRecords *int32 61 62 // The parameter types to return. Specify user to show parameters that are 63 // different form the default. Similarly, specify engine-default to show parameters 64 // that are the same as the default parameter group. Default: All parameter types 65 // returned. Valid Values: user | engine-default 66 Source *string 67} 68 69// Contains the output from the DescribeClusterParameters action. 70type DescribeClusterParametersOutput struct { 71 72 // A value that indicates the starting point for the next set of response records 73 // in a subsequent request. If a value is returned in a response, you can retrieve 74 // the next set of records by providing this returned marker value in the Marker 75 // parameter and retrying the command. If the Marker field is empty, all response 76 // records have been retrieved for the request. 77 Marker *string 78 79 // A list of Parameter instances. Each instance lists the parameters of one cluster 80 // parameter group. 81 Parameters []types.Parameter 82 83 // Metadata pertaining to the operation's result. 84 ResultMetadata middleware.Metadata 85} 86 87func addOperationDescribeClusterParametersMiddlewares(stack *middleware.Stack, options Options) (err error) { 88 err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeClusterParameters{}, middleware.After) 89 if err != nil { 90 return err 91 } 92 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeClusterParameters{}, middleware.After) 93 if err != nil { 94 return err 95 } 96 if err = addSetLoggerMiddleware(stack, options); err != nil { 97 return err 98 } 99 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 100 return err 101 } 102 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 103 return err 104 } 105 if err = addResolveEndpointMiddleware(stack, options); err != nil { 106 return err 107 } 108 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 109 return err 110 } 111 if err = addRetryMiddlewares(stack, options); err != nil { 112 return err 113 } 114 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 118 return err 119 } 120 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 121 return err 122 } 123 if err = addClientUserAgent(stack); err != nil { 124 return err 125 } 126 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 127 return err 128 } 129 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addOpDescribeClusterParametersValidationMiddleware(stack); err != nil { 133 return err 134 } 135 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeClusterParameters(options.Region), middleware.Before); err != nil { 136 return err 137 } 138 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addResponseErrorMiddleware(stack); err != nil { 142 return err 143 } 144 if err = addRequestResponseLogging(stack, options); err != nil { 145 return err 146 } 147 return nil 148} 149 150// DescribeClusterParametersAPIClient is a client that implements the 151// DescribeClusterParameters operation. 152type DescribeClusterParametersAPIClient interface { 153 DescribeClusterParameters(context.Context, *DescribeClusterParametersInput, ...func(*Options)) (*DescribeClusterParametersOutput, error) 154} 155 156var _ DescribeClusterParametersAPIClient = (*Client)(nil) 157 158// DescribeClusterParametersPaginatorOptions is the paginator options for 159// DescribeClusterParameters 160type DescribeClusterParametersPaginatorOptions struct { 161 // The maximum number of response records to return in each call. If the number of 162 // remaining response records exceeds the specified MaxRecords value, a value is 163 // returned in a marker field of the response. You can retrieve the next set of 164 // records by retrying the command with the returned marker value. Default: 100 165 // Constraints: minimum 20, maximum 100. 166 Limit int32 167 168 // Set to true if pagination should stop if the service returns a pagination token 169 // that matches the most recent token provided to the service. 170 StopOnDuplicateToken bool 171} 172 173// DescribeClusterParametersPaginator is a paginator for DescribeClusterParameters 174type DescribeClusterParametersPaginator struct { 175 options DescribeClusterParametersPaginatorOptions 176 client DescribeClusterParametersAPIClient 177 params *DescribeClusterParametersInput 178 nextToken *string 179 firstPage bool 180} 181 182// NewDescribeClusterParametersPaginator returns a new 183// DescribeClusterParametersPaginator 184func NewDescribeClusterParametersPaginator(client DescribeClusterParametersAPIClient, params *DescribeClusterParametersInput, optFns ...func(*DescribeClusterParametersPaginatorOptions)) *DescribeClusterParametersPaginator { 185 if params == nil { 186 params = &DescribeClusterParametersInput{} 187 } 188 189 options := DescribeClusterParametersPaginatorOptions{} 190 if params.MaxRecords != nil { 191 options.Limit = *params.MaxRecords 192 } 193 194 for _, fn := range optFns { 195 fn(&options) 196 } 197 198 return &DescribeClusterParametersPaginator{ 199 options: options, 200 client: client, 201 params: params, 202 firstPage: true, 203 } 204} 205 206// HasMorePages returns a boolean indicating whether more pages are available 207func (p *DescribeClusterParametersPaginator) HasMorePages() bool { 208 return p.firstPage || p.nextToken != nil 209} 210 211// NextPage retrieves the next DescribeClusterParameters page. 212func (p *DescribeClusterParametersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeClusterParametersOutput, error) { 213 if !p.HasMorePages() { 214 return nil, fmt.Errorf("no more pages available") 215 } 216 217 params := *p.params 218 params.Marker = p.nextToken 219 220 var limit *int32 221 if p.options.Limit > 0 { 222 limit = &p.options.Limit 223 } 224 params.MaxRecords = limit 225 226 result, err := p.client.DescribeClusterParameters(ctx, ¶ms, optFns...) 227 if err != nil { 228 return nil, err 229 } 230 p.firstPage = false 231 232 prevToken := p.nextToken 233 p.nextToken = result.Marker 234 235 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 236 p.nextToken = nil 237 } 238 239 return result, nil 240} 241 242func newServiceMetadataMiddleware_opDescribeClusterParameters(region string) *awsmiddleware.RegisterServiceMetadata { 243 return &awsmiddleware.RegisterServiceMetadata{ 244 Region: region, 245 ServiceID: ServiceID, 246 SigningName: "redshift", 247 OperationName: "DescribeClusterParameters", 248 } 249} 250