// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::create_time_off::_create_time_off_input::CreateTimeOffInputBuilder;
pub use crate::operation::create_time_off::_create_time_off_output::CreateTimeOffOutputBuilder;
impl crate::operation::create_time_off::builders::CreateTimeOffInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::create_time_off::CreateTimeOffOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_time_off::CreateTimeOffError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.create_time_off();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `CreateTimeOff`.
///
/// <p>Creates a time off request for a user. You don't provide a status, because Connect Customer owns the request lifecycle. To get the decided status, call <code>GetTimeOff</code> or use the time off state-change events.</p>
/// <p><code>ApprovalType</code> controls who approves the request. You can specify one of the following values:</p>
/// <ul>
/// <li>
/// <p><code>AWAIT_APPROVAL</code>: the request waits in <code>AWAITING_APPROVAL</code> until you call <code>ApproveTimeOff</code> or <code>RejectTimeOff</code>. Rule evaluation and the overlap check run at approval, not at creation. A waiting request doesn't reserve its window, so another request for the same window can be approved first.</p></li>
/// <li>
/// <p><code>AUTOMATIC</code>: Connect Customer evaluates the rules (time off balances and group allowances) and decides the request. The request can be <code>PENDING</code> while Connect Customer decides, and then ends <code>APPROVED</code> or <code>REJECTED</code>. If it overlaps another time off request for the user, the requested time off ends <code>REJECTED</code> with <code>CONFLICTING_TIME_OFF_REQUEST</code>. It also ends <code>REJECTED</code> if it overlaps overtime or voluntary time off. If the whole window is in the past, Connect Customer records failed rules as <code>WARNING</code> and doesn't reject the request, whatever the <code>RuleFailureAction</code>.</p></li>
/// </ul>
/// <p>The staffing group's <i>Supervisor approval needed</i> setting doesn't apply to this operation. <code>ApprovalType</code> alone decides whether the request waits for approval. The operation fails with <code>ValidationException</code> on <code>UserId</code> in the following cases:</p>
/// <ul>
/// <li>
/// <p>The user isn't in a staffing group, or the staffing group isn't associated with a forecast group.</p></li>
/// <li>
/// <p>Time off isn't <a href="https://docs.aws.amazon.com/connect/latest/adminguide/enable-to.html">enabled</a> for the user's staffing group, or the user's staff rules don't allow time off.</p></li>
/// </ul>
/// <p>To change the dates of a request, cancel it with <code>CancelTimeOff</code> and create a new request. The new request has a new <code>TimeOffId</code>.</p><note>
/// <p>Connect Customer doesn't check whether the principal that calls this operation supervises the user. The staffing group's approval settings also don't apply. IAM permissions are the only control. If you allow a principal to call this operation, that principal can send <code>ApprovalType</code> <code>AUTOMATIC</code> with <code>RuleFailureAction</code> <code>OVERRIDE</code> and approve a request past failed rules. Grant permission for this operation only to principals that you trust to override time off rules.</p>
/// </note>
/// <p>For information about time off in the Connect Customer admin website, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/scheduling-time-off.html">Time off management</a> in the <i>Connect Customer Administrator Guide</i>.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CreateTimeOffFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::create_time_off::builders::CreateTimeOffInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::create_time_off::CreateTimeOffOutput,
crate::operation::create_time_off::CreateTimeOffError,
> for CreateTimeOffFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::create_time_off::CreateTimeOffOutput,
crate::operation::create_time_off::CreateTimeOffError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl CreateTimeOffFluentBuilder {
/// Creates a new `CreateTimeOffFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the CreateTimeOff as a reference.
pub fn as_input(&self) -> &crate::operation::create_time_off::builders::CreateTimeOffInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::create_time_off::CreateTimeOffOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_time_off::CreateTimeOffError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::create_time_off::CreateTimeOff::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::create_time_off::CreateTimeOff::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::create_time_off::CreateTimeOffOutput,
crate::operation::create_time_off::CreateTimeOffError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <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>
pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.instance_id(input.into());
self
}
/// <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>
pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_instance_id(input);
self
}
/// <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>
pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_instance_id()
}
/// <p>The identifier of the user who the time off request is for. This can be the ID or the ARN of the user.</p>
pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.user_id(input.into());
self
}
/// <p>The identifier of the user who the time off request is for. This can be the ID or the ARN of the user.</p>
pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_user_id(input);
self
}
/// <p>The identifier of the user who the time off request is for. This can be the ID or the ARN of the user.</p>
pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_user_id()
}
/// <p>The identifier of the shift activity that defines the type of time off being requested. This can be the ID or the ARN of the shift activity. It must be a time off activity. Activities that aren't set as <i>Requestable</i> are accepted.</p>
pub fn shift_activity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.shift_activity_id(input.into());
self
}
/// <p>The identifier of the shift activity that defines the type of time off being requested. This can be the ID or the ARN of the shift activity. It must be a time off activity. Activities that aren't set as <i>Requestable</i> are accepted.</p>
pub fn set_shift_activity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_shift_activity_id(input);
self
}
/// <p>The identifier of the shift activity that defines the type of time off being requested. This can be the ID or the ARN of the shift activity. It must be a time off activity. Activities that aren't set as <i>Requestable</i> are accepted.</p>
pub fn get_shift_activity_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_shift_activity_id()
}
/// <p>The start of the time off window, inclusive. It must be no earlier than one year before the current date. Connect Customer stores the value as sent, to the millisecond.</p>
pub fn start_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.inner = self.inner.start_at(input);
self
}
/// <p>The start of the time off window, inclusive. It must be no earlier than one year before the current date. Connect Customer stores the value as sent, to the millisecond.</p>
pub fn set_start_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.inner = self.inner.set_start_at(input);
self
}
/// <p>The start of the time off window, inclusive. It must be no earlier than one year before the current date. Connect Customer stores the value as sent, to the millisecond.</p>
pub fn get_start_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
self.inner.get_start_at()
}
/// <p>The end of the time off window, exclusive. It must be after <code>StartAt</code> and no later than 24 months after the current date. Connect Customer stores the value as sent, to the millisecond.</p>
pub fn end_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.inner = self.inner.end_at(input);
self
}
/// <p>The end of the time off window, exclusive. It must be after <code>StartAt</code> and no later than 24 months after the current date. Connect Customer stores the value as sent, to the millisecond.</p>
pub fn set_end_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.inner = self.inner.set_end_at(input);
self
}
/// <p>The end of the time off window, exclusive. It must be after <code>StartAt</code> and no later than 24 months after the current date. Connect Customer stores the value as sent, to the millisecond.</p>
pub fn get_end_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
self.inner.get_end_at()
}
/// <p>A description recorded on the time off request. If you omit it, the request has no description.</p>
pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.description(input.into());
self
}
/// <p>A description recorded on the time off request. If you omit it, the request has no description.</p>
pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_description(input);
self
}
/// <p>A description recorded on the time off request. If you omit it, the request has no description.</p>
pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_description()
}
/// <p>Controls who approves the request. <code>AWAIT_APPROVAL</code> waits for an <code>ApproveTimeOff</code> or <code>RejectTimeOff</code> call. <code>AUTOMATIC</code> has Connect Customer decide the request. For details, see <code>CreateTimeOff</code>.</p>
pub fn approval_type(mut self, input: crate::types::ApprovalType) -> Self {
self.inner = self.inner.approval_type(input);
self
}
/// <p>Controls who approves the request. <code>AWAIT_APPROVAL</code> waits for an <code>ApproveTimeOff</code> or <code>RejectTimeOff</code> call. <code>AUTOMATIC</code> has Connect Customer decide the request. For details, see <code>CreateTimeOff</code>.</p>
pub fn set_approval_type(mut self, input: ::std::option::Option<crate::types::ApprovalType>) -> Self {
self.inner = self.inner.set_approval_type(input);
self
}
/// <p>Controls who approves the request. <code>AWAIT_APPROVAL</code> waits for an <code>ApproveTimeOff</code> or <code>RejectTimeOff</code> call. <code>AUTOMATIC</code> has Connect Customer decide the request. For details, see <code>CreateTimeOff</code>.</p>
pub fn get_approval_type(&self) -> &::std::option::Option<crate::types::ApprovalType> {
self.inner.get_approval_type()
}
/// <p>Controls what happens when a configured rule fails. <code>REJECT</code>, the default, records an <code>ERROR</code> and ends the request <code>REJECTED</code>, unless the whole window is in the past. <code>OVERRIDE</code> records a <code>WARNING</code> and ends the request <code>APPROVED</code>, like the <i>Override time off rules</i> option in the Connect Customer admin website. <code>OVERRIDE</code> requires <code>AUTOMATIC</code>. With <code>AWAIT_APPROVAL</code>, <code>OVERRIDE</code> fails with <code>ValidationException</code>. Set it on <code>ApproveTimeOff</code> instead. <code>OVERRIDE</code> never waives <code>CONFLICTING_TIME_OFF_REQUEST</code>.</p>
pub fn rule_failure_action(mut self, input: crate::types::RuleFailureAction) -> Self {
self.inner = self.inner.rule_failure_action(input);
self
}
/// <p>Controls what happens when a configured rule fails. <code>REJECT</code>, the default, records an <code>ERROR</code> and ends the request <code>REJECTED</code>, unless the whole window is in the past. <code>OVERRIDE</code> records a <code>WARNING</code> and ends the request <code>APPROVED</code>, like the <i>Override time off rules</i> option in the Connect Customer admin website. <code>OVERRIDE</code> requires <code>AUTOMATIC</code>. With <code>AWAIT_APPROVAL</code>, <code>OVERRIDE</code> fails with <code>ValidationException</code>. Set it on <code>ApproveTimeOff</code> instead. <code>OVERRIDE</code> never waives <code>CONFLICTING_TIME_OFF_REQUEST</code>.</p>
pub fn set_rule_failure_action(mut self, input: ::std::option::Option<crate::types::RuleFailureAction>) -> Self {
self.inner = self.inner.set_rule_failure_action(input);
self
}
/// <p>Controls what happens when a configured rule fails. <code>REJECT</code>, the default, records an <code>ERROR</code> and ends the request <code>REJECTED</code>, unless the whole window is in the past. <code>OVERRIDE</code> records a <code>WARNING</code> and ends the request <code>APPROVED</code>, like the <i>Override time off rules</i> option in the Connect Customer admin website. <code>OVERRIDE</code> requires <code>AUTOMATIC</code>. With <code>AWAIT_APPROVAL</code>, <code>OVERRIDE</code> fails with <code>ValidationException</code>. Set it on <code>ApproveTimeOff</code> instead. <code>OVERRIDE</code> never waives <code>CONFLICTING_TIME_OFF_REQUEST</code>.</p>
pub fn get_rule_failure_action(&self) -> &::std::option::Option<crate::types::RuleFailureAction> {
self.inner.get_rule_failure_action()
}
/// <p>A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request, Connect Customer returns the result of that request and doesn't create another time off request. If you don't provide a token, the AWS SDK populates this field. If you reuse a client token with a different request body, the request fails with <code>ValidationException</code>. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.client_token(input.into());
self
}
/// <p>A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request, Connect Customer returns the result of that request and doesn't create another time off request. If you don't provide a token, the AWS SDK populates this field. If you reuse a client token with a different request body, the request fails with <code>ValidationException</code>. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_client_token(input);
self
}
/// <p>A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request, Connect Customer returns the result of that request and doesn't create another time off request. If you don't provide a token, the AWS SDK populates this field. If you reuse a client token with a different request body, the request fails with <code>ValidationException</code>. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_client_token()
}
}