update_user
¶
update_user(
directory_id: DirectoryId,
sam_account_name: UserName,
*,
config_overrides: Optional[DirectoryServiceDataClientConfig] = None,
email_address: Optional[EmailAddress] = None,
given_name: Optional[GivenName] = None,
surname: Optional[Surname] = None,
other_attributes: Optional[Attributes] = None,
update_type: Optional[UpdateType] = None,
client_token: Optional[ClientToken] = None,
) -> UpdateUserResult
Updates user information.
Parameters:
-
directory_id(DirectoryId) –The identifier (ID) of the directory that's associated with the user.
-
sam_account_name(UserName) –The name of the user.
-
email_address(Optional[EmailAddress], default:None) –The email address of the user.
-
given_name(Optional[GivenName], default:None) –The first name of the user.
-
surname(Optional[Surname], default:None) –The last name of the user.
-
other_attributes(Optional[Attributes], default:None) –An expression that defines one or more attribute names with the data type and value of each attribute. A key is an attribute name, and the value is a list of maps. For a list of supported attributes, see Directory Service Data Attributes.
Attribute names are case insensitive.
-
update_type(Optional[UpdateType], default:None) –The type of update to be performed. If no value exists for the attribute, use
ADD. Otherwise, useREPLACEto change an attribute value orREMOVEto clear the attribute value. -
client_token(Optional[ClientToken], default:None) –A unique and case-sensitive identifier that you provide to make sure the idempotency of the request, so multiple identical calls have the same effect as one single call.
A client token is valid for 8 hours after the first request that uses it completes. After 8 hours, any request with the same client token is treated as a new request. If the request succeeds, any future uses of that token will be idempotent for another 8 hours.
If you submit a request with the same client token but change one of the other parameters within the 8-hour idempotency window, Directory Service Data returns an
ConflictException.This parameter is optional when using the CLI or SDK.
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.
-
ConflictException–This error will occur when you try to create a resource that conflicts with an existing object. It can also occur when adding a member to a group that the member is already in.
This error can be caused by a request sent within the 8-hour idempotency window with the same client token but different input parameters. Client tokens should not be re-used across different requests. After 8 hours, any request with the same client token is treated as a new request.
-
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.
-
ResourceNotFoundException–The resource couldn't be found.
-
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 update user attributes The following command
>>> client.update_user(client_token='550e8400-e29b-41d4-a716-446655440000', directory_id='d-12233abcde', email_address='[email protected]', given_name='Terry', other_attributes={'telephoneNumber': {'S': '212-555-1111'}, 'homePhone': {'S': '333-333-3333'}, 'physicalDeliveryOfficeName': {'S': 'Example Company'}, 'streetAddress': {'S': '123 Any Street'}, 'postalCode': {'S': '54321'}, 'st': {'S': 'WA'}, 'co': {'S': 'US'}}, sam_account_name='twhitlock', surname='Whitlock', update_type='ADD')
Source code in docs_src/capo_directory_service_data/_services/directory_service_data.py
1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 | |