Skip to content

Commit

Permalink
Merge pull request #1589 from abacus3/fix/cognito-groupusermembership
Browse files Browse the repository at this point in the history
fix(cognitoidentity): Update broken AWS API function call for GroupUserMembership
  • Loading branch information
haarchri authored Nov 25, 2022
2 parents 02b4ddc + 9ab083f commit 38a0d38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (e *external) Observe(ctx context.Context, mgd resource.Managed) (managed.E
return managed.ExternalObservation{}, errors.Wrap(err, errUnmarshal)
}

attachedGroupObject, err := FindAttachedGroupObject(ctx, e, externalAnnotation.Username, externalAnnotation.UserPoolID, externalAnnotation.Groupname)
attachedGroupObject, err := FindAttachedGroupObject(ctx, e, externalAnnotation.UserPoolID, externalAnnotation.Username, externalAnnotation.Groupname)
if err != nil {
return managed.ExternalObservation{}, errors.Wrap(err, errGet)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package groupusermembership
import (
"context"
"encoding/json"
"strings"
"testing"

"github.com/crossplane-contrib/provider-aws/apis/cognitoidentityprovider/manualv1alpha1"
Expand Down Expand Up @@ -111,14 +112,17 @@ func TestObserve(t *testing.T) {
args: args{
cognitoidentityprovider: &fake.MockGroupUserMembershipClient{
MockAdminListGroupsForUser: func(ctx context.Context, input *awscognitoidentityprovider.AdminListGroupsForUserInput, opts []func(*awscognitoidentityprovider.Options)) (*awscognitoidentityprovider.AdminListGroupsForUserOutput, error) {
return &awscognitoidentityprovider.AdminListGroupsForUserOutput{
Groups: []awscognitoidentityprovidertypes.GroupType{
{
GroupName: &groupName,
UserPoolId: &userPoolID,
if strings.Compare(*input.UserPoolId, userPoolID) == 0 && strings.Compare(*input.Username, Username) == 0 {
return &awscognitoidentityprovider.AdminListGroupsForUserOutput{
Groups: []awscognitoidentityprovidertypes.GroupType{
{
GroupName: &groupName,
UserPoolId: &userPoolID,
},
},
},
}, nil
}, nil
}
return nil, &awscognitoidentityprovidertypes.ResourceNotFoundException{}
},
},
cr: userGroup(withExternalName(groupName, Username, userPoolID)),
Expand Down

0 comments on commit 38a0d38

Please sign in to comment.