search_users
async
¶
search_users(
directory_id: DirectoryId,
search_string: SearchString,
search_attributes: LdapDisplayNameList,
*,
config_overrides: Optional[AsyncDirectoryServiceDataClientConfig] = None,
realm: Optional[Realm] = None,
next_token: Optional[NextToken] = None,
max_results: Optional[MaxResults] = None,
) -> SearchUsersResult
Searches the specified directory for a user. You can find users that match the SearchString parameter with the value of their attributes included in the SearchString parameter.
This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the SearchUsers.NextToken member contains a token that you pass in the next call to SearchUsers. This retrieves the next set of items.
You can also specify a maximum number of return results with the MaxResults parameter.
Parameters:
-
directory_id(DirectoryId) –The identifier (ID) of the directory that's associated with the user.
-
realm(Optional[Realm], default:None) –The domain name that's associated with the user.
This parameter is optional, so you can return users outside of your Managed Microsoft AD domain. When no value is defined, only your Managed Microsoft AD users are returned.
This value is case insensitive.
-
search_string(SearchString) –The attribute value that you want to search for.
Wildcard
(*)searches aren't supported. For a list of supported attributes, see Directory Service Data Attributes. -
search_attributes(LdapDisplayNameList) –One or more data attributes that are used to search for a user. For a list of supported attributes, see Directory Service Data Attributes.
-
next_token(Optional[NextToken], default:None) –An encoded paging token for paginated calls that can be passed back to retrieve the next page.
-
max_results(Optional[MaxResults], default:None) –The maximum number of results to be returned per request.
Raises:
-
AccessDeniedException–You don't have permission to perform the request or access the directory. It can also occur when the
DirectoryIddoesn't exist or the user, member, or group might be outside of your organizational unit (OU).Make sure that you have the authentication and authorization to perform the action. Review the directory information in the request, and make sure that the object isn't outside of your OU.
-
DirectoryUnavailableException–The request could not be completed due to a problem in the configuration or current state of the specified directory.
-
InternalServerException–The operation didn't succeed because an internal error occurred. Try again later.
-
ThrottlingException–The limit on the number of requests per second has been exceeded.
-
ValidationException–The request isn't valid. Review the details in the error message to update the invalid parameters or values in your request.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To search for users The following command searches for users in the domain based on the SearchAttributes.
>>> await client.search_users(directory_id='d-12233abcde', realm='examplecorp.com', search_attributes=['department'], search_string='DevOps')
Source code in docs_src/capo_directory_service_data/_services/async_directory_service_data.py
1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 | |