Skip to content

Commit

Permalink
fix(aws): update close if aws auth provider is nil (#3607)
Browse files Browse the repository at this point in the history
Signed-off-by: Samantha Coyle <[email protected]>
Co-authored-by: Yaron Schneider <[email protected]>
  • Loading branch information
sicoyle and yaron2 authored Nov 20, 2024
1 parent f3bd794 commit e2b27d3
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 10 deletions.
5 changes: 4 additions & 1 deletion bindings/aws/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,8 @@ func (d *DynamoDB) GetComponentMetadata() (metadataInfo metadata.MetadataMap) {
}

func (d *DynamoDB) Close() error {
return d.authProvider.Close()
if d.authProvider != nil {
return d.authProvider.Close()
}
return nil
}
5 changes: 4 additions & 1 deletion bindings/aws/kinesis/kinesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,10 @@ func (a *AWSKinesis) Close() error {
close(a.closeCh)
}
a.wg.Wait()
return a.authProvider.Close()
if a.authProvider != nil {
return a.authProvider.Close()
}
return nil
}

func (a *AWSKinesis) ensureConsumer(ctx context.Context, streamARN *string) (*string, error) {
Expand Down
5 changes: 4 additions & 1 deletion bindings/aws/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ func (s *AWSS3) Init(ctx context.Context, metadata bindings.Metadata) error {
}

func (s *AWSS3) Close() error {
return s.authProvider.Close()
if s.authProvider != nil {
return s.authProvider.Close()
}
return nil
}

func (s *AWSS3) Operations() []bindings.OperationKind {
Expand Down
5 changes: 4 additions & 1 deletion bindings/aws/ses/ses.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,8 @@ func (a *AWSSES) GetComponentMetadata() (metadataInfo contribMetadata.MetadataMa
}

func (a *AWSSES) Close() error {
return a.authProvider.Close()
if a.authProvider != nil {
return a.authProvider.Close()
}
return nil
}
5 changes: 4 additions & 1 deletion bindings/aws/sns/sns.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,8 @@ func (a *AWSSNS) GetComponentMetadata() (metadataInfo metadata.MetadataMap) {
}

func (a *AWSSNS) Close() error {
return a.authProvider.Close()
if a.authProvider != nil {
return a.authProvider.Close()
}
return nil
}
5 changes: 4 additions & 1 deletion bindings/aws/sqs/sqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ func (a *AWSSQS) Close() error {
close(a.closeCh)
}
a.wg.Wait()
return a.authProvider.Close()
if a.authProvider != nil {
return a.authProvider.Close()
}
return nil
}

func (a *AWSSQS) parseSQSMetadata(meta bindings.Metadata) (*sqsMetadata, error) {
Expand Down
5 changes: 4 additions & 1 deletion pubsub/aws/snssqs/snssqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,10 @@ func (s *snsSqs) Close() error {
s.subscriptionManager.Close()
}

return s.authProvider.Close()
if s.authProvider != nil {
return s.authProvider.Close()
}
return nil
}

func (s *snsSqs) Features() []pubsub.Feature {
Expand Down
5 changes: 4 additions & 1 deletion secretstores/aws/parameterstore/parameterstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,8 @@ func (s *ssmSecretStore) GetComponentMetadata() (metadataInfo metadata.MetadataM
}

func (s *ssmSecretStore) Close() error {
return s.authProvider.Close()
if s.authProvider != nil {
return s.authProvider.Close()
}
return nil
}
5 changes: 4 additions & 1 deletion secretstores/aws/secretmanager/secretmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,8 @@ func (s *smSecretStore) GetComponentMetadata() (metadataInfo metadata.MetadataMa
}

func (s *smSecretStore) Close() error {
return s.authProvider.Close()
if s.authProvider != nil {
return s.authProvider.Close()
}
return nil
}
5 changes: 4 additions & 1 deletion state/aws/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ func (d *StateStore) GetComponentMetadata() (metadataInfo metadata.MetadataMap)
}

func (d *StateStore) Close() error {
return d.authProvider.Close()
if d.authProvider != nil {
return d.authProvider.Close()
}
return nil
}

func (d *StateStore) getDynamoDBMetadata(meta state.Metadata) (*dynamoDBMetadata, error) {
Expand Down

0 comments on commit e2b27d3

Please sign in to comment.