aws-sdk-swf 1.103.0

AWS SDK for Amazon Simple Workflow Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::record_activity_task_heartbeat::_record_activity_task_heartbeat_input::RecordActivityTaskHeartbeatInputBuilder;

pub use crate::operation::record_activity_task_heartbeat::_record_activity_task_heartbeat_output::RecordActivityTaskHeartbeatOutputBuilder;

impl crate::operation::record_activity_task_heartbeat::builders::RecordActivityTaskHeartbeatInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.record_activity_task_heartbeat();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `RecordActivityTaskHeartbeat`.
///
/// <p>Used by activity workers to report to the service that the <code>ActivityTask</code> represented by the specified <code>taskToken</code> is still making progress. The worker can also specify details of the progress, for example percent complete, using the <code>details</code> parameter. This action can also be used by the worker as a mechanism to check if cancellation is being requested for the activity task. If a cancellation is being attempted for the specified task, then the boolean <code>cancelRequested</code> flag returned by the service is set to <code>true</code>.</p>
/// <p>This action resets the <code>taskHeartbeatTimeout</code> clock. The <code>taskHeartbeatTimeout</code> is specified in <code>RegisterActivityType</code>.</p>
/// <p>This action doesn't in itself create an event in the workflow execution history. However, if the task times out, the workflow execution history contains a <code>ActivityTaskTimedOut</code> event that contains the information from the last heartbeat generated by the activity worker.</p><note>
/// <p>The <code>taskStartToCloseTimeout</code> of an activity type is the maximum duration of an activity task, regardless of the number of <code>RecordActivityTaskHeartbeat</code> requests received. The <code>taskStartToCloseTimeout</code> is also specified in <code>RegisterActivityType</code>.</p>
/// </note> <note>
/// <p>This operation is only useful for long-lived activities to report liveliness of the task and to determine if a cancellation is being attempted.</p>
/// </note> <important>
/// <p>If the <code>cancelRequested</code> flag returns <code>true</code>, a cancellation is being attempted. If the worker can cancel the activity, it should respond with <code>RespondActivityTaskCanceled</code>. Otherwise, it should ignore the cancellation request.</p>
/// </important>
/// <p><b>Access Control</b></p>
/// <p>You can use IAM policies to control this action's access to Amazon SWF resources as follows:</p>
/// <ul>
/// <li>
/// <p>Use a <code>Resource</code> element with the domain name to limit the action to only specified domains.</p></li>
/// <li>
/// <p>Use an <code>Action</code> element to allow or deny permission to call this action.</p></li>
/// <li>
/// <p>You cannot use an IAM policy to constrain this action's parameters.</p></li>
/// </ul>
/// <p>If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>. For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct RecordActivityTaskHeartbeatFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::record_activity_task_heartbeat::builders::RecordActivityTaskHeartbeatInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatOutput,
        crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatError,
    > for RecordActivityTaskHeartbeatFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatOutput,
            crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl RecordActivityTaskHeartbeatFluentBuilder {
    /// Creates a new `RecordActivityTaskHeartbeatFluentBuilder`.
    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 RecordActivityTaskHeartbeat as a reference.
    pub fn as_input(&self) -> &crate::operation::record_activity_task_heartbeat::builders::RecordActivityTaskHeartbeatInputBuilder {
        &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::record_activity_task_heartbeat::RecordActivityTaskHeartbeatOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatError,
            ::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::record_activity_task_heartbeat::RecordActivityTaskHeartbeat::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeat::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::record_activity_task_heartbeat::RecordActivityTaskHeartbeatOutput,
        crate::operation::record_activity_task_heartbeat::RecordActivityTaskHeartbeatError,
        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 <code>taskToken</code> of the <code>ActivityTask</code>.</p><important>
    /// <p><code>taskToken</code> is generated by the service and should be treated as an opaque value. If the task is passed to another process, its <code>taskToken</code> must also be passed. This enables it to provide its progress and respond with results.</p>
    /// </important>
    pub fn task_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.task_token(input.into());
        self
    }
    /// <p>The <code>taskToken</code> of the <code>ActivityTask</code>.</p><important>
    /// <p><code>taskToken</code> is generated by the service and should be treated as an opaque value. If the task is passed to another process, its <code>taskToken</code> must also be passed. This enables it to provide its progress and respond with results.</p>
    /// </important>
    pub fn set_task_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_task_token(input);
        self
    }
    /// <p>The <code>taskToken</code> of the <code>ActivityTask</code>.</p><important>
    /// <p><code>taskToken</code> is generated by the service and should be treated as an opaque value. If the task is passed to another process, its <code>taskToken</code> must also be passed. This enables it to provide its progress and respond with results.</p>
    /// </important>
    pub fn get_task_token(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_task_token()
    }
    /// <p>If specified, contains details about the progress of the task.</p>
    pub fn details(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.details(input.into());
        self
    }
    /// <p>If specified, contains details about the progress of the task.</p>
    pub fn set_details(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_details(input);
        self
    }
    /// <p>If specified, contains details about the progress of the task.</p>
    pub fn get_details(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_details()
    }
}