aws_sdk_location/operation/batch_evaluate_geofences/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::batch_evaluate_geofences::_batch_evaluate_geofences_output::BatchEvaluateGeofencesOutputBuilder;
3
4pub use crate::operation::batch_evaluate_geofences::_batch_evaluate_geofences_input::BatchEvaluateGeofencesInputBuilder;
5
6impl crate::operation::batch_evaluate_geofences::builders::BatchEvaluateGeofencesInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.batch_evaluate_geofences();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `BatchEvaluateGeofences`.
24///
25/// <p>Evaluates device positions against the geofence geometries from a given geofence collection.</p>
26/// <p>This operation always returns an empty response because geofences are asynchronously evaluated. The evaluation determines if the device has entered or exited a geofenced area, and then publishes one of the following events to Amazon EventBridge:</p>
27/// <ul>
28/// <li>
29/// <p><code>ENTER</code> if Amazon Location determines that the tracked device has entered a geofenced area.</p></li>
30/// <li>
31/// <p><code>EXIT</code> if Amazon Location determines that the tracked device has exited a geofenced area.</p></li>
32/// </ul><note>
33/// <p>The last geofence that a device was observed within is tracked for 30 days after the most recent device position update.</p>
34/// </note> <note>
35/// <p>Geofence evaluation uses the given device position. It does not account for the optional <code>Accuracy</code> of a <code>DevicePositionUpdate</code>.</p>
36/// </note> <note>
37/// <p>The <code>DeviceID</code> is used as a string to represent the device. You do not need to have a <code>Tracker</code> associated with the <code>DeviceID</code>.</p>
38/// </note>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct BatchEvaluateGeofencesFluentBuilder {
41    handle: ::std::sync::Arc<crate::client::Handle>,
42    inner: crate::operation::batch_evaluate_geofences::builders::BatchEvaluateGeofencesInputBuilder,
43    config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46    crate::client::customize::internal::CustomizableSend<
47        crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesOutput,
48        crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesError,
49    > for BatchEvaluateGeofencesFluentBuilder
50{
51    fn send(
52        self,
53        config_override: crate::config::Builder,
54    ) -> crate::client::customize::internal::BoxFuture<
55        crate::client::customize::internal::SendResult<
56            crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesOutput,
57            crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesError,
58        >,
59    > {
60        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61    }
62}
63impl BatchEvaluateGeofencesFluentBuilder {
64    /// Creates a new `BatchEvaluateGeofencesFluentBuilder`.
65    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66        Self {
67            handle,
68            inner: ::std::default::Default::default(),
69            config_override: ::std::option::Option::None,
70        }
71    }
72    /// Access the BatchEvaluateGeofences as a reference.
73    pub fn as_input(&self) -> &crate::operation::batch_evaluate_geofences::builders::BatchEvaluateGeofencesInputBuilder {
74        &self.inner
75    }
76    /// Sends the request and returns the response.
77    ///
78    /// If an error occurs, an `SdkError` will be returned with additional details that
79    /// can be matched against.
80    ///
81    /// By default, any retryable failures will be retried twice. Retry behavior
82    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83    /// set when configuring the client.
84    pub async fn send(
85        self,
86    ) -> ::std::result::Result<
87        crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesOutput,
88        ::aws_smithy_runtime_api::client::result::SdkError<
89            crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesError,
90            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91        >,
92    > {
93        let input = self
94            .inner
95            .build()
96            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97        let runtime_plugins = crate::operation::batch_evaluate_geofences::BatchEvaluateGeofences::operation_runtime_plugins(
98            self.handle.runtime_plugins.clone(),
99            &self.handle.conf,
100            self.config_override,
101        );
102        crate::operation::batch_evaluate_geofences::BatchEvaluateGeofences::orchestrate(&runtime_plugins, input).await
103    }
104
105    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106    pub fn customize(
107        self,
108    ) -> crate::client::customize::CustomizableOperation<
109        crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesOutput,
110        crate::operation::batch_evaluate_geofences::BatchEvaluateGeofencesError,
111        Self,
112    > {
113        crate::client::customize::CustomizableOperation::new(self)
114    }
115    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116        self.set_config_override(::std::option::Option::Some(config_override.into()));
117        self
118    }
119
120    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121        self.config_override = config_override;
122        self
123    }
124    /// <p>The geofence collection used in evaluating the position of devices against its geofences.</p>
125    pub fn collection_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126        self.inner = self.inner.collection_name(input.into());
127        self
128    }
129    /// <p>The geofence collection used in evaluating the position of devices against its geofences.</p>
130    pub fn set_collection_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131        self.inner = self.inner.set_collection_name(input);
132        self
133    }
134    /// <p>The geofence collection used in evaluating the position of devices against its geofences.</p>
135    pub fn get_collection_name(&self) -> &::std::option::Option<::std::string::String> {
136        self.inner.get_collection_name()
137    }
138    ///
139    /// Appends an item to `DevicePositionUpdates`.
140    ///
141    /// To override the contents of this collection use [`set_device_position_updates`](Self::set_device_position_updates).
142    ///
143    /// <p>Contains device details for each device to be evaluated against the given geofence collection.</p>
144    pub fn device_position_updates(mut self, input: crate::types::DevicePositionUpdate) -> Self {
145        self.inner = self.inner.device_position_updates(input);
146        self
147    }
148    /// <p>Contains device details for each device to be evaluated against the given geofence collection.</p>
149    pub fn set_device_position_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DevicePositionUpdate>>) -> Self {
150        self.inner = self.inner.set_device_position_updates(input);
151        self
152    }
153    /// <p>Contains device details for each device to be evaluated against the given geofence collection.</p>
154    pub fn get_device_position_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DevicePositionUpdate>> {
155        self.inner.get_device_position_updates()
156    }
157}