aws_sdk_glue/operation/get_mapping/
_get_mapping_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetMappingOutput {
6    /// <p>A list of mappings to the specified targets.</p>
7    pub mapping: ::std::vec::Vec<crate::types::MappingEntry>,
8    _request_id: Option<String>,
9}
10impl GetMappingOutput {
11    /// <p>A list of mappings to the specified targets.</p>
12    pub fn mapping(&self) -> &[crate::types::MappingEntry] {
13        use std::ops::Deref;
14        self.mapping.deref()
15    }
16}
17impl ::aws_types::request_id::RequestId for GetMappingOutput {
18    fn request_id(&self) -> Option<&str> {
19        self._request_id.as_deref()
20    }
21}
22impl GetMappingOutput {
23    /// Creates a new builder-style object to manufacture [`GetMappingOutput`](crate::operation::get_mapping::GetMappingOutput).
24    pub fn builder() -> crate::operation::get_mapping::builders::GetMappingOutputBuilder {
25        crate::operation::get_mapping::builders::GetMappingOutputBuilder::default()
26    }
27}
28
29/// A builder for [`GetMappingOutput`](crate::operation::get_mapping::GetMappingOutput).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct GetMappingOutputBuilder {
33    pub(crate) mapping: ::std::option::Option<::std::vec::Vec<crate::types::MappingEntry>>,
34    _request_id: Option<String>,
35}
36impl GetMappingOutputBuilder {
37    /// Appends an item to `mapping`.
38    ///
39    /// To override the contents of this collection use [`set_mapping`](Self::set_mapping).
40    ///
41    /// <p>A list of mappings to the specified targets.</p>
42    pub fn mapping(mut self, input: crate::types::MappingEntry) -> Self {
43        let mut v = self.mapping.unwrap_or_default();
44        v.push(input);
45        self.mapping = ::std::option::Option::Some(v);
46        self
47    }
48    /// <p>A list of mappings to the specified targets.</p>
49    pub fn set_mapping(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MappingEntry>>) -> Self {
50        self.mapping = input;
51        self
52    }
53    /// <p>A list of mappings to the specified targets.</p>
54    pub fn get_mapping(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MappingEntry>> {
55        &self.mapping
56    }
57    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
58        self._request_id = Some(request_id.into());
59        self
60    }
61
62    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
63        self._request_id = request_id;
64        self
65    }
66    /// Consumes the builder and constructs a [`GetMappingOutput`](crate::operation::get_mapping::GetMappingOutput).
67    /// This method will fail if any of the following fields are not set:
68    /// - [`mapping`](crate::operation::get_mapping::builders::GetMappingOutputBuilder::mapping)
69    pub fn build(self) -> ::std::result::Result<crate::operation::get_mapping::GetMappingOutput, ::aws_smithy_types::error::operation::BuildError> {
70        ::std::result::Result::Ok(crate::operation::get_mapping::GetMappingOutput {
71            mapping: self.mapping.ok_or_else(|| {
72                ::aws_smithy_types::error::operation::BuildError::missing_field(
73                    "mapping",
74                    "mapping was not specified but it is required when building GetMappingOutput",
75                )
76            })?,
77            _request_id: self._request_id,
78        })
79    }
80}