aws_sdk_appsync/operation/create_api/
_create_api_input.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 CreateApiInput {
6    /// <p>The name for the <code>Api</code>.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>The owner contact information for the <code>Api</code>.</p>
9    pub owner_contact: ::std::option::Option<::std::string::String>,
10    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
11    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
12    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
13    pub event_config: ::std::option::Option<crate::types::EventConfig>,
14}
15impl CreateApiInput {
16    /// <p>The name for the <code>Api</code>.</p>
17    pub fn name(&self) -> ::std::option::Option<&str> {
18        self.name.as_deref()
19    }
20    /// <p>The owner contact information for the <code>Api</code>.</p>
21    pub fn owner_contact(&self) -> ::std::option::Option<&str> {
22        self.owner_contact.as_deref()
23    }
24    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
25    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
26        self.tags.as_ref()
27    }
28    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
29    pub fn event_config(&self) -> ::std::option::Option<&crate::types::EventConfig> {
30        self.event_config.as_ref()
31    }
32}
33impl CreateApiInput {
34    /// Creates a new builder-style object to manufacture [`CreateApiInput`](crate::operation::create_api::CreateApiInput).
35    pub fn builder() -> crate::operation::create_api::builders::CreateApiInputBuilder {
36        crate::operation::create_api::builders::CreateApiInputBuilder::default()
37    }
38}
39
40/// A builder for [`CreateApiInput`](crate::operation::create_api::CreateApiInput).
41#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
42#[non_exhaustive]
43pub struct CreateApiInputBuilder {
44    pub(crate) name: ::std::option::Option<::std::string::String>,
45    pub(crate) owner_contact: ::std::option::Option<::std::string::String>,
46    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
47    pub(crate) event_config: ::std::option::Option<crate::types::EventConfig>,
48}
49impl CreateApiInputBuilder {
50    /// <p>The name for the <code>Api</code>.</p>
51    /// This field is required.
52    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
53        self.name = ::std::option::Option::Some(input.into());
54        self
55    }
56    /// <p>The name for the <code>Api</code>.</p>
57    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
58        self.name = input;
59        self
60    }
61    /// <p>The name for the <code>Api</code>.</p>
62    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
63        &self.name
64    }
65    /// <p>The owner contact information for the <code>Api</code>.</p>
66    pub fn owner_contact(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67        self.owner_contact = ::std::option::Option::Some(input.into());
68        self
69    }
70    /// <p>The owner contact information for the <code>Api</code>.</p>
71    pub fn set_owner_contact(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.owner_contact = input;
73        self
74    }
75    /// <p>The owner contact information for the <code>Api</code>.</p>
76    pub fn get_owner_contact(&self) -> &::std::option::Option<::std::string::String> {
77        &self.owner_contact
78    }
79    /// Adds a key-value pair to `tags`.
80    ///
81    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
82    ///
83    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
84    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
85        let mut hash_map = self.tags.unwrap_or_default();
86        hash_map.insert(k.into(), v.into());
87        self.tags = ::std::option::Option::Some(hash_map);
88        self
89    }
90    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
91    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
92        self.tags = input;
93        self
94    }
95    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
96    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
97        &self.tags
98    }
99    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
100    pub fn event_config(mut self, input: crate::types::EventConfig) -> Self {
101        self.event_config = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
105    pub fn set_event_config(mut self, input: ::std::option::Option<crate::types::EventConfig>) -> Self {
106        self.event_config = input;
107        self
108    }
109    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
110    pub fn get_event_config(&self) -> &::std::option::Option<crate::types::EventConfig> {
111        &self.event_config
112    }
113    /// Consumes the builder and constructs a [`CreateApiInput`](crate::operation::create_api::CreateApiInput).
114    pub fn build(self) -> ::std::result::Result<crate::operation::create_api::CreateApiInput, ::aws_smithy_types::error::operation::BuildError> {
115        ::std::result::Result::Ok(crate::operation::create_api::CreateApiInput {
116            name: self.name,
117            owner_contact: self.owner_contact,
118            tags: self.tags,
119            event_config: self.event_config,
120        })
121    }
122}