Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ aws.sqs.queues resource #4030

Merged
merged 8 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions providers/aws/connection/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/autoscaling"
"github.com/aws/aws-sdk-go-v2/service/backup"
"github.com/aws/aws-sdk-go-v2/service/inspector2"
"github.com/aws/aws-sdk-go-v2/service/sqs"

"github.com/aws/aws-sdk-go-v2/service/cloudfront"
"github.com/aws/aws-sdk-go-v2/service/cloudtrail"
Expand Down Expand Up @@ -485,6 +486,30 @@ func (t *AwsConnection) Sns(region string) *sns.Client {
return client
}

func (t *AwsConnection) Sqs(region string) *sqs.Client {
// if no region value is sent in, use the configured region
if len(region) == 0 {
region = t.cfg.Region
}
cacheVal := "_sqs_" + region

// check for cached client and return it if it exists
c, ok := t.clientcache.Load(cacheVal)
if ok {
log.Debug().Msg("use cached sqs client")
return c.Data.(*sqs.Client)
}

// create the client
cfg := t.cfg.Copy()
cfg.Region = region
client := sqs.NewFromConfig(cfg)

// cache it
t.clientcache.Store(cacheVal, &CacheEntry{Data: client})
return client
}

func (t *AwsConnection) Ssm(region string) *ssm.Client {
// if no region value is sent in, use the configured region
if len(region) == 0 {
Expand Down
1 change: 1 addition & 0 deletions providers/aws/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.29.1
github.com/aws/aws-sdk-go-v2/service/securityhub v1.48.4
github.com/aws/aws-sdk-go-v2/service/sns v1.29.8
github.com/aws/aws-sdk-go-v2/service/sqs v1.32.3
github.com/aws/aws-sdk-go-v2/service/ssm v1.50.4
github.com/aws/aws-sdk-go-v2/service/sts v1.28.10
github.com/aws/aws-sdk-go-v2/service/wafv2 v1.49.1
Expand Down
2 changes: 2 additions & 0 deletions providers/aws/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ github.com/aws/aws-sdk-go-v2/service/securityhub v1.48.4 h1:J/5XSSUxCUIy6Ya/1qBe
github.com/aws/aws-sdk-go-v2/service/securityhub v1.48.4/go.mod h1:Ypax6FsjjJFd0fojZ85aErP+hwfVaXW4gsInyTbwL6Q=
github.com/aws/aws-sdk-go-v2/service/sns v1.29.8 h1:CQicXbvanE/nn+MJQVuDzBplQSFj7M+gLLtArzDVZS4=
github.com/aws/aws-sdk-go-v2/service/sns v1.29.8/go.mod h1:oP1vkszM8xdAqHMdBstE5TF3xc+yHwQYrAvkNharymc=
github.com/aws/aws-sdk-go-v2/service/sqs v1.32.3 h1:K0kIvRVzlVB/7onxMnRoqJkBqRdukIeaQ5GwGAmzggM=
github.com/aws/aws-sdk-go-v2/service/sqs v1.32.3/go.mod h1:xPN9AEzpZ3Ny+HpzsyLBrdXoTFOz7tig6xuYOQ3A0bQ=
github.com/aws/aws-sdk-go-v2/service/ssm v1.50.4 h1:SgDxM/2kJEeSavji5ob+oluTPo3CQOQmP56F3yUz/kE=
github.com/aws/aws-sdk-go-v2/service/ssm v1.50.4/go.mod h1:uRCbiDLweN10yl6W80fLygiLUDTIonz8/RpH+6lsEnY=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.9 h1:aD7AGQhvPuAxlSUfo0CWU7s6FpkbyykMhGYMvlqTjVs=
Expand Down
40 changes: 40 additions & 0 deletions providers/aws/resources/aws.lr
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,46 @@ private aws.dynamodb.table @defaults("name region") {
status string
}

// Amazon Simple Queue Service (SQS)
aws.sqs {
// List of Amazon SQS queues
queues() []aws.sqs.queue
}

// Amazon Simple Queue Service (SQS) Queue
private aws.sqs.queue {
// ARN for the queue
arn() string
// Time when the queue was created
createdAt() time
// Dead letter SQS queue, if any
deadLetterQueue() aws.sqs.queue
// Delay seconds set on the queue
deliveryDelaySeconds() int
// KMS Key for SSE, if any
kmsKey() aws.kms.key
// Time when the queue was last modified
lastModified() time
// Maximum amount of messages that can be received by the queue
maxReceiveCount() int
// Maximum message size for the queue
maximumMessageSize() int
// Time in seconds the queue retains messages
messageRetentionPeriodSeconds() int
// Time in seconds the queue waits for messages
receiveMessageWaitTimeSeconds() int
// Region for the queue
region string
// Whether SSE is enabled for the queue
sqsManagedSseEnabled() bool
// The type of queue: Fifo or Standard
queueType() string
// URL for the queue
url string
// Visibility timeout for the queue
visibilityTimeoutSeconds() int
}

// Amazon Relational Database Service (RDS)
aws.rds {
// List of database instances
Expand Down
Loading
Loading