@@ -19,8 +19,8 @@ package scope
19
19
import (
20
20
"context"
21
21
22
- awsclient "github.com/aws/aws-sdk-go/aws/client "
23
- "github.com/aws/aws-sdk-go/service/iam"
22
+ awsv2 "github.com/aws/aws-sdk-go-v2 /aws"
23
+ iamv2 "github.com/aws/aws-sdk-go-v2 /service/iam"
24
24
"github.com/pkg/errors"
25
25
corev1 "k8s.io/api/core/v1"
26
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -52,8 +52,8 @@ type RosaRoleConfigScope struct {
52
52
patchHelper * patch.Helper
53
53
RosaRoleConfig * expinfrav1.ROSARoleConfig
54
54
serviceLimiters throttle.ServiceLimiters
55
- session awsclient. ConfigProvider
56
- iamClient * iam. IAM
55
+ session awsv2. Config
56
+ iamClient * iamv2. Client
57
57
}
58
58
59
59
// NewRosaRoleConfigScope creates a new RosaRoleConfigScope from the supplied parameters.
@@ -71,21 +71,21 @@ func NewRosaRoleConfigScope(params RosaRoleConfigScopeParams) (*RosaRoleConfigSc
71
71
RosaRoleConfig : params .RosaRoleConfig ,
72
72
}
73
73
74
- session , serviceLimiters , err := sessionForClusterWithRegion (params .Client , RosaRoleConfigScope , "" , params .Endpoints , params .Logger )
74
+ sessionv2 , serviceLimitersv2 , err := sessionForClusterWithRegionV2 (params .Client , RosaRoleConfigScope , "" , params .Endpoints , params .Logger )
75
75
if err != nil {
76
- return nil , errors .Errorf ("failed to create aws session: %v" , err )
76
+ return nil , errors .Errorf ("failed to create aws V2 session: %v" , err )
77
77
}
78
78
79
- iamClient := iam . New ( session )
79
+ iamClient := iamv2 . NewFromConfig ( * sessionv2 )
80
80
81
81
patchHelper , err := patch .NewHelper (params .RosaRoleConfig , params .Client )
82
82
if err != nil {
83
83
return nil , errors .Wrap (err , "failed to init patch helper" )
84
84
}
85
85
86
86
RosaRoleConfigScope .patchHelper = patchHelper
87
- RosaRoleConfigScope .session = session
88
- RosaRoleConfigScope .serviceLimiters = serviceLimiters
87
+ RosaRoleConfigScope .session = * sessionv2
88
+ RosaRoleConfigScope .serviceLimiters = serviceLimitersv2
89
89
RosaRoleConfigScope .iamClient = iamClient
90
90
91
91
return RosaRoleConfigScope , nil
@@ -96,8 +96,8 @@ func (s *RosaRoleConfigScope) IdentityRef() *infrav1.AWSIdentityReference {
96
96
return s .RosaRoleConfig .Spec .IdentityRef
97
97
}
98
98
99
- // Session returns the AWS SDK session (used for creating clients) .
100
- func (s * RosaRoleConfigScope ) Session () awsclient. ConfigProvider {
99
+ // Session returns the AWS SDK V2 session. Used for creating clients.
100
+ func (s * RosaRoleConfigScope ) Session () awsv2. Config {
101
101
return s .session
102
102
}
103
103
@@ -165,6 +165,6 @@ func (s *RosaRoleConfigScope) CredentialsSecret() *corev1.Secret {
165
165
}
166
166
167
167
// IAMClient returns the IAM client.
168
- func (s * RosaRoleConfigScope ) IAMClient () * iam. IAM {
168
+ func (s * RosaRoleConfigScope ) IAMClient () * iamv2. Client {
169
169
return s .iamClient
170
170
}
0 commit comments