nil checks

This commit is contained in:
ravikiran-s 2023-05-03 13:56:49 +05:30
parent f5b9d21ffb
commit 6dec232363

View file

@ -57,9 +57,11 @@ func (d DynamodbStreamAdapterClient) ListShards(ctx context.Context, params *kin
req, _ := json.Marshal(params) req, _ := json.Marshal(params)
log.Info(fmt.Sprintf("ListShards >>> request %v", string(req))) log.Info(fmt.Sprintf("ListShards >>> request %v", string(req)))
var maxResults int32 = 100 var maxResults int32 = 100
if *params.MaxResults >= 100 { if params.MaxResults != nil {
if 100 >= *params.MaxResults {
params.MaxResults = &maxResults params.MaxResults = &maxResults
} }
}
dynamoOutput, err := d.internalClient.DescribeStream(ctx, &dynamodbstreams.DescribeStreamInput{ dynamoOutput, err := d.internalClient.DescribeStream(ctx, &dynamodbstreams.DescribeStreamInput{
ExclusiveStartShardId: params.ExclusiveStartShardId, ExclusiveStartShardId: params.ExclusiveStartShardId,
Limit: params.MaxResults, Limit: params.MaxResults,
@ -279,9 +281,11 @@ func (d DynamodbStreamAdapterClient) convertShardIteratorInput(kinesisInput *kin
func (d DynamodbStreamAdapterClient) convertGetRecordsInput(params *kinesis.GetRecordsInput) *dynamodbstreams.GetRecordsInput { func (d DynamodbStreamAdapterClient) convertGetRecordsInput(params *kinesis.GetRecordsInput) *dynamodbstreams.GetRecordsInput {
var dynamoMaxLimit int32 = 1000 var dynamoMaxLimit int32 = 1000
if params.Limit != nil {
if *params.Limit >= 10000 { if *params.Limit >= 10000 {
params.Limit = &dynamoMaxLimit params.Limit = &dynamoMaxLimit
} }
}
dynamoInput := &dynamodbstreams.GetRecordsInput{ dynamoInput := &dynamodbstreams.GetRecordsInput{
Limit: params.Limit, Limit: params.Limit,
ShardIterator: params.ShardIterator, ShardIterator: params.ShardIterator,