- Newest
- Most votes
- Most comments
I understand you're having trouble using the GetGroupId operation with the AWS SDK for Go v2. Let's clarify how to use the UniqueAttribute correctly for this operation.
You're on the right track. The AlternateIdentifier is used to specify a unique attribute of the group when you don't have the primary identifier (GroupId). The UniqueAttribute consists of two parts:
-
AttributePath: This should be a string that represents the path to the attribute you want to use for identification. For a group's display name, you would typically use "displayName".
-
AttributeValue: This should be the actual value of the attribute you're using to identify the group.
Your code snippet is close, but there are a few adjustments needed:
-
The AttributePath should be a string, not a variable. So instead of &displayname, you should use "displayName".
-
The AttributeValue should be the actual value of the display name, not a document object.
Here's how you might adjust your code:
input := &identitystore.GetGroupIdInput{ AlternateIdentifier: &types.AlternateIdentifierMemberUniqueAttribute{ Value: types.UniqueAttribute{ AttributePath: aws.String("displayName"), AttributeValue: aws.String(descgroup.DisplayName), }, }, IdentityStoreId: aws.String(idsId), } result, err := idsClient.GetGroupId(ctx, input)
Make sure that descgroup.DisplayName contains the actual display name of the group you're trying to retrieve.
If you're still encountering issues, double-check that the IdentityStoreId is correct and that the group with the specified display name exists in your Identity Center. Also, ensure that you have the necessary permissions to perform this operation.
If you receive a "GROUP not found" error, it could mean that no group with the specified display name exists in your Identity Store. In such cases, you may need to verify the group's existence or try using a different unique attribute to identify the group.
Remember, the GetGroupId operation is used to retrieve the GroupId when you only have other identifying information about the group. Once you have the GroupId, you can use it for other operations that require the primary identifier.
Sources
GetGroupId - Identity Store
Troubleshoot IAM Identity Center SCIM provisioning | AWS re:Post
UniqueAttribute - Identity Store
answered 2 years ago
.\main.go:67:227: cannot use aws.String(descgroup.DisplayName) (value of type *string) as "github.com/aws/aws-sdk-go-v2/service/identitystore/internal/document".Interface value in struct literal: *string does not implement "github.com/aws/aws-sdk-go-v2/service/identitystore/internal/document".Interface (missing method MarshalSmithyDocument)
AttributeValue in UniqueAttribute accepts only document and not string
answered 2 years ago
Relevant content
asked 6 years ago
asked 4 years ago
asked 4 years ago
- AWS OFFICIALUpdated 2 years ago
