AWS - IAM Identity Center
Amazon Web Services IAM Identity Center.
IT Services · AWS - IAM Identity Center
Details
| ID | AWS - IAM Identity Center |
|---|---|
| Provider | Amazon |
| Category | IT Services |
| From Version | 5.0.0 |
| Docker Image | demisto/boto3py3:1.0.0.10221838 |
| Supported Modules | Agentix XSIAM |
README
Amazon Web Services Identity and Access Management Identity Center(IAM)
For detailed instructions about setting up authentication, see: AWS Integrations - Authentication.
Configure AWS - IAM Identity Center in Cortex
| Parameter | Description | Required |
|---|---|---|
| Role Arn | False | |
| Role Session Name | A descriptive name for the assumed role session. | False |
| AWS Default Region | True | |
| Role Session Duration | False | |
| Identity Store ID | The Identity Store ID parameter is required for API requests. It can be provided as a parameter or as an argument. If the Identity Store ID was not specified - Test failure. | False |
| Access Key | False | |
| Secret Key | False | |
| Access Key | False | |
| Secret Key | False | |
| Timeout | The time in seconds until a timeout exception is reached. You can specify just the read timeout (for example 60) or also the connect timeout followed after a comma (for example 60,10). If a connect timeout is not specified, a default of 10 seconds will be used. | False |
| Retries | The maximum number of retry attempts when connection or throttling errors are encountered. Set to 0 to disable retries. The default value is 5 and the limit is 10. Note: Increasing the number of retries will increase the execution time. | False |
| Trust any certificate (not secure) | False |
Commands
You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
aws-iam-identitycenter-create-user
Creates a new IAM Identity Center user for your AWS account.
Base Command
aws-iam-identitycenter-create-user
Input
| Argument Name | Description | Required |
|---|---|---|
| userName | The username of the user to create. | Required |
| familyName | The family name of the user to create. | Required |
| givenName | The first name of the user to create. | Required |
| userEmailAddress | The email address of the user to create. | Optional |
| displayName | The display name of the user to create. | Required |
| profileUrl | The profile URL of the user to create. | Optional |
| userEmailAddressPrimary | Is this the primary email address for the associated resource?. Possible values are: yes, no. | Optional |
| userType | The type of the user to create. | Optional |
| title | The title of the user to create. | Optional |
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.User.UserId | string | The user ID. |
| AWS.IAMIdentityCenter.User.IdentityStoreId | string | Identity Store ID. |
Command example
!aws-iam-identitycenter-create-user displayName="John Doe" familyName=Doe givenName=John userName=johndoe userEmailAddress=johnDoe@gmail.com
Context Example
{
"AWS": {
"IAMIdentityCenter": {
"User": {
"IdentityStoreId": "d-9967750fbd",
"UserId": "634418e2-20c1-703e-4358-a8312472c85d"
}
}
}
}
Human Readable Output
User johndoe has been successfully created with user id 634418e2-20c1-703e-4358-a8312472c85d
IdentityStoreId UserId d-9967750fbd 634418e2-20c1-703e-4358-a8312472c85d
aws-iam-identitycenter-get-user
Retrieves information about the specified IAM user.
Base Command
aws-iam-identitycenter-get-user
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| userName | The name of the user to get information about. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.User.UserName | string | The friendly name identifying the user. |
| AWS.IAMIdentityCenter.User.UserId | string | The stable and unique string identifying the user. |
| AWS.IAMIdentityCenter.User.ExternalIds.Issuer | String | The issuer for an external identifier. |
| AWS.IAMIdentityCenter.User.ExternalIds.Id | String | The identifier issued to this resource by an external identity provider. |
| AWS.IAMIdentityCenter.User.Name.Formatted | String | Formatted version of the user’s name for display. |
| AWS.IAMIdentityCenter.User.Name.FamilyName | String | The family name of the user. |
| AWS.IAMIdentityCenter.User.Name.GivenName | String | The given name of the user. |
| AWS.IAMIdentityCenter.User.Name.MiddleName | String | The middle name of the user. |
| AWS.IAMIdentityCenter.User.Name.HonorificPrefix | String | The honorific prefix of the user. |
| AWS.IAMIdentityCenter.User.Name.HonorificSuffix | String | The honorific suffix of the user. |
| AWS.IAMIdentityCenter.User.DisplayName | String | The name of the user formatted for display when referenced. |
| AWS.IAMIdentityCenter.User.NickName | String | An alternate name for the user. |
| AWS.IAMIdentityCenter.User.ProfileUrl | String | URL associated with the user. |
| AWS.IAMIdentityCenter.User.Emails.Value | String | Email address associated with the user. |
| AWS.IAMIdentityCenter.User.Emails.Type | String | Type of email address. |
| AWS.IAMIdentityCenter.User.Emails.Primary | String | Indicates whether this is the primary email address. |
| AWS.IAMIdentityCenter.User.Addresses.StreetAddress | String | Street address. |
| AWS.IAMIdentityCenter.User.Addresses.Locality | String | Address locality. |
| AWS.IAMIdentityCenter.User.Addresses.Region | String | Region of the address. |
| AWS.IAMIdentityCenter.User.Addresses.PostalCode | String | Postal code of the address. |
| AWS.IAMIdentityCenter.User.Addresses.Country | String | Country of the address. |
| AWS.IAMIdentityCenter.User.Addresses.Formatted | String | Formatted version of the address for display. |
| AWS.IAMIdentityCenter.User.Addresses.Type | String | Type of address. |
| AWS.IAMIdentityCenter.User.Addresses.Primary | String | Indicates whether this is the primary address. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Value | String | Phone number associated with the user. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Type | String | Type of phone number. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Primary | String | Indicates whether this is the primary phone number. |
| AWS.IAMIdentityCenter.User.UserType | String | Type of user. |
| AWS.IAMIdentityCenter.User.Title | String | Title of the user. |
| AWS.IAMIdentityCenter.User.PreferredLanguage | String | Preferred language of the user. |
| AWS.IAMIdentityCenter.User.Locale | String | Geographical region or location of the user. |
| AWS.IAMIdentityCenter.User.Timezone | String | Time zone of the user. |
| AWS.IAMIdentityCenter.User.IdentityStoreId | String | Globally unique identifier for the identity store. |
Command example
!aws-iam-identitycenter-get-user userName=johndoe
Context Example
{
"AWS": {
"IAMIdentityCenter": {
"User": {
"DisplayName": "John Doe",
"Emails": [
{
"Value": "johnDoe@gmail.com"
}
],
"IdentityStoreId": "d-9967750fbd",
"Name": {
"FamilyName": "Doe",
"GivenName": "John"
},
"UserId": "634418e2-20c1-703e-4358-a8312472c85d",
"UserName": "johndoe"
}
}
}
}
Human Readable Output
AWS IAM Identity Center Users
DisplayName Emails UserId UserName John Doe johnDoe@gmail.com 634418e2-20c1-703e-4358-a8312472c85d johndoe
aws-iam-identitycenter-list-users
Lists the IAM users, returns all users in the AWS account.
Base Command
aws-iam-identitycenter-list-users
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| limit | Number of results to return. Default is 50. | Optional |
| nextToken | The pagination token. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.User.UserName | string | The friendly name identifying the user. |
| AWS.IAMIdentityCenter.User.UserId | string | The stable and unique string identifying the user. |
| AWS.IAMIdentityCenter.User.ExternalIds.Issuer | String | The issuer for an external identifier. |
| AWS.IAMIdentityCenter.User.ExternalIds.Id | String | The identifier issued to this resource by an external identity provider. |
| AWS.IAMIdentityCenter.User.Name.Formatted | String | Formatted version of the user’s name for display. |
| AWS.IAMIdentityCenter.User.Name.FamilyName | String | The family name of the user. |
| AWS.IAMIdentityCenter.User.Name.GivenName | String | The given name of the user. |
| AWS.IAMIdentityCenter.User.Name.MiddleName | String | The middle name of the user. |
| AWS.IAMIdentityCenter.User.Name.HonorificPrefix | String | The honorific prefix of the user. |
| AWS.IAMIdentityCenter.User.Name.HonorificSuffix | String | The honorific suffix of the user. |
| AWS.IAMIdentityCenter.User.DisplayName | String | The name of the user formatted for display when referenced. |
| AWS.IAMIdentityCenter.User.NickName | String | An alternate name for the user. |
| AWS.IAMIdentityCenter.User.ProfileUrl | String | URL associated with the user. |
| AWS.IAMIdentityCenter.User.Emails.Value | String | Email address associated with the user. |
| AWS.IAMIdentityCenter.User.Emails.Type | String | Type of email address. |
| AWS.IAMIdentityCenter.User.Emails.Primary | String | Indicates whether this is the primary email address. |
| AWS.IAMIdentityCenter.User.Addresses.StreetAddress | String | Street address. |
| AWS.IAMIdentityCenter.User.Addresses.Locality | String | Address locality. |
| AWS.IAMIdentityCenter.User.Addresses.Region | String | Region of the address. |
| AWS.IAMIdentityCenter.User.Addresses.PostalCode | String | Postal code of the address. |
| AWS.IAMIdentityCenter.User.Addresses.Country | String | Country of the address. |
| AWS.IAMIdentityCenter.User.Addresses.Formatted | String | Formatted version of the address for display. |
| AWS.IAMIdentityCenter.User.Addresses.Type | String | Type of address. |
| AWS.IAMIdentityCenter.User.Addresses.Primary | String | Indicates whether this is the primary address. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Value | String | Phone number associated with the user. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Type | String | Type of phone number. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Primary | String | Indicates whether this is the primary phone number. |
| AWS.IAMIdentityCenter.User.UserType | String | Type of user. |
| AWS.IAMIdentityCenter.User.Title | String | Title of the user. |
| AWS.IAMIdentityCenter.User.PreferredLanguage | String | Preferred language of the user. |
| AWS.IAMIdentityCenter.User.Locale | String | Geographical region or location of the user. |
| AWS.IAMIdentityCenter.User.Timezone | String | Time zone of the user. |
| AWS.IAMIdentityCenter.User.IdentityStoreId | String | Globally unique identifier for the identity store. |
| AWS.IAMIdentityCenter.UserNextToken | String | Pagination token. |
Command example
#### Context Example
```json
{
"AWS": {
"IAMIdentityCenter": {
"User": [
{
"DisplayName": "John Doe",
"Emails": [
{
"Value": "johnDoe@gmail.com"
}
],
"IdentityStoreId": "d-9967750fbd",
"Name": {
"FamilyName": "Doe",
"GivenName": "John"
},
"UserId": "8374c852-10e1-70e2-8996-5b0d54bf8ccd",
"UserName": "johndoe"
},
],
"UserNextToken": null
}
}
}
Human Readable Output
AWS IAM Identity Center Users
DisplayName Emails UserId UserName johndoe johnDoe@gmail.com 8374c852-10e1-70e2-8996-5b0d54bf8ccd johndoe
aws-iam-identitycenter-list-groups
Lists all the IAM groups in the AWS account.
Base Command
aws-iam-identitycenter-list-groups
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| limit | Number of results to return. Default is 50. | Optional |
| nextToken | The pagination token. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.Group.GroupId | String | The identifier for a group in the identity store. |
| AWS.IAMIdentityCenter.Group.DisplayName | String | The display name value for the group. |
| AWS.IAMIdentityCenter.Group.ExternalIds.Issuer | String | The issuer for an external identifier. |
| AWS.IAMIdentityCenter.Group.ExternalIds.Id | String | The identifier issued to this resource by an external identity provider. |
| AWS.IAMIdentityCenter.Group.Description | String | A description of the specified group. |
| AWS.IAMIdentityCenter.Group.IdentityStoreId | String | The globally unique identifier for the identity store. |
| AWS.IAMIdentityCenter.GroupNextToken | String | The pagination token used for the ListUsers and ListGroups API operations. |
Command example
#### Context Example
```json
{
"AWS": {
"IAMIdentityCenter": {
"Group": [
{
"DisplayName": "new",
"GroupId": "53142802-e001-7004-9134-9e6e4e1e10c0",
"IdentityStoreId": "d-9967750fbd"
}
],
"GroupNextToken": null
}
}
}
Human Readable Output
AWS IAM Identity Center Groups
DisplayName GroupId new 53142802-e001-7004-9134-9e6e4e1e10c0
aws-iam-identitycenter-list-groups-for-user
Lists the IAM Identity Center groups that the specified IAM user belongs to.
Base Command
aws-iam-identitycenter-list-groups-for-user
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| limit | Number of results to return. Default is 50. | Optional |
| nextToken | The pagination token. | Optional |
| userName | The name of the user to list groups for. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.User.UserId | string | User ID. |
| AWS.IAMIdentityCenter.User.GroupMemeberships.MembershipId | string | The friendly name that identifies the group. |
| AWS.IAMIdentityCenter.User.GroupMemeberships.GroupId | string | The stable and unique string identifying the group. |
Command example
!aws-iam-identitycenter-list-groups-for-user userName=johndoe
Context Example
{
"AWS": {
"IAMIdentityCenter": {
"GroupsUserNextToken":null,
"User":{
"GroupMemberships":[
{
"GroupId":"a3948882-5051-7090-524c-c8c850bf1919",
"MembershipId":"e374b872-9011-7000-c847-55fdcc299204",
}
],
"UserId":"c3f438a2-e041-7033-75e8-63eb8c64b0e4"
}
}
}
}
Human Readable Output
AWS IAM Identity Center Groups
GroupID MembershipID UserID a3948882-5051-7090-524c-c8c850bf1919 e374b872-9011-7000-c847-55fdcc299204 c3f438a2-e041-7033-75e8-63eb8c64b0e4
aws-iam-identitycenter-add-user-to-group
Adds the specified user to the specified group.
Base Command
aws-iam-identitycenter-add-user-to-group
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| userName | The name of the user to add. | Required |
| groupName | The name of the group to update. | Required |
Context Output
There is no context output for this command.
Command example
!aws-iam-identitycenter-add-user-to-group groupName=NewGroup userName=johndoe
Human Readable Output
The membership id 4314c862-b0c1-705e-d5da-ccf59fd045f3 has been successfully created.
aws-iam-identitycenter-get-group
Get AWS IAM Identity Center group Information.
Base Command
aws-iam-identitycenter-get-group
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| displayName | The name of the group to search. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.Group.GroupId | String | The identifier for a group in the identity store. |
| AWS.IAMIdentityCenter.Group.DisplayName | String | The display name of the group. |
| AWS.IAMIdentityCenter.Group.ExternalIds.Issuer | String | The issuer for an external identifier. |
| AWS.IAMIdentityCenter.Group.ExternalIds.Id | String | The identifier issued to this resource by an external identity provider. |
| AWS.IAMIdentityCenter.Group.Description | String | A description of the group. |
| AWS.IAMIdentityCenter.Group.IdentityStoreId | String | The globally unique identifier for the identity store. |
Command example
!aws-iam-identitycenter-get-group displayName=NewGroup
Context Example
{
"AWS": {
"IAMIdentityCenter": {
"Group": {
"Description": "New",
"DisplayName": "NewGroup",
"GroupId": "f3a478d2-50b1-7078-81a4-c97c703007f3",
"IdentityStoreId": "d-9967750fbd"
}
}
}
}
Human Readable Output
AWS IAM Identity Center Groups
DisplayName GroupId NewGroup f3a478d2-50b1-7078-81a4-c97c703007f3
aws-iam-identitycenter-get-user-by-email
Retrieves information about the specified IAM user.
Base Command
aws-iam-identitycenter-get-user-by-email
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| emailAddress | The email of the user. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.User.UserName | string | The friendly name identifying the user. |
| AWS.IAMIdentityCenter.User.UserId | string | The stable and unique string identifying the user. |
| AWS.IAMIdentityCenter.User.ExternalIds.Issuer | String | The issuer for an external identifier. |
| AWS.IAMIdentityCenter.User.ExternalIds.Id | String | The identifier issued to this resource by an external identity provider. |
| AWS.IAMIdentityCenter.User.Name.Formatted | String | Formatted version of the user’s name for display. |
| AWS.IAMIdentityCenter.User.Name.FamilyName | String | The family name of the user. |
| AWS.IAMIdentityCenter.User.Name.GivenName | String | The given name of the user. |
| AWS.IAMIdentityCenter.User.Name.MiddleName | String | The middle name of the user. |
| AWS.IAMIdentityCenter.User.Name.HonorificPrefix | String | The honorific prefix of the user. |
| AWS.IAMIdentityCenter.User.Name.HonorificSuffix | String | The honorific suffix of the user. |
| AWS.IAMIdentityCenter.User.DisplayName | String | The name of the user formatted for display when referenced. |
| AWS.IAMIdentityCenter.User.NickName | String | An alternate name for the user. |
| AWS.IAMIdentityCenter.User.ProfileUrl | String | URL associated with the user. |
| AWS.IAMIdentityCenter.User.Emails.Value | String | Email address associated with the user. |
| AWS.IAMIdentityCenter.User.Emails.Type | String | Type of email address. |
| AWS.IAMIdentityCenter.User.Emails.Primary | String | Indicates whether this is the primary email address. |
| AWS.IAMIdentityCenter.User.Addresses.StreetAddress | String | Street address. |
| AWS.IAMIdentityCenter.User.Addresses.Locality | String | Address locality. |
| AWS.IAMIdentityCenter.User.Addresses.Region | String | Region of the address. |
| AWS.IAMIdentityCenter.User.Addresses.PostalCode | String | Postal code of the address. |
| AWS.IAMIdentityCenter.User.Addresses.Country | String | Country of the address. |
| AWS.IAMIdentityCenter.User.Addresses.Formatted | String | Formatted version of the address for display. |
| AWS.IAMIdentityCenter.User.Addresses.Type | String | Type of address. |
| AWS.IAMIdentityCenter.User.Addresses.Primary | String | Indicates whether this is the primary address. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Value | String | Phone number associated with the user. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Type | String | Type of phone number. |
| AWS.IAMIdentityCenter.User.PhoneNumbers.Primary | String | Indicates whether this is the primary phone number. |
| AWS.IAMIdentityCenter.User.UserType | String | Type of user. |
| AWS.IAMIdentityCenter.User.Title | String | Title of the user. |
| AWS.IAMIdentityCenter.User.PreferredLanguage | String | Preferred language of the user. |
| AWS.IAMIdentityCenter.User.Locale | String | Geographical region or location of the user. |
| AWS.IAMIdentityCenter.User.Timezone | String | Time zone of the user. |
| AWS.IAMIdentityCenter.User.IdentityStoreId | String | Globally unique identifier for the identity store. |
Command example
!aws-iam-identitycenter-get-user-by-email emailAddress=johnDoe@gmail.com
Context Example
{
"AWS": {
"IAMIdentityCenter": {
"User": {
"DisplayName": "John Doe",
"Emails": [
{
"Primary": true,
"Type": "work",
"Value": "johnDoe@gmail.com"
}
],
"IdentityStoreId": "d-9967750fbd",
"Name": {
"FamilyName": "Doe",
"GivenName": "John"
},
"UserId": "13746842-e011-70fe-14fe-600d496510f0",
"UserName": "johndoe",
}
}
}
}
Human Readable Output
AWS IAM Identity Center Users
DisplayName Emails UserId UserName John Doe johnDoe@gmail.com 13746842-e011-70fe-14fe-600d496510f0 johndoe
aws-iam-identitycenter-list-memberships
Lists the memberships of the group.
Base Command
aws-iam-identitycenter-list-memberships
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| limit | Number of results to return. Default is 50. | Optional |
| nextToken | The pagination token. | Optional |
| groupName | The name of the group to list the memberships. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.GroupMemberships.IdentityStoreId | String | The globally unique identifier for the identity store. |
| AWS.IAMIdentityCenter.Group.GroupMemberships.MembershipId | String | The identifier for a GroupMembership object in an identity store. |
| AWS.IAMIdentityCenter.Group.GroupId | String | The identifier for a group in the identity store. |
| AWS.IAMIdentityCenter.Group.GroupMemberships.UserId | String | Identifier of resources that can be members. |
| AWS.IAMIdentityCenter.GroupMembershipNextToken | String | The pagination token. |
Command example
!aws-iam-identitycenter-list-memberships groupName=NewGroup
Context Example
{
"AWS": {
"IAMIdentityCenter": {
"Group": {
"GroupMemberships":[
{
"MembershipId":"e374b872-9011-7000-c847-55fdcc299204",
"UserId":"c3f438a2-e041-7033-75e8-63eb8c64b0e4"
}
]
},
"GroupMembershipNextToken":null
}
}
}
Human Readable Output
GroupId MembershipId UserId a3948882-5051-7090-524c-c8c850bf1919 e374b872-9011-7000-c847-55fdcc299204 c3f438a2-e041-7033-75e8-63eb8c64b0e4
aws-iam-identitycenter-delete-user
Removes the specified user from the AWS IAM Identity Center.
Base Command
aws-iam-identitycenter-delete-user
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| userName | The name of the user to remove. | Required |
Context Output
There is no context output for this command.
Command example
!aws-iam-identitycenter-delete-user userName=johndoe
Human Readable Output
The User 634418e2-20c1-703e-4358-a8312472c85d has been removed.
aws-iam-identitycenter-delete-group
Removes the specified group from the IAM Identity Center.
Base Command
aws-iam-identitycenter-delete-group
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| groupName | The name of the group to remove. | Required |
Context Output
There is no context output for this command.
Command example
!aws-iam-identitycenter-delete-group groupName=NewGroup
Human Readable Output
The Group f3a478d2-50b1-7078-81a4-c97c703007f3 has been removed.
aws-iam-identitycenter-create-group
Creates a new IAM Identity Center group for your AWS account.
Base Command
aws-iam-identitycenter-create-group
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| displayName | The name of the group to create. | Required |
| description | The description of the group to create. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AWS.IAMIdentityCenter.Group.GroupId | string | The user ID. |
| AWS.IAMIdentityCenter.Group.IdentityStoreId | string | Identity store ID. |
Command example
!aws-iam-identitycenter-create-group description=New displayName=NewGroup
Context Example
{
"AWS": {
"IAMIdentityCenter": {
"Group": {
"GroupId": "f3a478d2-50b1-7078-81a4-c97c703007f3",
"IdentityStoreId": "d-9967750fbd"
}
}
}
}
Human Readable Output
Group NewGroup has been successfully created with id f3a478d2-50b1-7078-81a4-c97c703007f3
GroupId IdentityStoreId f3a478d2-50b1-7078-81a4-c97c703007f3 d-9967750fbd
aws-iam-identitycenter-update-group
Updates an IAM Identity Center group for your AWS account.
Base Command
aws-iam-identitycenter-update-group
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| displayName | The name of the group to update. | Required |
| description | The description of the group to update. | Required |
Context Output
There is no context output for this command.
Command example
!aws-iam-identitycenter-update-group description=changed displayName=NewGroup
Human Readable Output
Group NewGroup has been successfully updated
aws-iam-identitycenter-update-user
Updates an IAM Identity Center user for your AWS account.
Base Command
aws-iam-identitycenter-update-user
Input
| Argument Name | Description | Required |
|---|---|---|
| userName | The username of the user to update. | Required |
| familyName | The family name of the user to update. | Optional |
| givenName | The first name of the user to update. | Optional |
| userEmailAddressPrimary | Is this the primary email address for the associated resource. Possible values are: yes, no. | Optional |
| userEmailAddress | The email address of the user to update. | Optional |
| displayName | The display name of the user to update. | Optional |
| profileUrl | The profile URL of the user to update. | Optional |
| userType | The type of the user to update. | Optional |
| title | The title of the user to update. | Optional |
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
Context Output
There is no context output for this command.
Command example
!aws-iam-identitycenter-update-user userName=johndoe familyName=changed
Human Readable Output
User johndoe has been successfully updated
aws-iam-identitycenter-delete-group-membership
Deletes a user from all groups if a username is provided, or deletes multiple memberships if a list of memberships is provided.
Base Command
aws-iam-identitycenter-delete-group-membership
Input
| Argument Name | Description | Required |
|---|---|---|
| region | The AWS Region. If not specified, the default region will be used. Possible values are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1, eu-north-1, eu-west-3. | Optional |
| roleArn | The Amazon Resource Name. | Optional |
| roleSessionDuration | Role session duration. | Optional |
| roleSessionName | Role session name. | Optional |
| IdentityStoreId | Identity store ID. | Optional |
| userName | The name of the user to delete from all groups. | Optional |
| membershipId | Comma-separated list of membership IDs to delete. | Optional |
Context Output
There is no context output for this command.
Command example
!aws-iam-identitycenter-delete-group-membership userName=johndoe
Human Readable Output
User is not member of any group.
Configuration parameters
roleArn— Role ArnroleArnCredentials—roleSessionName— Role Session NamedefaultRegion— AWS Default Region (required)sessionDuration— Role Session DurationIdentityStoreId— Identity Store IDaccess_key— Access Keysecret_key— Secret Keycredentials— Access Keytimeout— Timeoutretries— Retriessts_regional_endpoint— AWS STS Regional Endpointsinsecure— Trust any certificate (not secure)proxy— Use system proxy settings
Commands (15)
-
aws-iam-identitycenter-add-user-to-groupAdds the specified user to the specified group.
-
aws-iam-identitycenter-create-groupCreates a new IAM Identity Center group for your AWS account.
-
aws-iam-identitycenter-create-userCreates a new IAM Identity Center user for your AWS account.
-
aws-iam-identitycenter-delete-groupRemoves the specified group from the IAM Identity Center.
-
aws-iam-identitycenter-delete-group-membershipDeletes a user from all groups if a username is provided, or deletes multiple memberships if a list of memberships is provided.
-
aws-iam-identitycenter-delete-userRemoves the specified user from the AWS IAM Identity Center.
-
aws-iam-identitycenter-get-groupGet AWS IAM Identity Center group Information.
-
aws-iam-identitycenter-get-userRetrieves information about the specified IAM user.
-
aws-iam-identitycenter-get-user-by-emailRetrieves information about the specified IAM user.
-
aws-iam-identitycenter-list-groupsLists all the IAM groups in the AWS account.
-
aws-iam-identitycenter-list-groups-for-userLists the IAM Identity Center groups that the specified IAM user belongs to.
-
aws-iam-identitycenter-list-membershipsLists the memberships of the group.
-
aws-iam-identitycenter-list-usersLists the IAM users, returns all users in the AWS account.
-
aws-iam-identitycenter-update-groupUpdates an IAM Identity Center group for your AWS account.
-
aws-iam-identitycenter-update-userUpdates an IAM Identity Center user for your AWS account.
import importlib import demistomock as demisto import pytest AWSIAMIdentityCenter = importlib.import_module("AWSIAMIdentityCenter") RESPONSE_GROUP_ID = "GROUP_ID" RESPONSE_USER_ID = "USER_ID" RESPONSE_DELETE = {"ResponseMetadata": {"HTTPStatusCode": 200}} IDENTITY_STORE_ID = "123456" class Boto3Client: def create_user(self): pass def create_group(self): pass def list_users(self): pass def list_groups(self): pass def describe_user(self): pass def describe_group(self): pass def create_group_membership(self): pass def list_group_memberships_for_member(self): pass def delete_group_membership(self): pass def delete_user(self): pass def delete_group(self): pass def list_group_memberships(self): pass def update_user(self): pass def update_group(self): pass def get_user_operations_list(self): pass def test_create_user(mocker): """ Given: Arguments for creating a user When: Creating a user using the create-user command Then: Verify that the user is created with the correct arguments """ args = { "userName": "test_user", "familyName": "Doe", "givenName": "John", "userEmailAddress": "john.doe@example.com", "displayName": "John Doe", "userEmailAddressPrimary": True, } res = {"UserId": "USER_ID", "IdentityStoreId": IDENTITY_STORE_ID, "ResponseMetadata": {"HTTPStatusCode": 200}} from AWSIAMIdentityCenter import create_user mocker.patch.object(Boto3Client, "create_user", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() create_user(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert {"UserId": "USER_ID", "IdentityStoreId": IDENTITY_STORE_ID} in contents.get("EntryContext").values() assert "User test_user has been successfully created with user id USER_ID" in contents.get("HumanReadable") def test_update_user(mocker): """ Given: Arguments for updating a user When: updating a user details using the update-user command Then: Verify that the user is updated """ response_id = {"UserId": "USER_ID"} args = { "userName": "test_user", "familyName": "changed_fam", } from AWSIAMIdentityCenter import update_user mocker.patch.object(AWSIAMIdentityCenter, "get_userId_by_username", return_value=response_id) mocker.patch.object(Boto3Client, "update_user", return_value={}) mocker.patch.object(demisto, "results") client = Boto3Client() update_user(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "User test_user has been successfully updated" in contents.get("HumanReadable") def test_update_group(mocker): """ Given: Arguments for updating a group When: updating a group description using the update-group command Then: Verify that the group is updated """ response_id = {"GroupId": "GROUP_ID"} args = { "displayName": "test_group", "description": "changed_description", } from AWSIAMIdentityCenter import update_group mocker.patch.object(AWSIAMIdentityCenter, "get_groupId_by_displayName", return_value=response_id) mocker.patch.object(Boto3Client, "update_group", return_value={}) mocker.patch.object(demisto, "results") client = Boto3Client() update_group(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "Group test_group has been successfully updated" in contents.get("HumanReadable") def test_create_group(mocker): """ Given: Arguments for creating a group When: Creating a group using the create-group command Then: Verify that the group is created with the correct arguments """ args = {"displayName": "Test Group", "description": "Test Description"} res = {"GroupId": IDENTITY_STORE_ID, "ResponseMetadata": {"HTTPStatusCode": 200}} from AWSIAMIdentityCenter import create_group mocker.patch.object(Boto3Client, "create_group", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() create_group(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert {"GroupId": IDENTITY_STORE_ID} in contents.get("EntryContext").values() assert "Group Test Group has been successfully created with id 123456" in contents.get("HumanReadable") def test_list_users(mocker): """ Given: Arguments for listing users When: Listing users using the list-users command Then: Verify that the correct users are listed with the correct details """ args = {"limit": 1, "nextToken": "TOKEN"} res = { "IdentityStoreId": IDENTITY_STORE_ID, "Users": [ {"UserId": "USER_ID", "UserName": "test_user", "DisplayName": "Test User", "Emails": [{"Value": "test@example.com"}]} ], "NextToken": "NEXT_TOKEN", } from AWSIAMIdentityCenter import list_users mocker.patch.object(Boto3Client, "list_users", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() list_users(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "AWS IAM Identity Center Users" in contents.get("HumanReadable") assert [ {"UserId": "USER_ID", "UserName": "test_user", "DisplayName": "Test User", "Emails": [{"Value": "test@example.com"}]} ] in contents.get("EntryContext").values() assert {"UserNextToken": "NEXT_TOKEN"} in contents.get("EntryContext").values() def test_list_groups(mocker): """ Given: Arguments for listing groups When: Listing groups using the list-groups command Then: Verify that the correct groups are listed with the correct details """ args = {} res = {"Groups": [{"GroupId": "123", "DisplayName": "Test Group", "Description": "Test Description"}], "NextToken": None} from AWSIAMIdentityCenter import list_groups mocker.patch.object(Boto3Client, "list_groups", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() list_groups(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "AWS IAM Identity Center Groups" in contents.get("HumanReadable") assert [{"GroupId": "123", "DisplayName": "Test Group", "Description": "Test Description"}] in contents.get( "EntryContext" ).values() assert {"GroupNextToken": None} in contents.get("EntryContext").values() def test_get_user(mocker): """ Given: User Name When: Getting a user using the get-user command Then: Verify that the correct user is retrieved with the correct details """ args = {"userName": "test_user"} response_id = {"UserId": "USER_ID"} res = { "UserId": "USER_ID", "UserName": "test_user", "DisplayName": "Test User", "Emails": [{"Value": "test@example.com"}], "ResponseMetadata": {"HTTPStatusCode": 200}, } from AWSIAMIdentityCenter import get_user mocker.patch.object(AWSIAMIdentityCenter, "get_userId_by_username", return_value=response_id) mocker.patch.object(Boto3Client, "describe_user", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() get_user(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert { "UserId": "USER_ID", "UserName": "test_user", "DisplayName": "Test User", "Emails": [{"Value": "test@example.com"}], } in contents.get("EntryContext").values() assert "AWS IAM Identity Center Users" in contents.get("HumanReadable") def test_get_user_by_email(mocker): """ Given: Email address When: Getting a user using the get-user-by-email command Then: Verify that the correct user is retrieved with the correct details """ args = {"emailAddress": "test@example.com"} res = { "Users": [ { "UserId": "USER_ID", "UserName": "test_user", "DisplayName": "Test User", "Name": { "FamilyName": "User", "GivenName": "Test", }, "Emails": [{"Value": "test@example.com", "Type": "work", "Primary": True}], } ], "ResponseMetadata": {"HTTPStatusCode": 200}, } from AWSIAMIdentityCenter import get_user_by_email mocker.patch.object(Boto3Client, "list_users", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() get_user_by_email(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert { "UserId": "USER_ID", "UserName": "test_user", "DisplayName": "Test User", "Name": {"FamilyName": "User", "GivenName": "Test"}, "Emails": [{"Value": "test@example.com", "Type": "work", "Primary": True}], } in contents.get("EntryContext").values() assert "AWS IAM Identity Center Users" in contents.get("HumanReadable") def test_get_user_by_email_not_exist(mocker): """ Given: Not existing email address When: Asking for a user details using the get-user-by-email command Then: Return an error """ args = {"emailAddress": "notexist@example.com"} # Mock the response to indicate that no user exists res = { "Users": [ { "UserId": "USER_ID", "UserName": "test_user", "DisplayName": "Test User", "Name": { "FamilyName": "User", "GivenName": "Test", }, "Emails": [{"Value": "test@example.com", "Type": "work", "Primary": True}], } ], "ResponseMetadata": {"HTTPStatusCode": 200}, } mocker.patch.object(Boto3Client, "list_users", return_value=res) mocker.patch.object(demisto, "results") return_error_mock = mocker.patch.object(AWSIAMIdentityCenter, "return_error") from AWSIAMIdentityCenter import get_user_by_email client = Boto3Client() get_user_by_email(args, client, IDENTITY_STORE_ID) assert return_error_mock.call_count == 1 assert "User with the email notexist@example.com was not found." in return_error_mock.call_args.args def test_get_group(mocker): """ Given: Arguments for getting a group When: Getting a group using the get-group command Then: Verify that the correct group is retrieved with the correct details """ args = {"displayName": "test_group"} response_id = {"GroupId": IDENTITY_STORE_ID} res = {"GroupId": "string", "DisplayName": "test_group", "Description": None, "ResponseMetadata": {"HTTPStatusCode": 200}} from AWSIAMIdentityCenter import get_group mocker.patch.object(AWSIAMIdentityCenter, "get_groupId_by_displayName", return_value=response_id) mocker.patch.object(Boto3Client, "describe_group", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() get_group(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert {"GroupId": "string", "DisplayName": "test_group", "Description": None} in contents.get("EntryContext").values() assert "AWS IAM Identity Center Groups" in contents.get("HumanReadable") def test_add_user_to_group(mocker): """ Given: Arguments for adding a user to a group When: Adding a user to a group using the add-user-to-group command Then: Verify that the user is added to the group """ args = {"userName": "test_user", "displayName": "test_group"} res = {"MembershipId": "10203040", "ResponseMetadata": {"HTTPStatusCode": 200}} from AWSIAMIdentityCenter import add_user_to_group mocker.patch.object(AWSIAMIdentityCenter, "get_userId_by_username", return_value=RESPONSE_USER_ID) mocker.patch.object(AWSIAMIdentityCenter, "get_groupId_by_displayName", return_value=RESPONSE_GROUP_ID) mocker.patch.object(Boto3Client, "create_group_membership", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() add_user_to_group(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "The membership id 10203040 has been successfully created." in contents.get("HumanReadable") def test_list_groups_for_user(mocker): """ Given: Arguments for listing groups for a user When: Listing groups for a user using the list-groups-for-user command Then: Verify that the correct groups are listed for the user with the correct details """ args = {"userName": "test_user"} res = { "GroupMemberships": [{"MemberId": {"UserId": "USER_ID"}, "GroupId": "GROUP_ID", "MembershipId": "MEMBERSHIP_ID"}], "NextToken": None, } from AWSIAMIdentityCenter import list_groups_for_user mocker.patch.object(AWSIAMIdentityCenter, "get_userId_by_username", return_value=RESPONSE_USER_ID) mocker.patch.object(Boto3Client, "list_group_memberships_for_member", return_value=res) mocker.patch.object(demisto, "results") client = Boto3Client() list_groups_for_user(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert { "GroupMemberships": [{"GroupId": "GROUP_ID", "MembershipId": "MEMBERSHIP_ID"}], "UserId": "USER_ID", "GroupsUserNextToken": None, } in contents.get("EntryContext").values() assert "AWS IAM Identity Center Groups" in contents.get("HumanReadable") def test_delete_group_membership(mocker): """ Given: Username for deleting a group membership When: Deleting a group membership using the delete-group-membership command Then: Verify that the correct group membership is deleted """ args = {"userName": "test_user"} res = { "GroupMemberships": [ {"MemberId": {"UserId": "USER_ID"}, "GroupId": "GROUP_ID", "MembershipId": "MEMBERSHIP_ID"}, {"MemberId": {"UserId": "USER_ID"}, "GroupId": "GROUP_ID2", "MembershipId": "MEMBERSHIP_ID123"}, ], "NextToken": None, } from AWSIAMIdentityCenter import delete_group_membership mocker.patch.object(AWSIAMIdentityCenter, "get_userId_by_username", return_value=RESPONSE_USER_ID) mocker.patch.object(Boto3Client, "list_group_memberships_for_member", return_value=res) mocker.patch.object(Boto3Client, "delete_group_membership", return_value=RESPONSE_DELETE) mocker.patch.object(demisto, "results") client = Boto3Client() delete_group_membership(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "The membership with ids ['MEMBERSHIP_ID', 'MEMBERSHIP_ID123'] have been deleted." in contents.get("HumanReadable") def test_delete_group_memberships_by_membershipId(mocker): """ Given: List of group memberships When: Deleting a group membership using the delete-group-membership command Then: Verify that the correct group membership is deleted """ args = {"membershipId": "MEMBERSHIP_ID, MEMBERSHIP_ID123"} from AWSIAMIdentityCenter import delete_group_membership mocker.patch.object(AWSIAMIdentityCenter, "get_userId_by_username", return_value=RESPONSE_USER_ID) mocker.patch.object(Boto3Client, "delete_group_membership", return_value=RESPONSE_DELETE) mocker.patch.object(demisto, "results") client = Boto3Client() delete_group_membership(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "The membership with ids ['MEMBERSHIP_ID', 'MEMBERSHIP_ID123'] have been deleted." in contents.get("HumanReadable") def test_delete_user(mocker): """ Given: Arguments for deleting a user When: Deleting a user using the delete-user command Then: Verify that the correct user is deleted """ args = {"userName": "test_user"} from AWSIAMIdentityCenter import delete_user mocker.patch.object(AWSIAMIdentityCenter, "get_userId_by_username", return_value=RESPONSE_USER_ID) mocker.patch.object(Boto3Client, "delete_user", return_value=RESPONSE_DELETE) mocker.patch.object(demisto, "results") client = Boto3Client() delete_user(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "The User USER_ID has been removed." in contents.get("HumanReadable") def test_delete_group(mocker): """ Given: Arguments for deleting a group When: Deleting a group using the delete-group command Then: Verify that the correct group is deleted """ args = {"displayName": "test_group"} from AWSIAMIdentityCenter import delete_group mocker.patch.object(AWSIAMIdentityCenter, "get_groupId_by_displayName", return_value=RESPONSE_GROUP_ID) mocker.patch.object(Boto3Client, "delete_group", return_value=RESPONSE_DELETE) mocker.patch.object(demisto, "results") client = Boto3Client() delete_group(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert "The Group GROUP_ID has been removed." in contents.get("HumanReadable") def test_list_group_memberships(mocker): """ Given: Arguments for listing group memberships When: Listing group memberships using the list-group-memberships command Then: Verify that the correct group memberships are listed with the correct details """ args = { "displayName": "test_group", } response = { "GroupMemberships": [{"MembershipId": "MEMBERSHIP_ID", "MemberId": {"UserId": "USER_ID"}}], "NextToken": "NEXT_TOKEN", } from AWSIAMIdentityCenter import list_group_memberships mocker.patch.object(AWSIAMIdentityCenter, "get_groupId_by_displayName", return_value=RESPONSE_GROUP_ID) mocker.patch.object(Boto3Client, "list_group_memberships", return_value=response) mocker.patch.object(demisto, "results") client = Boto3Client() list_group_memberships(args, client, IDENTITY_STORE_ID) contents = demisto.results.call_args[0][0] assert { "GroupId": "GROUP_ID", "GroupMemberships": [{"MembershipId": "MEMBERSHIP_ID", "UserId": "USER_ID"}], "GroupMembershipNextToken": "NEXT_TOKEN", } in contents.get("EntryContext").values() assert "AWS IAM Identity Center Groups" in contents.get("HumanReadable") def test_get_user_operations_list_empty_region(): """ Given: Arguments not including 'region' argument in the input dictionary. When: Generating a list of operations to update user information using get_user_operations_list function. Then: Ensure that the function handles the empty 'region' argument properly and generates the expected list of operations. """ # Input arguments with empty 'region' args = { "userEmailAddressPrimary": "true", "userEmailAddress": "test@example.com", "familyName": "Doe", "givenName": "John", "displayName": "John Doe", "userType": "Employee", "profileUrl": "https://example.com/profile", "title": "Software Engineer", } # Expected list of operations expected_operations = [ {"AttributePath": "name.familyName", "AttributeValue": "Doe"}, {"AttributePath": "name.givenName", "AttributeValue": "John"}, {"AttributePath": "emails", "AttributeValue": [{"value": "test@example.com", "primary": True}]}, {"AttributePath": "displayName", "AttributeValue": "John Doe"}, {"AttributePath": "userType", "AttributeValue": "Employee"}, {"AttributePath": "profileUrl", "AttributeValue": "https://example.com/profile"}, {"AttributePath": "title", "AttributeValue": "Software Engineer"}, ] # Call the function to be tested from AWSIAMIdentityCenter import get_user_operations_list result = get_user_operations_list(args) # Assert that the result matches the expected list of operations assert result == expected_operations @pytest.mark.parametrize( "last_data, current_data, expected_results", [ ( [ {"id": 1, "groups": [{"GroupId": "GROUP_1", "MembershipId": "A"}, {"GroupId": "GROUP_2", "MembershipId": "B"}]}, {"id": 2, "groups": [{"GroupId": "GROUP_1", "MembershipId": "C"}, {"GroupId": "GROUP_3", "MembershipId": "D"}]}, ], [ {"GroupId": "GROUP_1", "MembershipId": "C"}, {"GroupId": "GROUP_3", "MembershipId": "D"}, {"GroupId": "GROUP_4", "MembershipId": "F"}, ], [ {"GroupId": "GROUP_1", "MembershipId": "C"}, {"GroupId": "GROUP_3", "MembershipId": "D"}, {"GroupId": "GROUP_4", "MembershipId": "F"}, ], ), ( {"id": 2, "groups": [{"GroupId": "GROUP_1", "MembershipId": "C"}, {"GroupId": "GROUP_2", "MembershipId": "B"}]}, [ {"GroupId": "GROUP_1", "MembershipId": "C"}, {"GroupId": "GROUP_3", "MembershipId": "D"}, {"GroupId": "GROUP_4", "MembershipId": "F"}, ], [ {"GroupId": "GROUP_1", "MembershipId": "C"}, {"GroupId": "GROUP_2", "MembershipId": "B"}, {"GroupId": "GROUP_3", "MembershipId": "D"}, {"GroupId": "GROUP_4", "MembershipId": "F"}, ], ), ([], [{"GroupId": "GROUP_1", "MembershipId": "C"}], [{"GroupId": "GROUP_1", "MembershipId": "C"}]), ], ) def test_update_groups_and_memberships(mocker, last_data, current_data, expected_results): """ Given: Arguments for updating groups and memberships When: Updating groups and memberships using the update_groups_and_memberships function Then: Verify that the correct groups and memberships are updated with the correct details """ key = "id" id_value = 2 new_data = "groups" from AWSIAMIdentityCenter import update_groups_and_memberships mocker.patch.object(AWSIAMIdentityCenter, "update_groups_and_memberships") updated_data = update_groups_and_memberships(last_data, current_data, key, id_value, new_data) assert updated_data == expected_results