aws-sdk-sagemakergeospatial 1.103.0

AWS SDK for Amazon SageMaker geospatial capabilities
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The structure representing a Geometry in terms of Type and Coordinates as per GeoJson spec.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Geometry {
    /// <p>GeoJson Geometry types like Polygon and MultiPolygon.</p>
    pub r#type: ::std::string::String,
    /// <p>The coordinates of the GeoJson Geometry.</p>
    pub coordinates: ::std::vec::Vec<::std::vec::Vec<::std::vec::Vec<f64>>>,
}
impl Geometry {
    /// <p>GeoJson Geometry types like Polygon and MultiPolygon.</p>
    pub fn r#type(&self) -> &str {
        use std::ops::Deref;
        self.r#type.deref()
    }
    /// <p>The coordinates of the GeoJson Geometry.</p>
    pub fn coordinates(&self) -> &[::std::vec::Vec<::std::vec::Vec<f64>>] {
        use std::ops::Deref;
        self.coordinates.deref()
    }
}
impl Geometry {
    /// Creates a new builder-style object to manufacture [`Geometry`](crate::types::Geometry).
    pub fn builder() -> crate::types::builders::GeometryBuilder {
        crate::types::builders::GeometryBuilder::default()
    }
}

/// A builder for [`Geometry`](crate::types::Geometry).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GeometryBuilder {
    pub(crate) r#type: ::std::option::Option<::std::string::String>,
    pub(crate) coordinates: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::vec::Vec<f64>>>>,
}
impl GeometryBuilder {
    /// <p>GeoJson Geometry types like Polygon and MultiPolygon.</p>
    /// This field is required.
    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.r#type = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>GeoJson Geometry types like Polygon and MultiPolygon.</p>
    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>GeoJson Geometry types like Polygon and MultiPolygon.</p>
    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.r#type
    }
    /// Appends an item to `coordinates`.
    ///
    /// To override the contents of this collection use [`set_coordinates`](Self::set_coordinates).
    ///
    /// <p>The coordinates of the GeoJson Geometry.</p>
    pub fn coordinates(mut self, input: ::std::vec::Vec<::std::vec::Vec<f64>>) -> Self {
        let mut v = self.coordinates.unwrap_or_default();
        v.push(input);
        self.coordinates = ::std::option::Option::Some(v);
        self
    }
    /// <p>The coordinates of the GeoJson Geometry.</p>
    pub fn set_coordinates(mut self, input: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::vec::Vec<f64>>>>) -> Self {
        self.coordinates = input;
        self
    }
    /// <p>The coordinates of the GeoJson Geometry.</p>
    pub fn get_coordinates(&self) -> &::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::vec::Vec<f64>>>> {
        &self.coordinates
    }
    /// Consumes the builder and constructs a [`Geometry`](crate::types::Geometry).
    /// This method will fail if any of the following fields are not set:
    /// - [`r#type`](crate::types::builders::GeometryBuilder::type)
    /// - [`coordinates`](crate::types::builders::GeometryBuilder::coordinates)
    pub fn build(self) -> ::std::result::Result<crate::types::Geometry, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Geometry {
            r#type: self.r#type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "r#type",
                    "r#type was not specified but it is required when building Geometry",
                )
            })?,
            coordinates: self.coordinates.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "coordinates",
                    "coordinates was not specified but it is required when building Geometry",
                )
            })?,
        })
    }
}