Skip to content

Commit cdd6d0d

Browse files
committed
Add roleARN parameter to ManagerFor in resource manager factory
This commits upadtes the ManagerFor function generator in the resource manager factory to include the roleARN. The change also includes: - Updated `ManagerFor` function signature - Modified the rmId generation to incorporate `roleARN`, creating a unique identifier for each account/region/roleARN combination. - Update fake resource manager to match the new function signature
1 parent 587b90d commit cdd6d0d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/generate/ack/runtime_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func (rmf *fakeRMF) ManagerFor(
9696
*session.Session,
9797
ackv1alpha1.AWSAccountID,
9898
ackv1alpha1.AWSRegion,
99+
ackv1alpha1.AWSResourceName,
99100
) (acktypes.AWSResourceManager, error) {
100101
return nil, nil
101102
}

templates/pkg/resource/manager_factory.go.tpl

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ func (f *resourceManagerFactory) ManagerFor(
4040
sess *session.Session,
4141
id ackv1alpha1.AWSAccountID,
4242
region ackv1alpha1.AWSRegion,
43+
roleARN ackv1alpha1.AWSResourceName,
4344
) (acktypes.AWSResourceManager, error) {
44-
rmId := fmt.Sprintf("%s/%s", id, region)
45+
// We use the account ID, region, and role ARN to uniquely identify a
46+
// resource manager. This helps us to avoid creating multiple resource
47+
// managers for the same account/region/roleARN combination.
48+
rmId := fmt.Sprintf("%s/%s/%s", id, region, roleARN)
4549
f.RLock()
4650
rm, found := f.rmCache[rmId]
4751
f.RUnlock()

0 commit comments

Comments
 (0)