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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A gateway response of a given response type and status code, with optional response parameters and mapping templates.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct GatewayResponse {
/// <p>The response type of the associated GatewayResponse.</p>
pub response_type: ::std::option::Option<crate::types::GatewayResponseType>,
/// <p>The HTTP status code for this GatewayResponse.</p>
pub status_code: ::std::option::Option<::std::string::String>,
/// <p>Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub response_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
/// <p>Response templates of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub response_templates: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
/// <p>A Boolean flag to indicate whether this GatewayResponse is the default gateway response (<code>true</code>) or not (<code>false</code>). A default gateway response is one generated by API Gateway without any customization by an API developer. </p>
pub default_response: bool,
}
impl GatewayResponse {
/// <p>The response type of the associated GatewayResponse.</p>
pub fn response_type(&self) -> ::std::option::Option<&crate::types::GatewayResponseType> {
self.response_type.as_ref()
}
/// <p>The HTTP status code for this GatewayResponse.</p>
pub fn status_code(&self) -> ::std::option::Option<&str> {
self.status_code.as_deref()
}
/// <p>Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn response_parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.response_parameters.as_ref()
}
/// <p>Response templates of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn response_templates(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.response_templates.as_ref()
}
/// <p>A Boolean flag to indicate whether this GatewayResponse is the default gateway response (<code>true</code>) or not (<code>false</code>). A default gateway response is one generated by API Gateway without any customization by an API developer. </p>
pub fn default_response(&self) -> bool {
self.default_response
}
}
impl GatewayResponse {
/// Creates a new builder-style object to manufacture [`GatewayResponse`](crate::types::GatewayResponse).
pub fn builder() -> crate::types::builders::GatewayResponseBuilder {
crate::types::builders::GatewayResponseBuilder::default()
}
}
/// A builder for [`GatewayResponse`](crate::types::GatewayResponse).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct GatewayResponseBuilder {
pub(crate) response_type: ::std::option::Option<crate::types::GatewayResponseType>,
pub(crate) status_code: ::std::option::Option<::std::string::String>,
pub(crate) response_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
pub(crate) response_templates: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
pub(crate) default_response: ::std::option::Option<bool>,
}
impl GatewayResponseBuilder {
/// <p>The response type of the associated GatewayResponse.</p>
pub fn response_type(mut self, input: crate::types::GatewayResponseType) -> Self {
self.response_type = ::std::option::Option::Some(input);
self
}
/// <p>The response type of the associated GatewayResponse.</p>
pub fn set_response_type(mut self, input: ::std::option::Option<crate::types::GatewayResponseType>) -> Self {
self.response_type = input;
self
}
/// <p>The response type of the associated GatewayResponse.</p>
pub fn get_response_type(&self) -> &::std::option::Option<crate::types::GatewayResponseType> {
&self.response_type
}
/// <p>The HTTP status code for this GatewayResponse.</p>
pub fn status_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.status_code = ::std::option::Option::Some(input.into());
self
}
/// <p>The HTTP status code for this GatewayResponse.</p>
pub fn set_status_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.status_code = input;
self
}
/// <p>The HTTP status code for this GatewayResponse.</p>
pub fn get_status_code(&self) -> &::std::option::Option<::std::string::String> {
&self.status_code
}
/// Adds a key-value pair to `response_parameters`.
///
/// To override the contents of this collection use [`set_response_parameters`](Self::set_response_parameters).
///
/// <p>Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn response_parameters(
mut self,
k: impl ::std::convert::Into<::std::string::String>,
v: impl ::std::convert::Into<::std::string::String>,
) -> Self {
let mut hash_map = self.response_parameters.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.response_parameters = ::std::option::Option::Some(hash_map);
self
}
/// <p>Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn set_response_parameters(
mut self,
input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
) -> Self {
self.response_parameters = input;
self
}
/// <p>Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn get_response_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
&self.response_parameters
}
/// Adds a key-value pair to `response_templates`.
///
/// To override the contents of this collection use [`set_response_templates`](Self::set_response_templates).
///
/// <p>Response templates of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn response_templates(
mut self,
k: impl ::std::convert::Into<::std::string::String>,
v: impl ::std::convert::Into<::std::string::String>,
) -> Self {
let mut hash_map = self.response_templates.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.response_templates = ::std::option::Option::Some(hash_map);
self
}
/// <p>Response templates of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn set_response_templates(
mut self,
input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
) -> Self {
self.response_templates = input;
self
}
/// <p>Response templates of the GatewayResponse as a string-to-string map of key-value pairs.</p>
pub fn get_response_templates(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
&self.response_templates
}
/// <p>A Boolean flag to indicate whether this GatewayResponse is the default gateway response (<code>true</code>) or not (<code>false</code>). A default gateway response is one generated by API Gateway without any customization by an API developer. </p>
pub fn default_response(mut self, input: bool) -> Self {
self.default_response = ::std::option::Option::Some(input);
self
}
/// <p>A Boolean flag to indicate whether this GatewayResponse is the default gateway response (<code>true</code>) or not (<code>false</code>). A default gateway response is one generated by API Gateway without any customization by an API developer. </p>
pub fn set_default_response(mut self, input: ::std::option::Option<bool>) -> Self {
self.default_response = input;
self
}
/// <p>A Boolean flag to indicate whether this GatewayResponse is the default gateway response (<code>true</code>) or not (<code>false</code>). A default gateway response is one generated by API Gateway without any customization by an API developer. </p>
pub fn get_default_response(&self) -> &::std::option::Option<bool> {
&self.default_response
}
/// Consumes the builder and constructs a [`GatewayResponse`](crate::types::GatewayResponse).
pub fn build(self) -> crate::types::GatewayResponse {
crate::types::GatewayResponse {
response_type: self.response_type,
status_code: self.status_code,
response_parameters: self.response_parameters,
response_templates: self.response_templates,
default_response: self.default_response.unwrap_or_default(),
}
}
}