-
Notifications
You must be signed in to change notification settings - Fork 17
BCDA-9484: Migrate aws sdk to v2 #1235
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1345cee
BCDA-9484: Stubbing out aws-sdk v2 migration
carlpartridge 83a1229
Mid work checkin
carlpartridge fef5cf4
Mid work checkin
carlpartridge 0253fe3
Params tests working
carlpartridge 15a4fed
Up aws versions, aco creds tests passing
carlpartridge c60c784
Tests passing
carlpartridge 32a4145
Cleanup
carlpartridge b795439
Merge branch 'main' into carl-9484-migrate-aws-to-v2
carlpartridge 194520a
Cleanup
carlpartridge 5411a8f
Fix tests
carlpartridge 928ce6e
Make sure db url is available for functions
carlpartridge 348b03f
Add s3 assume role for lambdas
carlpartridge 4f17c08
Add various missing test coverage
carlpartridge 4c5f5ad
Fix aco creds tests, PR review changes
carlpartridge 55525ab
Merge branch 'main' into carl-9484-migrate-aws-to-v2
carlpartridge 31da1d4
Add back in still used cli script
carlpartridge f45bbf0
Add back in still used cli script
carlpartridge d8e5d19
Remove commented out code
carlpartridge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package bcdaaws | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aws/aws-sdk-go-v2/aws" | ||
| "github.com/aws/aws-sdk-go-v2/config" | ||
| "github.com/aws/aws-sdk-go-v2/service/cloudwatch" | ||
| "github.com/aws/aws-sdk-go-v2/service/cloudwatch/types" | ||
| ) | ||
|
|
||
| type Sampler struct { | ||
| Ctx context.Context | ||
| Namespace string | ||
| Unit string | ||
| Service *cloudwatch.Client | ||
| } | ||
|
|
||
| func PutMetricSample( | ||
| ctx context.Context, | ||
| namespace string, | ||
| name string, | ||
| unit types.StandardUnit, | ||
| value float64, | ||
| dimensions []types.Dimension, | ||
| ) error { | ||
| data := types.MetricDatum{ | ||
| Dimensions: dimensions, | ||
| MetricName: &name, | ||
| Unit: unit, | ||
| Value: &value, | ||
| } | ||
|
|
||
| input := &cloudwatch.PutMetricDataInput{ | ||
| MetricData: []types.MetricDatum{data}, | ||
| Namespace: aws.String(namespace), | ||
| } | ||
|
|
||
| cfg, err := config.LoadDefaultConfig(ctx) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| client := cloudwatch.NewFromConfig(cfg) | ||
|
|
||
| _, err = client.PutMetricData(ctx, input) | ||
|
|
||
| return err | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package bcdaaws | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/aws/aws-sdk-go-v2/aws" | ||
| "github.com/aws/aws-sdk-go-v2/service/cloudwatch/types" | ||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestPutMetricSample(t *testing.T) { | ||
| err := PutMetricSample( | ||
| t.Context(), | ||
| "Namespace", | ||
| "Name", | ||
| "Count", | ||
| float64(32), | ||
| []types.Dimension{{Name: aws.String("name"), Value: aws.String("value")}}, | ||
| ) | ||
| assert.Nil(t, err) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AWS session is no longer a thing in v2. Instead each service creates a client for itself using AWS config. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this from its own package to under our aws helpers package.