Skip to content

cancel_time_off

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

Cancels a time off request.

Cancelling a CANCELLED request succeeds without a change. Returns ConflictException if the request is PENDING, which 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 cancel. If the time off request doesn't belong to UserId, the operation returns ResourceNotFoundException.

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

    A description recorded with the cancellation. It replaces the description of the time off request. If you omit it, the request's description is removed.

Raises:

Examples:

To cancel a time off request The following example cancels a time off request and records the reason on the cancellation.

>>> client.cancel_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='Plans changed')
Source code in docs_src/capo_connectscheduling/_services/connect_scheduling.py
def cancel_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.cancel_time_off_response.CancelTimeOffResponse":
    """<p>Cancels a time off request.</p> <p>Cancelling a <code>CANCELLED</code> request succeeds without a change. Returns <code>ConflictException</code> if the request is <code>PENDING</code>, which 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 cancel. 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 cancellation. It replaces the description of the time off request. If you omit it, the request's description is removed.</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 cancel a time off request
        The following example cancels a time off request and records the reason on the cancellation.

        >>> client.cancel_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='Plans changed')
    """

    def _handler(
        req: "OperationRequest[capo_connectscheduling.types.cancel_time_off_request.CancelTimeOffRequest]",
    ) -> OperationResponse[
        "capo_connectscheduling.types.cancel_time_off_response.CancelTimeOffResponse"
    ]:
        import capo_connectscheduling._operations.amazon_connect_scheduling.cancel_time_off

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

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

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

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CancelTimeOff", redact_input=_redact_input),
    )
    input_: capo_connectscheduling.types.cancel_time_off_request.CancelTimeOffRequest = {
        "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