@@ -28,11 +28,12 @@ import (
28
28
"github.com/aws/aws-sdk-go-v2/aws"
29
29
"github.com/aws/aws-sdk-go-v2/service/eks"
30
30
ekstypes "github.com/aws/aws-sdk-go-v2/service/eks/types"
31
- "github.com/aws/aws-sdk-go/aws/awserr"
31
+ "github.com/aws/aws-sdk-go-v2/service/iam"
32
+ iamtypes "github.com/aws/aws-sdk-go-v2/service/iam/types"
32
33
stsrequest "github.com/aws/aws-sdk-go/aws/request"
33
34
"github.com/aws/aws-sdk-go/service/ec2"
34
- "github.com/aws/aws-sdk-go/service/iam"
35
35
"github.com/aws/aws-sdk-go/service/sts"
36
+ "github.com/aws/smithy-go"
36
37
"github.com/golang/mock/gomock"
37
38
. "github.com/onsi/gomega"
38
39
corev1 "k8s.io/api/core/v1"
@@ -797,37 +798,37 @@ func mockedDescribeInstanceCall(ec2Rec *mocks.MockEC2APIMockRecorder) {
797
798
}
798
799
799
800
func mockedEKSControlPlaneIAMRole (g * WithT , iamRec * mock_iamauth.MockIAMAPIMockRecorder ) {
800
- getRoleCall := iamRec .GetRole (& iam.GetRoleInput {
801
+ getRoleCall := iamRec .GetRole (gomock . Any (), & iam.GetRoleInput {
801
802
RoleName : aws .String ("test-cluster-iam-service-role" ),
802
- }).Return (nil , awserr . New ( iam . ErrCodeNoSuchEntityException , " " , nil ) )
803
+ }).Return (nil , & smithy. GenericAPIError { Code : "NoSuchEntity " , Message : "" } )
803
804
804
- createRoleCall := iamRec .CreateRole (gomock .Any ()) .After (getRoleCall ).DoAndReturn (func (input * iam.CreateRoleInput ) (* iam.CreateRoleOutput , error ) {
805
+ createRoleCall := iamRec .CreateRole (gomock .Any (), gomock . Any ()) .After (getRoleCall ).DoAndReturn (func (ctx context. Context , input * iam.CreateRoleInput , optFns ... func ( * iam. Options ) ) (* iam.CreateRoleOutput , error ) {
805
806
g .Expect (input .RoleName ).To (BeComparableTo (aws .String ("test-cluster-iam-service-role" )))
806
807
return & iam.CreateRoleOutput {
807
- Role : & iam .Role {
808
+ Role : & iamtypes .Role {
808
809
RoleName : aws .String ("test-cluster-iam-service-role" ),
809
810
Arn : aws .String ("arn:aws:iam::123456789012:role/test-cluster-iam-service-role" ),
810
811
Tags : input .Tags ,
811
812
},
812
813
}, nil
813
814
})
814
815
815
- iamRec .ListAttachedRolePolicies (& iam.ListAttachedRolePoliciesInput {
816
+ iamRec .ListAttachedRolePolicies (gomock . Any (), & iam.ListAttachedRolePoliciesInput {
816
817
RoleName : aws .String ("test-cluster-iam-service-role" ),
817
818
}).After (createRoleCall ).Return (& iam.ListAttachedRolePoliciesOutput {
818
- AttachedPolicies : []* iam .AttachedPolicy {},
819
+ AttachedPolicies : []iamtypes .AttachedPolicy {},
819
820
}, nil )
820
821
821
- getPolicyCall := iamRec .GetPolicy (& iam.GetPolicyInput {
822
+ getPolicyCall := iamRec .GetPolicy (gomock . Any (), & iam.GetPolicyInput {
822
823
PolicyArn : aws .String ("arn:aws:iam::aws:policy/AmazonEKSClusterPolicy" ),
823
824
}).Return (& iam.GetPolicyOutput {
824
825
// This policy is predefined by AWS
825
- Policy : & iam .Policy {
826
+ Policy : & iamtypes .Policy {
826
827
// Fields are not used. Our code only checks for existence of the policy.
827
828
},
828
829
}, nil )
829
830
830
- iamRec .AttachRolePolicy (& iam.AttachRolePolicyInput {
831
+ iamRec .AttachRolePolicy (gomock . Any (), & iam.AttachRolePolicyInput {
831
832
PolicyArn : aws .String ("arn:aws:iam::aws:policy/AmazonEKSClusterPolicy" ),
832
833
RoleName : aws .String ("test-cluster-iam-service-role" ),
833
834
}).After (getPolicyCall ).Return (& iam.AttachRolePolicyOutput {}, nil )
@@ -840,10 +841,10 @@ func mockedEKSCluster(ctx context.Context, g *WithT, eksRec *mock_eksiface.MockE
840
841
Message : aws .String ("cluster not found" ),
841
842
})
842
843
843
- getRoleCall := iamRec .GetRole (& iam.GetRoleInput {
844
+ getRoleCall := iamRec .GetRole (gomock . Any (), & iam.GetRoleInput {
844
845
RoleName : aws .String ("test-cluster-iam-service-role" ),
845
846
}).After (describeClusterCall ).Return (& iam.GetRoleOutput {
846
- Role : & iam .Role {
847
+ Role : & iamtypes .Role {
847
848
RoleName : aws .String ("test-cluster-iam-service-role" ),
848
849
Arn : aws .String ("arn:aws:iam::123456789012:role/test-cluster-iam-service-role" ),
849
850
},
0 commit comments