Skip to content

Commit

Permalink
Release v1.8.1 Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdevenny committed Mar 14, 2022
2 parents 48a852b + 0a4257d commit 3a81b4f
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions cmd/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/secretsmanager"
"github.com/boxboat/dockcmd/cmd/common"
Expand All @@ -40,11 +38,6 @@ type SecretsClient struct {
secretCache *cache.Cache
}

// SessionProvider custom provider to allow for fallback to session configured credentials.
type SessionProvider struct {
Session *session.Session
}

type SecretsClientOpt interface {
configureSecretsClient(opts *secretsClientOpts) error
}
Expand Down Expand Up @@ -122,21 +115,7 @@ func NewSecretsClient(opts ...SecretsClientOpt) (*SecretsClient, error) {
}

var creds = sess.Config.Credentials
if o.useChainCredentials {
creds = credentials.NewChainCredentials(
[]credentials.Provider{
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{
Profile: o.profile,
},
&ec2rolecreds.EC2RoleProvider{
Client: ec2metadata.New(sess),
},
&SessionProvider{
Session: sess,
},
})
} else {
if !o.useChainCredentials {
if o.accessKeyID == "" || o.secretAccessKey == "" {
return nil, errors.New("no aws credentials provided")
}
Expand All @@ -150,16 +129,6 @@ func NewSecretsClient(opts ...SecretsClientOpt) (*SecretsClient, error) {
return client, nil
}

// Retrieve for SessionProvider.
func (m *SessionProvider) Retrieve() (credentials.Value, error) {
return m.Session.Config.Credentials.Get()
}

// IsExpired for SessionProvider.
func (m *SessionProvider) IsExpired() bool {
return m.Session.Config.Credentials.IsExpired()
}

func (c *SecretsClient) getSecret(secretName string) (string, string, error) {
adjustedSecretName := secretName
version := latestVersion
Expand Down

0 comments on commit 3a81b4f

Please sign in to comment.