aws_sdk_apigateway/types/
_gateway_response.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GatewayResponse {
7 pub response_type: ::std::option::Option<crate::types::GatewayResponseType>,
9 pub status_code: ::std::option::Option<::std::string::String>,
11 pub response_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
13 pub response_templates: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
15 pub default_response: bool,
17}
18impl GatewayResponse {
19 pub fn response_type(&self) -> ::std::option::Option<&crate::types::GatewayResponseType> {
21 self.response_type.as_ref()
22 }
23 pub fn status_code(&self) -> ::std::option::Option<&str> {
25 self.status_code.as_deref()
26 }
27 pub fn response_parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
29 self.response_parameters.as_ref()
30 }
31 pub fn response_templates(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
33 self.response_templates.as_ref()
34 }
35 pub fn default_response(&self) -> bool {
37 self.default_response
38 }
39}
40impl GatewayResponse {
41 pub fn builder() -> crate::types::builders::GatewayResponseBuilder {
43 crate::types::builders::GatewayResponseBuilder::default()
44 }
45}
46
47#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
49#[non_exhaustive]
50pub struct GatewayResponseBuilder {
51 pub(crate) response_type: ::std::option::Option<crate::types::GatewayResponseType>,
52 pub(crate) status_code: ::std::option::Option<::std::string::String>,
53 pub(crate) response_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
54 pub(crate) response_templates: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
55 pub(crate) default_response: ::std::option::Option<bool>,
56}
57impl GatewayResponseBuilder {
58 pub fn response_type(mut self, input: crate::types::GatewayResponseType) -> Self {
60 self.response_type = ::std::option::Option::Some(input);
61 self
62 }
63 pub fn set_response_type(mut self, input: ::std::option::Option<crate::types::GatewayResponseType>) -> Self {
65 self.response_type = input;
66 self
67 }
68 pub fn get_response_type(&self) -> &::std::option::Option<crate::types::GatewayResponseType> {
70 &self.response_type
71 }
72 pub fn status_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74 self.status_code = ::std::option::Option::Some(input.into());
75 self
76 }
77 pub fn set_status_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79 self.status_code = input;
80 self
81 }
82 pub fn get_status_code(&self) -> &::std::option::Option<::std::string::String> {
84 &self.status_code
85 }
86 pub fn response_parameters(
92 mut self,
93 k: impl ::std::convert::Into<::std::string::String>,
94 v: impl ::std::convert::Into<::std::string::String>,
95 ) -> Self {
96 let mut hash_map = self.response_parameters.unwrap_or_default();
97 hash_map.insert(k.into(), v.into());
98 self.response_parameters = ::std::option::Option::Some(hash_map);
99 self
100 }
101 pub fn set_response_parameters(
103 mut self,
104 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
105 ) -> Self {
106 self.response_parameters = input;
107 self
108 }
109 pub fn get_response_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
111 &self.response_parameters
112 }
113 pub fn response_templates(
119 mut self,
120 k: impl ::std::convert::Into<::std::string::String>,
121 v: impl ::std::convert::Into<::std::string::String>,
122 ) -> Self {
123 let mut hash_map = self.response_templates.unwrap_or_default();
124 hash_map.insert(k.into(), v.into());
125 self.response_templates = ::std::option::Option::Some(hash_map);
126 self
127 }
128 pub fn set_response_templates(
130 mut self,
131 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
132 ) -> Self {
133 self.response_templates = input;
134 self
135 }
136 pub fn get_response_templates(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
138 &self.response_templates
139 }
140 pub fn default_response(mut self, input: bool) -> Self {
142 self.default_response = ::std::option::Option::Some(input);
143 self
144 }
145 pub fn set_default_response(mut self, input: ::std::option::Option<bool>) -> Self {
147 self.default_response = input;
148 self
149 }
150 pub fn get_default_response(&self) -> &::std::option::Option<bool> {
152 &self.default_response
153 }
154 pub fn build(self) -> crate::types::GatewayResponse {
156 crate::types::GatewayResponse {
157 response_type: self.response_type,
158 status_code: self.status_code,
159 response_parameters: self.response_parameters,
160 response_templates: self.response_templates,
161 default_response: self.default_response.unwrap_or_default(),
162 }
163 }
164}