Skip to content

Commit

Permalink
fixed NPE for fetching an optional field in GetQueueUrlInput
Browse files Browse the repository at this point in the history
  • Loading branch information
viv-ng committed Nov 27, 2024
1 parent 2d57c71 commit 912ef48
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/services/awssqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,17 @@ type SQSSendMessageAPI interface {
}

var GetQueueURL = func(c context.Context, api SQSSendMessageAPI, input *sqs.GetQueueUrlInput) (*sqs.GetQueueUrlOutput, error) {
log.Infof("[GetQueueUrl] queue_name: %s, account_id: %s", *input.QueueName, *input.QueueOwnerAWSAccountId)
// QueueName is required, QueueOwnerAWSAccountId is optional
accountIdStr := ""
if input.QueueOwnerAWSAccountId != nil {
accountIdStr = ", account_id: " + *input.QueueOwnerAWSAccountId
}
log.Infof("[GetQueueUrl] queue_name: %s%s", *input.QueueName, accountIdStr)

Check failure on line 200 in pkg/services/awssqs.go

View workflow job for this annotation

GitHub Actions / Lint Go code

File is not `goimports`-ed with -local github.com/argoproj/notifications-engine (goimports)
return api.GetQueueUrl(c, input)
}

var SendMsg = func(c context.Context, api SQSSendMessageAPI, input *sqs.SendMessageInput) (*sqs.SendMessageOutput, error) {
// QueueUrl & MessageBody are required fields.
log.Infof("[SendMsg] queue_url: %s, message_body: %s", *input.QueueUrl, *input.MessageBody)
return api.SendMessage(c, input)
}

0 comments on commit 912ef48

Please sign in to comment.