aws_sdk_iot/types/
_http_context.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct HttpContext {
7 pub headers: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
9 pub query_string: ::std::option::Option<::std::string::String>,
11}
12impl HttpContext {
13 pub fn headers(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
15 self.headers.as_ref()
16 }
17 pub fn query_string(&self) -> ::std::option::Option<&str> {
19 self.query_string.as_deref()
20 }
21}
22impl HttpContext {
23 pub fn builder() -> crate::types::builders::HttpContextBuilder {
25 crate::types::builders::HttpContextBuilder::default()
26 }
27}
28
29#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct HttpContextBuilder {
33 pub(crate) headers: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
34 pub(crate) query_string: ::std::option::Option<::std::string::String>,
35}
36impl HttpContextBuilder {
37 pub fn headers(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
43 let mut hash_map = self.headers.unwrap_or_default();
44 hash_map.insert(k.into(), v.into());
45 self.headers = ::std::option::Option::Some(hash_map);
46 self
47 }
48 pub fn set_headers(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
50 self.headers = input;
51 self
52 }
53 pub fn get_headers(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
55 &self.headers
56 }
57 pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
59 self.query_string = ::std::option::Option::Some(input.into());
60 self
61 }
62 pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
64 self.query_string = input;
65 self
66 }
67 pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
69 &self.query_string
70 }
71 pub fn build(self) -> crate::types::HttpContext {
73 crate::types::HttpContext {
74 headers: self.headers,
75 query_string: self.query_string,
76 }
77 }
78}