Skip to content

reject_time_off

reject_time_off(
    instance_id: InstanceIdOrArn,
    user_id: UserIdOrArn,
    time_off_id: TimeOffId,
    *,
    config_overrides: Optional[ConnectSchedulingClientConfig] = None,
    description: Optional[Description] = None,
) -> RejectTimeOffResponse

Rejects a time off request.

Rejecting a REJECTED request succeeds without a change. Returns ConflictException if the request is PENDING or CANCELLED. PENDING means Connect Customer is still processing the request asynchronously. Wait until GetTimeOff returns a status other than PENDING, and then retry.

Parameters:

  • instance_id (InstanceIdOrArn) –

    The identifier of the Connect Customer instance. This can be the ID or the ARN of the instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • user_id (UserIdOrArn) –

    The identifier of the user who the time off request belongs to. This can be the ID or the ARN of the user.

  • time_off_id (TimeOffId) –

    The unique identifier of the time off request to reject. If the time off request doesn't belong to UserId, the operation returns ResourceNotFoundException.

  • description (Optional[Description], default: None ) –

    A description recorded with the rejection, such as the reason. GetTimeOff doesn't return it.

Raises:

Examples:

To reject a time off request The following example rejects a time off request and records the reason on the rejection.

>>> client.reject_time_off(instance_id='12345678-1234-1234-1234-123456789012', user_id='87654321-4321-4321-4321-210987654321', time_off_id='abcdef12-3456-7890-abcd-ef1234567890', description='Not enough coverage for this shift')
Source code in docs_src/capo_connectscheduling/_services/connect_scheduling.py
def reject_time_off(
    self,
    instance_id: "capo_connectscheduling.types.instance_id_or_arn.InstanceIdOrArn",
    user_id: "capo_connectscheduling.types.user_id_or_arn.UserIdOrArn",
    time_off_id: "capo_connectscheduling.types.time_off_id.TimeOffId",
    *,
    config_overrides: Optional[ConnectSchedulingClientConfig] = None,
    description: Optional[
        "capo_connectscheduling.types.description.Description"
    ] = None,
) -> "capo_connectscheduling.types.reject_time_off_response.RejectTimeOffResponse":
    """<p>Rejects a time off request.</p> <p>Rejecting a <code>REJECTED</code> request succeeds without a change. Returns <code>ConflictException</code> if the request is <code>PENDING</code> or <code>CANCELLED</code>. <code>PENDING</code> means Connect Customer is still processing the request asynchronously. Wait until <code>GetTimeOff</code> returns a status other than <code>PENDING</code>, and then retry.</p>

    Args:
        instance_id: <p>The identifier of the Connect Customer instance. This can be the ID or the ARN of the instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        user_id: <p>The identifier of the user who the time off request belongs to. This can be the ID or the ARN of the user.</p>
        time_off_id: <p>The unique identifier of the time off request to reject. If the time off request doesn't belong to <code>UserId</code>, the operation returns <code>ResourceNotFoundException</code>.</p>
        description: <p>A description recorded with the rejection, such as the reason. <code>GetTimeOff</code> doesn't return it.</p>

    Raises:
        capo_connectscheduling.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connectscheduling.errors.conflict_exception.ConflictException: <p>The request could not be processed because of a conflict with the current state of the resource.</p>
        capo_connectscheduling.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an error or failure with the service.</p>
        capo_connectscheduling.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connectscheduling.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_connectscheduling.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an AWS service.</p>
        capo_connectscheduling.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To reject a time off request
        The following example rejects a time off request and records the reason on the rejection.

        >>> client.reject_time_off(instance_id='12345678-1234-1234-1234-123456789012', user_id='87654321-4321-4321-4321-210987654321', time_off_id='abcdef12-3456-7890-abcd-ef1234567890', description='Not enough coverage for this shift')
    """

    def _handler(
        req: "OperationRequest[capo_connectscheduling.types.reject_time_off_request.RejectTimeOffRequest]",
    ) -> OperationResponse[
        "capo_connectscheduling.types.reject_time_off_response.RejectTimeOffResponse"
    ]:
        import capo_connectscheduling._operations.amazon_connect_scheduling.reject_time_off

        output, http_response = (
            capo_connectscheduling._operations.amazon_connect_scheduling.reject_time_off.reject_time_off(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_connectscheduling.types.reject_time_off_request.RejectTimeOffRequest",
    ) -> dict[str, Any]:
        import capo_connectscheduling.types.reject_time_off_request

        return (
            capo_connectscheduling.types.reject_time_off_request.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("RejectTimeOff", redact_input=_redact_input),
    )
    input_: capo_connectscheduling.types.reject_time_off_request.RejectTimeOffRequest = {
        "instance_id": instance_id,
        "user_id": user_id,
        "time_off_id": time_off_id,
    }
    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