Skip to content

update_impersonation_role

update_impersonation_role(
    organization_id: OrganizationId,
    impersonation_role_id: ImpersonationRoleId,
    name: ImpersonationRoleName,
    type: ImpersonationRoleType,
    rules: ImpersonationRuleList,
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    description: Optional[ImpersonationRoleDescription] = None,
) -> UpdateImpersonationRoleResponse

Updates an impersonation role for the given WorkMail organization.

Parameters:

Raises:

Source code in docs_src/capo_workmail/_services/work_mail.py
def update_impersonation_role(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    impersonation_role_id: "capo_workmail.types.impersonation_role_id.ImpersonationRoleId",
    name: "capo_workmail.types.impersonation_role_name.ImpersonationRoleName",
    type: "capo_workmail.types.impersonation_role_type.ImpersonationRoleType",
    rules: "capo_workmail.types.impersonation_rule_list.ImpersonationRuleList",
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    description: Optional[
        "capo_workmail.types.impersonation_role_description.ImpersonationRoleDescription"
    ] = None,
) -> "capo_workmail.types.update_impersonation_role_response.UpdateImpersonationRoleResponse":
    """<p>Updates an impersonation role for the given WorkMail organization.</p>

    Args:
        organization_id: <p>The WorkMail organization that contains the impersonation role to update.</p>
        impersonation_role_id: <p>The ID of the impersonation role to update.</p>
        name: <p>The updated impersonation role name.</p>
        type: <p>The updated impersonation role type.</p>
        description: <p>The updated impersonation role description.</p>
        rules: <p>The updated list of rules.</p>

    Raises:
        capo_workmail.errors.entity_not_found_exception.EntityNotFoundException: <p>The identifier supplied for the user, group, or resource does not exist in your organization.</p>
        capo_workmail.errors.entity_state_exception.EntityStateException: <p>You are performing an operation on a user, group, or resource that isn't in the expected state, such as trying to delete an active user.</p>
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeds the limit of the resource.</p>
        capo_workmail.errors.organization_not_found_exception.OrganizationNotFoundException: <p>An operation received a valid organization identifier that either doesn't belong or exist in the system.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource cannot be found.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workmail.types.update_impersonation_role_request.UpdateImpersonationRoleRequest]",
    ) -> OperationResponse[
        "capo_workmail.types.update_impersonation_role_response.UpdateImpersonationRoleResponse"
    ]:
        import capo_workmail._operations.work_mail_service.update_impersonation_role

        output, http_response = (
            capo_workmail._operations.work_mail_service.update_impersonation_role.update_impersonation_role(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateImpersonationRole")
    )
    input_: capo_workmail.types.update_impersonation_role_request.UpdateImpersonationRoleRequest = {
        "organization_id": organization_id,
        "impersonation_role_id": impersonation_role_id,
        "name": name,
        "type": type,
        "rules": rules,
    }
    if description is not None:
        input_["description"] = description

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output