-
Notifications
You must be signed in to change notification settings - Fork 542
Feat/kinesis binding vmware go kcl v2 latest #4082
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
2eddb15
cabcec5
112fd8d
de8646f
90e071c
648a318
b686d94
9a70082
9dafc6d
8b93022
2ee207c
9b003aa
6ebe1a4
c064187
716b8a1
bf33f52
d8f5103
bd2639a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
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. I think these changes to the old auth package should be reverted, as they are not necessary as part of this PR unless a full cleanup takes place. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,9 @@ import ( | |
| "errors" | ||
| "sync" | ||
|
|
||
| "github.com/aws/aws-sdk-go/aws" | ||
| "github.com/aws/aws-sdk-go-v2/aws" | ||
| awsv2config "github.com/aws/aws-sdk-go-v2/config" | ||
| v2creds "github.com/aws/aws-sdk-go-v2/credentials" | ||
| "github.com/aws/aws-sdk-go/aws/credentials" | ||
| "github.com/aws/aws-sdk-go/aws/session" | ||
| "github.com/aws/aws-sdk-go/service/dynamodb" | ||
|
|
@@ -36,7 +38,7 @@ import ( | |
| "github.com/aws/aws-sdk-go/service/ssm" | ||
| "github.com/aws/aws-sdk-go/service/ssm/ssmiface" | ||
| "github.com/aws/aws-sdk-go/service/sts" | ||
| "github.com/vmware/vmware-go-kcl/clientlibrary/config" | ||
| "github.com/vmware/vmware-go-kcl-v2/clientlibrary/config" | ||
| ) | ||
|
|
||
| type Clients struct { | ||
|
|
@@ -181,27 +183,25 @@ func (c *KinesisClients) Stream(ctx context.Context, streamName string) (*string | |
| stream, err := c.Kinesis.DescribeStreamWithContext(ctx, &kinesis.DescribeStreamInput{ | ||
| StreamName: aws.String(streamName), | ||
| }) | ||
| if stream != nil { | ||
| return stream.StreamDescription.StreamARN, err | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return stream.StreamDescription.StreamARN, nil | ||
| } | ||
|
|
||
| return nil, errors.New("unable to get stream arn due to empty client") | ||
| } | ||
|
|
||
| func (c *KinesisClients) WorkerCfg(ctx context.Context, stream, consumer, mode string) *config.KinesisClientLibConfiguration { | ||
| func (c *KinesisClients) WorkerCfg(ctx context.Context, stream, region, mode, applicationName string) *config.KinesisClientLibConfiguration { | ||
| const sharedMode = "shared" | ||
| if c.Kinesis != nil { | ||
| if mode == sharedMode { | ||
| if c.Credentials != nil { | ||
| kclConfig := config.NewKinesisClientLibConfigWithCredential(consumer, | ||
| stream, c.Region, consumer, | ||
| c.Credentials) | ||
| return kclConfig | ||
| } | ||
| if c.Kinesis != nil && mode == sharedMode { | ||
| v1Creds, err := c.Credentials.Get() | ||
| if err != nil { | ||
| return nil | ||
| } | ||
| v2Creds := v2creds.NewStaticCredentialsProvider(v1Creds.AccessKeyID, v1Creds.SecretAccessKey, v1Creds.SessionToken) | ||
|
||
| return config.NewKinesisClientLibConfigWithCredential(applicationName, stream, region, "", v2Creds) | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
|
|
||
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.
Add kinesis client here and init with sdk v2
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.
Done