Skip to content

Commit

Permalink
Merge pull request #88 from richardcase/interfaces
Browse files Browse the repository at this point in the history
Use AWS Service interfaces
  • Loading branch information
errordeveloper authored Jul 3, 2018
2 parents a71ba69 + 03bbeb9 commit c5eedbb
Show file tree
Hide file tree
Showing 7 changed files with 1,736 additions and 8 deletions.
8 changes: 6 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions pkg/eks/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/aws/aws-sdk-go/service/cloudformation/cloudformationiface"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/aws/aws-sdk-go/service/eks"
"github.com/aws/aws-sdk-go/service/eks/eksiface"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/aws/aws-sdk-go/service/sts/stsiface"

"github.com/kubicorn/kubicorn/pkg/logger"
)
Expand All @@ -31,10 +35,10 @@ type ClusterProvider struct {
}

type providerServices struct {
cfn *cloudformation.CloudFormation
eks *eks.EKS
ec2 *ec2.EC2
sts *sts.STS
cfn cloudformationiface.CloudFormationAPI
eks eksiface.EKSAPI
ec2 ec2iface.EC2API
sts stsiface.STSAPI
arn string
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/eks/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/aws/aws-sdk-go/service/sts/stsiface"

"github.com/heptio/authenticator/pkg/token"
"github.com/kubicorn/kubicorn/pkg/logger"
Expand Down Expand Up @@ -79,7 +80,7 @@ type ClientConfig struct {
Client *clientcmdapi.Config
Cluster *ClusterConfig
roleARN string
sts *sts.STS
sts stsiface.STSAPI
}

// based on "k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig"
Expand Down Expand Up @@ -144,7 +145,7 @@ func (c *ClientConfig) WithEmbeddedToken() (*ClientConfig, error) {
return nil, errors.Wrap(err, "could not get token generator")
}

tok, err := gen.GetWithSTS(c.Cluster.ClusterName, c.sts)
tok, err := gen.GetWithSTS(c.Cluster.ClusterName, c.sts.(*sts.STS))
if err != nil {
return nil, errors.Wrap(err, "could not get token")
}
Expand Down

Large diffs are not rendered by default.

1,286 changes: 1,286 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/service/eks/eksiface/interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c5eedbb

Please sign in to comment.