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

chore(deps): bump the dependencies group across 1 directory with 6 updates #151

Merged
merged 6 commits into from
Jun 29, 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
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
cache: false
- uses: hashicorp/setup-terraform@v3
- uses: golangci/golangci-lint-action@v6
with:
skip-cache: true
- run: make
- run: terraform init && terraform apply -auto-approve
working-directory: _etc/terraform
Expand Down
14 changes: 1 addition & 13 deletions awsutil/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,12 @@ import (
"github.com/aws/aws-sdk-go-v2/config"
)

func LoadDefaultConfig(region string, endpointUrl string) (aws.Config, error) {
func LoadDefaultConfig(region string) (aws.Config, error) {
optFns := []func(*config.LoadOptions) error{}

if region != "" {
optFns = append(optFns, config.WithRegion(region))
}

if endpointUrl != "" {
customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (aws.Endpoint, error) {
return aws.Endpoint{
PartitionID: "aws",
URL: endpointUrl,
SigningRegion: region,
}, nil
})

optFns = append(optFns, config.WithEndpointResolverWithOptions(customResolver))
}

return config.LoadDefaultConfig(context.Background(), optFns...)
}
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/quetarohq/quetaro

go 1.19
go 1.22

require (
github.com/aws/aws-sdk-go-v2 v1.27.0
github.com/aws/aws-sdk-go-v2/config v1.27.15
github.com/aws/aws-sdk-go-v2/service/lambda v1.54.3
github.com/aws/aws-sdk-go-v2/service/sqs v1.32.2
github.com/jackc/pgx/v5 v5.5.5
github.com/aws/aws-sdk-go-v2 v1.30.0
github.com/aws/aws-sdk-go-v2/config v1.27.21
github.com/aws/aws-sdk-go-v2/service/lambda v1.55.1
github.com/aws/aws-sdk-go-v2/service/sqs v1.33.1
github.com/jackc/pgx/v5 v5.6.0
github.com/stretchr/testify v1.9.0
golang.org/x/sync v0.7.0
)
Expand Down Expand Up @@ -36,20 +36,20 @@ require (
require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/rs/zerolog v1.32.0
github.com/rs/zerolog v1.33.0
golang.org/x/sys v0.15.0 // indirect
)

require (
github.com/aws/aws-sdk-go-v2/credentials v1.17.15 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.21 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.12 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.12 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.8 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.14 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.21.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.25.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.29.1 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
Expand Down
56 changes: 28 additions & 28 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
github.com/aws/aws-sdk-go-v2 v1.27.0 h1:7bZWKoXhzI+mMR/HjdMx8ZCC5+6fY0lS5tr0bbgiLlo=
github.com/aws/aws-sdk-go-v2 v1.27.0/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
github.com/aws/aws-sdk-go-v2 v1.30.0 h1:6qAwtzlfcTtcL8NHtbDQAqgM5s6NDipQTkPxyH/6kAA=
github.com/aws/aws-sdk-go-v2 v1.30.0/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2/go.mod h1:lPprDr1e6cJdyYeGXnRaJoP4Md+cDBvi2eOj00BlGmg=
github.com/aws/aws-sdk-go-v2/config v1.27.15 h1:uNnGLZ+DutuNEkuPh6fwqK7LpEiPmzb7MIMA1mNWEUc=
github.com/aws/aws-sdk-go-v2/config v1.27.15/go.mod h1:7j7Kxx9/7kTmL7z4LlhwQe63MYEE5vkVV6nWg4ZAI8M=
github.com/aws/aws-sdk-go-v2/credentials v1.17.15 h1:YDexlvDRCA8ems2T5IP1xkMtOZ1uLJOCJdTr0igs5zo=
github.com/aws/aws-sdk-go-v2/credentials v1.17.15/go.mod h1:vxHggqW6hFNaeNC0WyXS3VdyjcV0a4KMUY4dKJ96buU=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 h1:dQLK4TjtnlRGb0czOht2CevZ5l6RSyRWAnKeGd7VAFE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3/go.mod h1:TL79f2P6+8Q7dTsILpiVST+AL9lkF6PPGI167Ny0Cjw=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 h1:lf/8VTF2cM+N4SLzaYJERKEWAXq8MOMpZfU6wEPWsPk=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7/go.mod h1:4SjkU7QiqK2M9oozyMzfZ/23LmUY+h3oFqhdeP5OMiI=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 h1:4OYVp0705xu8yjdyoWix0r9wPIRXnIzzOoUpQVHIJ/g=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7/go.mod h1:vd7ESTEvI76T2Na050gODNmNU7+OyKrIKroYTu4ABiI=
github.com/aws/aws-sdk-go-v2/config v1.27.21 h1:yPX3pjGCe2hJsetlmGNB4Mngu7UPmvWPzzWCv1+boeM=
github.com/aws/aws-sdk-go-v2/config v1.27.21/go.mod h1:4XtlEU6DzNai8RMbjSF5MgGZtYvrhBP/aKZcRtZAVdM=
github.com/aws/aws-sdk-go-v2/credentials v1.17.21 h1:pjAqgzfgFhTv5grc7xPHtXCAaMapzmwA7aU+c/SZQGw=
github.com/aws/aws-sdk-go-v2/credentials v1.17.21/go.mod h1:nhK6PtBlfHTUDVmBLr1dg+WHCOCK+1Fu/WQyVHPsgNQ=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.8 h1:FR+oWPFb/8qMVYMWN98bUZAGqPvLHiyqg1wqQGfUAXY=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.8/go.mod h1:EgSKcHiuuakEIxJcKGzVNWh5srVAQ3jKaSrBGRYvM48=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.12 h1:SJ04WXGTwnHlWIODtC5kJzKbeuHt+OUNOgKg7nfnUGw=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.12/go.mod h1:FkpvXhA92gb3GE9LD6Og0pHHycTxW7xGpnEh5E7Opwo=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.12 h1:hb5KgeYfObi5MHkSSZMEudnIvX30iB+E21evI4r6BnQ=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.12/go.mod h1:CroKe/eWJdyfy9Vx4rljP5wTUjNJfb+fPz1uMYUhEGM=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 h1:Wx0rlZoEJR7JwlSZcHnEa7CNjrSIyVxMFWGAaXy4fJY=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9/go.mod h1:aVMHdE0aHO3v+f/iw01fmXV/5DbfQ3Bi9nN7nd9bE9Y=
github.com/aws/aws-sdk-go-v2/service/lambda v1.54.3 h1:EfBXCCBDd5uLKwOS+4Xht/6I/TdNYw3MDLAdjt5LnHI=
github.com/aws/aws-sdk-go-v2/service/lambda v1.54.3/go.mod h1:RDNknjCSYlR3S3TTi3UhHKBUXnh8q+7m5zmPaEu+0NA=
github.com/aws/aws-sdk-go-v2/service/sqs v1.32.2 h1:/4H48UD3iPHLDd5I/pSpEaT1a7wlnrVgjhaFV/uFPzE=
github.com/aws/aws-sdk-go-v2/service/sqs v1.32.2/go.mod h1:xPN9AEzpZ3Ny+HpzsyLBrdXoTFOz7tig6xuYOQ3A0bQ=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.8 h1:Kv1hwNG6jHC/sxMTe5saMjH6t6ZLkgfvVxyEjfWL1ks=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.8/go.mod h1:c1qtZUWtygI6ZdvKppzCSXsDOq5I4luJPZ0Ud3juFCA=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.2 h1:nWBZ1xHCF+A7vv9sDzJOq4NWIdzFYm0kH7Pr4OjHYsQ=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.2/go.mod h1:9lmoVDVLz/yUZwLaQ676TK02fhCu4+PgRSmMaKR1ozk=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.9 h1:Qp6Boy0cGDloOE3zI6XhNLNZgjNS8YmiFQFHe71SaW0=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.9/go.mod h1:0Aqn1MnEuitqfsCNyKsdKLhDUOr4txD/g19EfiUqgws=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.14 h1:zSDPny/pVnkqABXYRicYuPf9z2bTqfH13HT3v6UheIk=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.14/go.mod h1:3TTcI5JSzda1nw/pkVC9dhgLre0SNBFj2lYS4GctXKI=
github.com/aws/aws-sdk-go-v2/service/lambda v1.55.1 h1:Drh1jXr7mTcSXyjEgCIMijskUz/5FXgdjJcqXGQnjhs=
github.com/aws/aws-sdk-go-v2/service/lambda v1.55.1/go.mod h1:5drdANY67aOvUNJLjBEg2HXeCXkk0MDurqsJs73TXVQ=
github.com/aws/aws-sdk-go-v2/service/sqs v1.33.1 h1:m/7a5OgAZQDWJlSbZLWg4BAlbXbY6j+dDDjPY8rZ7kA=
github.com/aws/aws-sdk-go-v2/service/sqs v1.33.1/go.mod h1:4kCM5tMCkys9PFbuGHP+LjpxlsA5oMRUs3QvnWo11BM=
github.com/aws/aws-sdk-go-v2/service/sso v1.21.1 h1:sd0BsnAvLH8gsp2e3cbaIr+9D7T1xugueQ7V/zUAsS4=
github.com/aws/aws-sdk-go-v2/service/sso v1.21.1/go.mod h1:lcQG/MmxydijbeTOp04hIuJwXGWPZGI3bwdFDGRTv14=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.25.1 h1:1uEFNNskK/I1KoZ9Q8wJxMz5V9jyBlsiaNrM7vA3YUQ=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.25.1/go.mod h1:z0P8K+cBIsFXUr5rzo/psUeJ20XjPN0+Nn8067Nd+E4=
github.com/aws/aws-sdk-go-v2/service/sts v1.29.1 h1:myX5CxqXE0QMZNja6FA1/FSE3Vu1rVmeUmpJMMzeZg0=
github.com/aws/aws-sdk-go-v2/service/sts v1.29.1/go.mod h1:N2mQiucsO0VwK9CYuS4/c2n6Smeh1v47Rz3dWCPFLdE=
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
Expand All @@ -42,8 +42,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw=
github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY=
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
Expand All @@ -68,8 +68,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
Expand Down
9 changes: 7 additions & 2 deletions intake_invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/lambda"
"github.com/jackc/pgx/v5"
"github.com/pkg/errors"
Expand Down Expand Up @@ -36,15 +37,19 @@ type IntakeInvoke struct {
}

func NewIntakeInvoke(opts *IntakeInvokeOpts) (*IntakeInvoke, error) {
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion, opts.AWSEndpointUrl)
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion)

if err != nil {
return nil, errors.Wrap(err, "failed to load AWS config")
}

intakeInvoke := &IntakeInvoke{
IntakeInvokeOpts: opts,
lambda: lambda.NewFromConfig(cfg),
lambda: lambda.NewFromConfig(cfg, func(o *lambda.Options) {
if opts.AWSEndpointUrl != "" {
o.BaseEndpoint = aws.String(opts.AWSEndpointUrl)
}
}),
}

return intakeInvoke, nil
Expand Down
8 changes: 6 additions & 2 deletions intake_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ type IntakePull struct {
}

func NewIntakePull(opts *IntakePullOpts) (*IntakePull, error) {
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion, opts.AWSEndpointUrl)
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion)

if err != nil {
return nil, errors.Wrap(err, "failed to load AWS config")
}

// SQS client is created by each agent.
client := sqs.NewFromConfig(cfg)
client := sqs.NewFromConfig(cfg, func(o *sqs.Options) {
if opts.AWSEndpointUrl != "" {
o.BaseEndpoint = aws.String(opts.AWSEndpointUrl)
}
})

// get the queue URL outside the agent.
output, err := client.GetQueueUrl(context.Background(), &sqs.GetQueueUrlInput{
Expand Down
6 changes: 5 additions & 1 deletion intake_pull_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ type IntakePullAgent struct {
}

func newIntakePullAgent(intakePull *IntakePull) *IntakePullAgent {
sqsClient := sqs.NewFromConfig(intakePull.AwsCfg)
sqsClient := sqs.NewFromConfig(intakePull.AwsCfg, func(o *sqs.Options) {
if intakePull.AWSEndpointUrl != "" {
o.BaseEndpoint = aws.String(intakePull.AWSEndpointUrl)
}
})

agent := &IntakePullAgent{
IntakePull: intakePull,
Expand Down
18 changes: 6 additions & 12 deletions internal/testutil/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ func NewAwsConfig(t *testing.T) aws.Config {
t.Helper()
optFns := []func(*config.LoadOptions) error{}
optFns = append(optFns, config.WithRegion(AwsRegion))

customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
return aws.Endpoint{
PartitionID: "aws",
URL: AwsEndpointUrl,
SigningRegion: region,
}, nil
})

optFns = append(optFns, config.WithEndpointResolverWithOptions(customResolver))
awsCfg, err := config.LoadDefaultConfig(context.Background(), optFns...)

if err != nil {
Expand All @@ -61,7 +51,9 @@ func NewAwsConfig(t *testing.T) aws.Config {
func NewSQSClient(t *testing.T) *sqs.Client {
t.Helper()
awsCfg := NewAwsConfig(t)
return sqs.NewFromConfig(awsCfg)
return sqs.NewFromConfig(awsCfg, func(o *sqs.Options) {
o.BaseEndpoint = aws.String(AwsEndpointUrl)
})
}

func SendMessage(t *testing.T, client *sqs.Client, queueName string, funcName string, body string) {
Expand Down Expand Up @@ -123,5 +115,7 @@ func ReceiveMessages(t *testing.T, client *sqs.Client, queueName string) []types
func NewLambdClient(t *testing.T) *lambda.Client {
t.Helper()
awsCfg := NewAwsConfig(t)
return lambda.NewFromConfig(awsCfg)
return lambda.NewFromConfig(awsCfg, func(o *lambda.Options) {
o.BaseEndpoint = aws.String(AwsEndpointUrl)
})
}
8 changes: 6 additions & 2 deletions outlet_failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ type OutletFailure struct {
}

func NewOutletFailure(opts *OutletFailureOpts) (*OutletFailure, error) {
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion, opts.AWSEndpointUrl)
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion)

if err != nil {
return nil, errors.Wrap(err, "failed to load AWS config")
}

// SQS client is created by each agent.
client := sqs.NewFromConfig(cfg)
client := sqs.NewFromConfig(cfg, func(o *sqs.Options) {
if opts.AWSEndpointUrl != "" {
o.BaseEndpoint = aws.String(opts.AWSEndpointUrl)
}
})

// get the queue URL outside the agent.
output, err := client.GetQueueUrl(context.Background(), &sqs.GetQueueUrlInput{
Expand Down
6 changes: 5 additions & 1 deletion outlet_failure_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ type OutletFailureAgent struct {
}

func newOutletFailureAgent(outletFailure *OutletFailure) *OutletFailureAgent {
sqsClient := sqs.NewFromConfig(outletFailure.AwsCfg)
sqsClient := sqs.NewFromConfig(outletFailure.AwsCfg, func(o *sqs.Options) {
if outletFailure.AWSEndpointUrl != "" {
o.BaseEndpoint = aws.String(outletFailure.AWSEndpointUrl)
}
})

agent := &OutletFailureAgent{
OutletFailure: outletFailure,
Expand Down
8 changes: 6 additions & 2 deletions outlet_success.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ type OutletSuccess struct {
}

func NewOutletSuccess(opts *OutletSuccessOpts) (*OutletSuccess, error) {
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion, opts.AWSEndpointUrl)
cfg, err := awsutil.LoadDefaultConfig(opts.AWSRegion)

if err != nil {
return nil, errors.Wrap(err, "failed to load AWS config")
}

// SQS client is created by each agent.
client := sqs.NewFromConfig(cfg)
client := sqs.NewFromConfig(cfg, func(o *sqs.Options) {
if opts.AWSEndpointUrl != "" {
o.BaseEndpoint = &opts.AWSEndpointUrl
}
})

// get the queue URL outside the agent.
output, err := client.GetQueueUrl(context.Background(), &sqs.GetQueueUrlInput{
Expand Down
6 changes: 5 additions & 1 deletion outlet_success_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ type OutletSuccessAgent struct {
}

func newOutletSuccessAgent(outletSuccess *OutletSuccess) *OutletSuccessAgent {
sqsClient := sqs.NewFromConfig(outletSuccess.AwsCfg)
sqsClient := sqs.NewFromConfig(outletSuccess.AwsCfg, func(o *sqs.Options) {
if outletSuccess.AWSEndpointUrl != "" {
o.BaseEndpoint = aws.String(outletSuccess.AWSEndpointUrl)
}
})

agent := &OutletSuccessAgent{
OutletSuccess: outletSuccess,
Expand Down
Loading