Skip to content

Commit 8be657e

Browse files
Updated awsutils.go with tmp code
1 parent 1bafd6c commit 8be657e

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

.github/workflows/unittest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ jobs:
2929
run: env GOOS=linux go build -o "sumologic-extension" "lambda-extensions/sumologic-extension.go"
3030

3131
- name: Run Unit Tests
32+
env:
33+
AWS_REGION: us-east-1
3234
run: go test ./...

lambda-extensions/utils/awsutils.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/aws/aws-sdk-go-v2/config"
99
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
1010
"github.com/aws/aws-sdk-go-v2/service/s3"
11-
"github.com/aws/aws-sdk-go-v2/service/sts"
1211
)
1312

1413
var uploader *manager.Uploader
@@ -18,6 +17,7 @@ func init() {
1817
if !found {
1918
awsRegion = os.Getenv("AWS_REGION")
2019
}
20+
fmt.Println("awsRegion:-->", awsRegion)
2121

2222
// Load AWS default config with region
2323
cfg, err := config.LoadDefaultConfig(context.TODO(),
@@ -26,26 +26,13 @@ func init() {
2626
if err != nil {
2727
panic("unable to load AWS SDK config, " + err.Error())
2828
}
29+
fmt.Printf("CFG --> %+v\n", cfg)
2930

3031
// Create S3 client
3132
s3Client := s3.NewFromConfig(cfg)
3233

3334
// Create uploader
3435
uploader = manager.NewUploader(s3Client)
35-
36-
// Create STS client to get account ID
37-
stsClient := sts.NewFromConfig(cfg)
38-
// Get caller identity
39-
identity, err := stsClient.GetCallerIdentity(context.TODO(), &sts.GetCallerIdentityInput{})
40-
if err != nil {
41-
panic("unable to get AWS caller identity: " + err.Error())
42-
}
43-
44-
// Print complete identity
45-
fmt.Println("AWS Caller Identity:")
46-
fmt.Println("Account ID:", *identity.Account)
47-
fmt.Println("ARN :", *identity.Arn)
48-
fmt.Println("UserID :", *identity.UserId)
4936
}
5037

5138
// UploadToS3 sends data to S3

0 commit comments

Comments
 (0)