aws-sdk-location 0.26.0

AWS SDK for Amazon Location Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_geofence::_put_geofence_output::PutGeofenceOutputBuilder;

pub use crate::operation::put_geofence::_put_geofence_input::PutGeofenceInputBuilder;

/// Fluent builder constructing a request to `PutGeofence`.
///
/// <p>Stores a geofence geometry in a given geofence collection, or updates the geometry of an existing geofence if a geofence ID is included in the request. </p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct PutGeofenceFluentBuilder {
    handle: std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::put_geofence::builders::PutGeofenceInputBuilder,
}
impl PutGeofenceFluentBuilder {
    /// Creates a new `PutGeofence`.
    pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: Default::default(),
        }
    }

    /// Consume this builder, creating a customizable operation that can be modified before being
    /// sent. The operation's inner [http::Request] can be modified as well.
    pub async fn customize(
        self,
    ) -> std::result::Result<
        crate::client::customize::CustomizableOperation<
            crate::operation::put_geofence::PutGeofence,
            aws_http::retry::AwsResponseRetryClassifier,
        >,
        aws_smithy_http::result::SdkError<crate::operation::put_geofence::PutGeofenceError>,
    > {
        let handle = self.handle.clone();
        let operation = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        Ok(crate::client::customize::CustomizableOperation { handle, operation })
    }

    /// 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::put_geofence::PutGeofenceOutput,
        aws_smithy_http::result::SdkError<crate::operation::put_geofence::PutGeofenceError>,
    > {
        let op = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&self.handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        self.handle.client.call(op).await
    }
    /// <p>The geofence collection to store the geofence in.</p>
    pub fn collection_name(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.collection_name(input.into());
        self
    }
    /// <p>The geofence collection to store the geofence in.</p>
    pub fn set_collection_name(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_collection_name(input);
        self
    }
    /// <p>An identifier for the geofence. For example, <code>ExampleGeofence-1</code>.</p>
    pub fn geofence_id(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.geofence_id(input.into());
        self
    }
    /// <p>An identifier for the geofence. For example, <code>ExampleGeofence-1</code>.</p>
    pub fn set_geofence_id(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_geofence_id(input);
        self
    }
    /// <p>Contains the details to specify the position of the geofence. Can be either a polygon or a circle. Including both will return a validation error.</p> <note>
    /// <p>Each <a href="https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html"> geofence polygon</a> can have a maximum of 1,000 vertices.</p>
    /// </note>
    pub fn geometry(mut self, input: crate::types::GeofenceGeometry) -> Self {
        self.inner = self.inner.geometry(input);
        self
    }
    /// <p>Contains the details to specify the position of the geofence. Can be either a polygon or a circle. Including both will return a validation error.</p> <note>
    /// <p>Each <a href="https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html"> geofence polygon</a> can have a maximum of 1,000 vertices.</p>
    /// </note>
    pub fn set_geometry(
        mut self,
        input: std::option::Option<crate::types::GeofenceGeometry>,
    ) -> Self {
        self.inner = self.inner.set_geometry(input);
        self
    }
}