1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// 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::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) -> &[crate::types::Leg] {
use std::ops::Deref;
self.legs.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_types::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).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
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>
/// This field is required.
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).
/// This method will fail if any of the following fields are not set:
/// - [`legs`](crate::operation::calculate_route::builders::CalculateRouteOutputBuilder::legs)
pub fn build(
self,
) -> ::std::result::Result<crate::operation::calculate_route::CalculateRouteOutput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::calculate_route::CalculateRouteOutput {
legs: self.legs.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"legs",
"legs was not specified but it is required when building CalculateRouteOutput",
)
})?,
summary: self.summary,
_request_id: self._request_id,
})
}
}