Skip to content

update_group async

update_group(
    directory_id: DirectoryId,
    sam_account_name: GroupName,
    *,
    config_overrides: Optional[AsyncDirectoryServiceDataClientConfig] = None,
    group_type: Optional[GroupType] = None,
    group_scope: Optional[GroupScope] = None,
    other_attributes: Optional[Attributes] = None,
    update_type: Optional[UpdateType] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdateGroupResult

Updates group information.

Parameters:

  • directory_id (DirectoryId) –

    The identifier (ID) of the directory that's associated with the group.

  • sam_account_name (GroupName) –

    The name of the group.

  • group_type (Optional[GroupType], default: None ) –

    The AD group type. For details, see Active Directory security group type.

  • group_scope (Optional[GroupScope], default: None ) –

    The scope of the AD group. For details, see Active Directory security groups.

  • other_attributes (Optional[Attributes], default: None ) –

    An expression that defines one or more attributes with the data type and the value of each attribute.

  • update_type (Optional[UpdateType], default: None ) –

    The type of update to be performed. If no value exists for the attribute, use ADD. Otherwise, use REPLACE to change an attribute value or REMOVE to 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 DirectoryId doesn'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 a group The following command updates the preferred language and country attributes for the GuestsLocal group.

>>> await client.update_group(client_token='550e8400-e29b-41d4-a716-446655440000', directory_id='d-12233abcde', group_scope='Global', group_type='Security', other_attributes={'preferredLanguage': {'S': 'English'}, 'co': {'S': 'US'}}, sam_account_name='GuestsLocal', update_type='REPLACE')
Source code in docs_src/capo_directory_service_data/_services/async_directory_service_data.py
async def update_group(
    self,
    directory_id: "capo_directory_service_data.types.directory_id.DirectoryId",
    sam_account_name: "capo_directory_service_data.types.group_name.GroupName",
    *,
    config_overrides: Optional[AsyncDirectoryServiceDataClientConfig] = None,
    group_type: Optional[
        "capo_directory_service_data.types.group_type.GroupType"
    ] = None,
    group_scope: Optional[
        "capo_directory_service_data.types.group_scope.GroupScope"
    ] = None,
    other_attributes: Optional[
        "capo_directory_service_data.types.attributes.Attributes"
    ] = None,
    update_type: Optional[
        "capo_directory_service_data.types.update_type.UpdateType"
    ] = None,
    client_token: Optional[
        "capo_directory_service_data.types.client_token.ClientToken"
    ] = None,
) -> "capo_directory_service_data.types.update_group_result.UpdateGroupResult":
    """<p> Updates group information. </p>

    Args:
        directory_id: <p> The identifier (ID) of the directory that's associated with the group. </p>
        sam_account_name: <p> The name of the group. </p>
        group_type: <p> The AD group type. For details, see <a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-groups#how-active-directory-security-groups-work">Active Directory security group type</a>. </p>
        group_scope: <p> The scope of the AD group. For details, see <a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-groups#group-scope">Active Directory security groups</a>. </p>
        other_attributes: <p> An expression that defines one or more attributes with the data type and the value of each attribute. </p>
        update_type: <p> The type of update to be performed. If no value exists for the attribute, use <code>ADD</code>. Otherwise, use <code>REPLACE</code> to change an attribute value or <code>REMOVE</code> to clear the attribute value. </p>
        client_token: <p> 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. </p> <p> 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. </p> <p> 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 <code>ConflictException</code>. </p> <note> <p> This parameter is optional when using the CLI or SDK. </p> </note>

    Raises:
        capo_directory_service_data.errors.access_denied_exception.AccessDeniedException: <p> You don't have permission to perform the request or access the directory. It can also occur when the <code>DirectoryId</code> doesn't exist or the user, member, or group might be outside of your organizational unit (OU). </p> <p> 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. </p>
        capo_directory_service_data.errors.conflict_exception.ConflictException: <p> 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.</p> <p> 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. </p>
        capo_directory_service_data.errors.directory_unavailable_exception.DirectoryUnavailableException: <p> The request could not be completed due to a problem in the configuration or current state of the specified directory. </p>
        capo_directory_service_data.errors.internal_server_exception.InternalServerException: <p> The operation didn't succeed because an internal error occurred. Try again later. </p>
        capo_directory_service_data.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource couldn't be found. </p>
        capo_directory_service_data.errors.throttling_exception.ThrottlingException: <p> The limit on the number of requests per second has been exceeded. </p>
        capo_directory_service_data.errors.validation_exception.ValidationException: <p> The request isn't valid. Review the details in the error message to update the invalid parameters or values in your request. </p>
        capo_directory_service_data.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To update a group
        The following command updates the preferred language and country attributes for the GuestsLocal group.

        >>> await client.update_group(client_token='550e8400-e29b-41d4-a716-446655440000', directory_id='d-12233abcde', group_scope='Global', group_type='Security', other_attributes={'preferredLanguage': {'S': 'English'}, 'co': {'S': 'US'}}, sam_account_name='GuestsLocal', update_type='REPLACE')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_directory_service_data.types.update_group_request.UpdateGroupRequest]",
    ) -> AsyncOperationResponse[
        "capo_directory_service_data.types.update_group_result.UpdateGroupResult"
    ]:
        import capo_directory_service_data._operations.directory_service_data.update_group

        (
            output,
            http_response,
        ) = await capo_directory_service_data._operations.directory_service_data.update_group.async_update_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_directory_service_data.types.update_group_request.UpdateGroupRequest",
    ) -> dict[str, Any]:
        import capo_directory_service_data.types.update_group_request

        return (
            capo_directory_service_data.types.update_group_request.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateGroup", redact_input=_redact_input),
    )
    input_: capo_directory_service_data.types.update_group_request.UpdateGroupRequest = {
        "directory_id": directory_id,
        "sam_account_name": sam_account_name,
    }
    if group_type is not None:
        input_["group_type"] = group_type
    if group_scope is not None:
        input_["group_scope"] = group_scope
    if other_attributes is not None:
        input_["other_attributes"] = other_attributes
    if update_type is not None:
        input_["update_type"] = update_type
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output