Skip to main content

aws_sdk_location/types/
_route_matrix_entry_error.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An error corresponding to the calculation of a route between the <code>DeparturePosition</code> and <code>DestinationPosition</code>.</p>
4/// <p>The error code can be one of the following:</p>
5/// <ul>
6/// <li>
7/// <p><code>RouteNotFound</code> - Unable to find a valid route with the given parameters.</p></li>
8/// </ul>
9/// <ul>
10/// <li>
11/// <p><code>RouteTooLong</code> - Route calculation went beyond the maximum size of a route and was terminated before completion.</p></li>
12/// </ul>
13/// <ul>
14/// <li>
15/// <p><code>PositionsNotFound</code> - One or more of the input positions were not found on the route network.</p></li>
16/// </ul>
17/// <ul>
18/// <li>
19/// <p><code>DestinationPositionNotFound</code> - The destination position was not found on the route network.</p></li>
20/// </ul>
21/// <ul>
22/// <li>
23/// <p><code>DeparturePositionNotFound</code> - The departure position was not found on the route network.</p></li>
24/// </ul>
25/// <ul>
26/// <li>
27/// <p><code>OtherValidationError</code> - The given inputs were not valid or a route was not found. More information is given in the error <code>Message</code></p></li>
28/// </ul>
29#[non_exhaustive]
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
31pub struct RouteMatrixEntryError {
32    /// <p>The type of error which occurred for the route calculation.</p>
33    pub code: crate::types::RouteMatrixErrorCode,
34    /// <p>A message about the error that occurred for the route calculation.</p>
35    pub message: ::std::option::Option<::std::string::String>,
36}
37impl RouteMatrixEntryError {
38    /// <p>The type of error which occurred for the route calculation.</p>
39    pub fn code(&self) -> &crate::types::RouteMatrixErrorCode {
40        &self.code
41    }
42    /// <p>A message about the error that occurred for the route calculation.</p>
43    pub fn message(&self) -> ::std::option::Option<&str> {
44        self.message.as_deref()
45    }
46}
47impl RouteMatrixEntryError {
48    /// Creates a new builder-style object to manufacture [`RouteMatrixEntryError`](crate::types::RouteMatrixEntryError).
49    pub fn builder() -> crate::types::builders::RouteMatrixEntryErrorBuilder {
50        crate::types::builders::RouteMatrixEntryErrorBuilder::default()
51    }
52}
53
54/// A builder for [`RouteMatrixEntryError`](crate::types::RouteMatrixEntryError).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct RouteMatrixEntryErrorBuilder {
58    pub(crate) code: ::std::option::Option<crate::types::RouteMatrixErrorCode>,
59    pub(crate) message: ::std::option::Option<::std::string::String>,
60}
61impl RouteMatrixEntryErrorBuilder {
62    /// <p>The type of error which occurred for the route calculation.</p>
63    /// This field is required.
64    pub fn code(mut self, input: crate::types::RouteMatrixErrorCode) -> Self {
65        self.code = ::std::option::Option::Some(input);
66        self
67    }
68    /// <p>The type of error which occurred for the route calculation.</p>
69    pub fn set_code(mut self, input: ::std::option::Option<crate::types::RouteMatrixErrorCode>) -> Self {
70        self.code = input;
71        self
72    }
73    /// <p>The type of error which occurred for the route calculation.</p>
74    pub fn get_code(&self) -> &::std::option::Option<crate::types::RouteMatrixErrorCode> {
75        &self.code
76    }
77    /// <p>A message about the error that occurred for the route calculation.</p>
78    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79        self.message = ::std::option::Option::Some(input.into());
80        self
81    }
82    /// <p>A message about the error that occurred for the route calculation.</p>
83    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84        self.message = input;
85        self
86    }
87    /// <p>A message about the error that occurred for the route calculation.</p>
88    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
89        &self.message
90    }
91    /// Consumes the builder and constructs a [`RouteMatrixEntryError`](crate::types::RouteMatrixEntryError).
92    /// This method will fail if any of the following fields are not set:
93    /// - [`code`](crate::types::builders::RouteMatrixEntryErrorBuilder::code)
94    pub fn build(self) -> ::std::result::Result<crate::types::RouteMatrixEntryError, ::aws_smithy_types::error::operation::BuildError> {
95        ::std::result::Result::Ok(crate::types::RouteMatrixEntryError {
96            code: self.code.ok_or_else(|| {
97                ::aws_smithy_types::error::operation::BuildError::missing_field(
98                    "code",
99                    "code was not specified but it is required when building RouteMatrixEntryError",
100                )
101            })?,
102            message: self.message,
103        })
104    }
105}