search_principals
¶
search_principals(
domain_id: DomainId,
search_query: str,
*,
config_overrides: Optional[CloudWatchOmniClientConfig] = None,
max_results: Optional[int] = None,
next_token: Optional[SearchPrincipalsNextToken] = None,
) -> SearchPrincipalsOutput
Searches Identity Center for users and groups in a domain. The domain must be configured with Identity Center. To grant access to a result, pass its principalId to CreateAccessGrant with a principalType of IDC_USER for a user or IDC_GROUP for a group.
Parameters:
-
domain_id(DomainId) –The ID of the domain to search within.
-
search_query(str) –A search term to match against user names, display names, and IDs. Pass * to list all principals. Maximum 128 characters.
-
max_results(Optional[int], default:None) –The maximum number of results to return. Defaults to 10. Valid only when searchQuery is *; other searches reject this parameter and return at most 10 results.
-
next_token(Optional[SearchPrincipalsNextToken], default:None) –A token to retrieve the next page of results. Valid only when searchQuery is *; other searches do not paginate and reject this parameter. Tokens expire after 24 hours.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ResourceNotFoundException–The specified resource does not exist.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Search principals by name The following example searches a domain for principals whose name matches a text query. A text search (any searchQuery other than *) returns at most 10 results and does not paginate, so maxResults and nextToken are not supplied and no nextToken is returned. To grant access to a result, pass its principalId to CreateAccessGrant with a principalType of IDC_USER for a user or IDC_GROUP for a group. Payloads are shown as JSON; on the wire they are CBOR-encoded.
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 | |