aws-sdk-location 0.31.0

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

/// <p>Returns the result of the route calculation. Metadata includes legs and route summary.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CalculateRouteOutput {
    /// <p>Contains details about each path between a pair of positions included along a route such as: <code>StartPosition</code>, <code>EndPosition</code>, <code>Distance</code>, <code>DurationSeconds</code>, <code>Geometry</code>, and <code>Steps</code>. The number of legs returned corresponds to one fewer than the total number of positions in the request. </p>
    /// <p>For example, a route with a departure position and destination position returns one leg with the positions <a href="https://docs.aws.amazon.com/location/latest/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>:</p>
    /// <ul>
    /// <li> <p>The <code>StartPosition</code> is the departure position.</p> </li>
    /// <li> <p>The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    /// <p>A route with a waypoint between the departure and destination position returns two legs with the positions snapped to a nearby road:</p>
    /// <ul>
    /// <li> <p>Leg 1: The <code>StartPosition</code> is the departure position . The <code>EndPosition</code> is the waypoint positon.</p> </li>
    /// <li> <p>Leg 2: The <code>StartPosition</code> is the waypoint position. The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    pub legs: ::std::option::Option<::std::vec::Vec<crate::types::Leg>>,
    /// <p>Contains information about the whole route, such as: <code>RouteBBox</code>, <code>DataSource</code>, <code>Distance</code>, <code>DistanceUnit</code>, and <code>DurationSeconds</code>.</p>
    pub summary: ::std::option::Option<crate::types::CalculateRouteSummary>,
    _request_id: Option<String>,
}
impl CalculateRouteOutput {
    /// <p>Contains details about each path between a pair of positions included along a route such as: <code>StartPosition</code>, <code>EndPosition</code>, <code>Distance</code>, <code>DurationSeconds</code>, <code>Geometry</code>, and <code>Steps</code>. The number of legs returned corresponds to one fewer than the total number of positions in the request. </p>
    /// <p>For example, a route with a departure position and destination position returns one leg with the positions <a href="https://docs.aws.amazon.com/location/latest/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>:</p>
    /// <ul>
    /// <li> <p>The <code>StartPosition</code> is the departure position.</p> </li>
    /// <li> <p>The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    /// <p>A route with a waypoint between the departure and destination position returns two legs with the positions snapped to a nearby road:</p>
    /// <ul>
    /// <li> <p>Leg 1: The <code>StartPosition</code> is the departure position . The <code>EndPosition</code> is the waypoint positon.</p> </li>
    /// <li> <p>Leg 2: The <code>StartPosition</code> is the waypoint position. The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    pub fn legs(&self) -> ::std::option::Option<&[crate::types::Leg]> {
        self.legs.as_deref()
    }
    /// <p>Contains information about the whole route, such as: <code>RouteBBox</code>, <code>DataSource</code>, <code>Distance</code>, <code>DistanceUnit</code>, and <code>DurationSeconds</code>.</p>
    pub fn summary(&self) -> ::std::option::Option<&crate::types::CalculateRouteSummary> {
        self.summary.as_ref()
    }
}
impl ::aws_http::request_id::RequestId for CalculateRouteOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl CalculateRouteOutput {
    /// Creates a new builder-style object to manufacture [`CalculateRouteOutput`](crate::operation::calculate_route::CalculateRouteOutput).
    pub fn builder() -> crate::operation::calculate_route::builders::CalculateRouteOutputBuilder {
        crate::operation::calculate_route::builders::CalculateRouteOutputBuilder::default()
    }
}

/// A builder for [`CalculateRouteOutput`](crate::operation::calculate_route::CalculateRouteOutput).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct CalculateRouteOutputBuilder {
    pub(crate) legs: ::std::option::Option<::std::vec::Vec<crate::types::Leg>>,
    pub(crate) summary: ::std::option::Option<crate::types::CalculateRouteSummary>,
    _request_id: Option<String>,
}
impl CalculateRouteOutputBuilder {
    /// Appends an item to `legs`.
    ///
    /// To override the contents of this collection use [`set_legs`](Self::set_legs).
    ///
    /// <p>Contains details about each path between a pair of positions included along a route such as: <code>StartPosition</code>, <code>EndPosition</code>, <code>Distance</code>, <code>DurationSeconds</code>, <code>Geometry</code>, and <code>Steps</code>. The number of legs returned corresponds to one fewer than the total number of positions in the request. </p>
    /// <p>For example, a route with a departure position and destination position returns one leg with the positions <a href="https://docs.aws.amazon.com/location/latest/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>:</p>
    /// <ul>
    /// <li> <p>The <code>StartPosition</code> is the departure position.</p> </li>
    /// <li> <p>The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    /// <p>A route with a waypoint between the departure and destination position returns two legs with the positions snapped to a nearby road:</p>
    /// <ul>
    /// <li> <p>Leg 1: The <code>StartPosition</code> is the departure position . The <code>EndPosition</code> is the waypoint positon.</p> </li>
    /// <li> <p>Leg 2: The <code>StartPosition</code> is the waypoint position. The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    pub fn legs(mut self, input: crate::types::Leg) -> Self {
        let mut v = self.legs.unwrap_or_default();
        v.push(input);
        self.legs = ::std::option::Option::Some(v);
        self
    }
    /// <p>Contains details about each path between a pair of positions included along a route such as: <code>StartPosition</code>, <code>EndPosition</code>, <code>Distance</code>, <code>DurationSeconds</code>, <code>Geometry</code>, and <code>Steps</code>. The number of legs returned corresponds to one fewer than the total number of positions in the request. </p>
    /// <p>For example, a route with a departure position and destination position returns one leg with the positions <a href="https://docs.aws.amazon.com/location/latest/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>:</p>
    /// <ul>
    /// <li> <p>The <code>StartPosition</code> is the departure position.</p> </li>
    /// <li> <p>The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    /// <p>A route with a waypoint between the departure and destination position returns two legs with the positions snapped to a nearby road:</p>
    /// <ul>
    /// <li> <p>Leg 1: The <code>StartPosition</code> is the departure position . The <code>EndPosition</code> is the waypoint positon.</p> </li>
    /// <li> <p>Leg 2: The <code>StartPosition</code> is the waypoint position. The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    pub fn set_legs(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Leg>>) -> Self {
        self.legs = input;
        self
    }
    /// <p>Contains details about each path between a pair of positions included along a route such as: <code>StartPosition</code>, <code>EndPosition</code>, <code>Distance</code>, <code>DurationSeconds</code>, <code>Geometry</code>, and <code>Steps</code>. The number of legs returned corresponds to one fewer than the total number of positions in the request. </p>
    /// <p>For example, a route with a departure position and destination position returns one leg with the positions <a href="https://docs.aws.amazon.com/location/latest/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>:</p>
    /// <ul>
    /// <li> <p>The <code>StartPosition</code> is the departure position.</p> </li>
    /// <li> <p>The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    /// <p>A route with a waypoint between the departure and destination position returns two legs with the positions snapped to a nearby road:</p>
    /// <ul>
    /// <li> <p>Leg 1: The <code>StartPosition</code> is the departure position . The <code>EndPosition</code> is the waypoint positon.</p> </li>
    /// <li> <p>Leg 2: The <code>StartPosition</code> is the waypoint position. The <code>EndPosition</code> is the destination position.</p> </li>
    /// </ul>
    pub fn get_legs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Leg>> {
        &self.legs
    }
    /// <p>Contains information about the whole route, such as: <code>RouteBBox</code>, <code>DataSource</code>, <code>Distance</code>, <code>DistanceUnit</code>, and <code>DurationSeconds</code>.</p>
    pub fn summary(mut self, input: crate::types::CalculateRouteSummary) -> Self {
        self.summary = ::std::option::Option::Some(input);
        self
    }
    /// <p>Contains information about the whole route, such as: <code>RouteBBox</code>, <code>DataSource</code>, <code>Distance</code>, <code>DistanceUnit</code>, and <code>DurationSeconds</code>.</p>
    pub fn set_summary(mut self, input: ::std::option::Option<crate::types::CalculateRouteSummary>) -> Self {
        self.summary = input;
        self
    }
    /// <p>Contains information about the whole route, such as: <code>RouteBBox</code>, <code>DataSource</code>, <code>Distance</code>, <code>DistanceUnit</code>, and <code>DurationSeconds</code>.</p>
    pub fn get_summary(&self) -> &::std::option::Option<crate::types::CalculateRouteSummary> {
        &self.summary
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`CalculateRouteOutput`](crate::operation::calculate_route::CalculateRouteOutput).
    pub fn build(self) -> crate::operation::calculate_route::CalculateRouteOutput {
        crate::operation::calculate_route::CalculateRouteOutput {
            legs: self.legs,
            summary: self.summary,
            _request_id: self._request_id,
        }
    }
}