Sets the time off balance for one user and shift activity. The value replaces the existing balance rather than adjusting it, so you can safely retry the call. This operation can't remove a balance. To remove one, upload a blank balance in the Connect Customer admin website. For more information, see Import an agent's time off balance in the Connect Customer Administrator Guide.
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 whose balance is being updated. This can be the ID or the ARN of the user.
-
shift_activity_id
(ShiftActivityIdOrArn)
–
The identifier of the shift activity that the balance applies to. This can be the ID or the ARN of the shift activity.
-
balance
(Duration)
–
The new time off balance for the user and activity. It replaces the existing balance.
Raises:
Examples:
To set a user's time off balance
The following example sets a user's balance for one time off activity to 80 hours, replacing any existing balance.
>>> client.put_time_off_balance(instance_id='12345678-1234-1234-1234-123456789012', user_id='87654321-4321-4321-4321-210987654321', shift_activity_id='11112222-3333-4444-5555-666677778888', balance={'Value': 80, 'Unit': 'HOURS'})
Source code in docs_src/capo_connectscheduling/_services/connect_scheduling.py
| def put_time_off_balance(
self,
instance_id: "capo_connectscheduling.types.instance_id_or_arn.InstanceIdOrArn",
user_id: "capo_connectscheduling.types.user_id_or_arn.UserIdOrArn",
shift_activity_id: "capo_connectscheduling.types.shift_activity_id_or_arn.ShiftActivityIdOrArn",
balance: "capo_connectscheduling.types.duration.Duration",
*,
config_overrides: Optional[ConnectSchedulingClientConfig] = None,
) -> "capo_connectscheduling.types.put_time_off_balance_response.PutTimeOffBalanceResponse":
"""<p>Sets the time off balance for one user and shift activity. The value replaces the existing balance rather than adjusting it, so you can safely retry the call. This operation can't remove a balance. To remove one, upload a blank balance in the Connect Customer admin website. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/upload-timeoff-balance.html">Import an agent's time off balance</a> in the <i>Connect Customer Administrator Guide</i>.</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 whose balance is being updated. This can be the ID or the ARN of the user.</p>
shift_activity_id: <p>The identifier of the shift activity that the balance applies to. This can be the ID or the ARN of the shift activity.</p>
balance: <p>The new time off balance for the user and activity. It replaces the existing balance.</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 set a user's time off balance
The following example sets a user's balance for one time off activity to 80 hours, replacing any existing balance.
>>> client.put_time_off_balance(instance_id='12345678-1234-1234-1234-123456789012', user_id='87654321-4321-4321-4321-210987654321', shift_activity_id='11112222-3333-4444-5555-666677778888', balance={'Value': 80, 'Unit': 'HOURS'})
"""
def _handler(
req: "OperationRequest[capo_connectscheduling.types.put_time_off_balance_request.PutTimeOffBalanceRequest]",
) -> OperationResponse[
"capo_connectscheduling.types.put_time_off_balance_response.PutTimeOffBalanceResponse"
]:
import capo_connectscheduling._operations.amazon_connect_scheduling.put_time_off_balance
output, http_response = (
capo_connectscheduling._operations.amazon_connect_scheduling.put_time_off_balance.put_time_off_balance(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutTimeOffBalance")
)
input_: capo_connectscheduling.types.put_time_off_balance_request.PutTimeOffBalanceRequest = {
"instance_id": instance_id,
"user_id": user_id,
"shift_activity_id": shift_activity_id,
"balance": balance,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|