aws_sdk_cloudfront/types/_origin_access_control_list.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A list of CloudFront origin access controls.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct OriginAccessControlList {
7 /// <p>The value of the <code>Marker</code> field that was provided in the request.</p>
8 pub marker: ::std::string::String,
9 /// <p>If there are more items in the list than are in this response, this element is present. It contains the value to use in the <code>Marker</code> field of another request to continue listing origin access controls.</p>
10 pub next_marker: ::std::option::Option<::std::string::String>,
11 /// <p>The maximum number of origin access controls requested.</p>
12 pub max_items: i32,
13 /// <p>If there are more items in the list than are in this response, this value is <code>true</code>.</p>
14 pub is_truncated: bool,
15 /// <p>The number of origin access controls returned in the response.</p>
16 pub quantity: i32,
17 /// <p>Contains the origin access controls in the list.</p>
18 pub items: ::std::option::Option<::std::vec::Vec<crate::types::OriginAccessControlSummary>>,
19}
20impl OriginAccessControlList {
21 /// <p>The value of the <code>Marker</code> field that was provided in the request.</p>
22 pub fn marker(&self) -> &str {
23 use std::ops::Deref;
24 self.marker.deref()
25 }
26 /// <p>If there are more items in the list than are in this response, this element is present. It contains the value to use in the <code>Marker</code> field of another request to continue listing origin access controls.</p>
27 pub fn next_marker(&self) -> ::std::option::Option<&str> {
28 self.next_marker.as_deref()
29 }
30 /// <p>The maximum number of origin access controls requested.</p>
31 pub fn max_items(&self) -> i32 {
32 self.max_items
33 }
34 /// <p>If there are more items in the list than are in this response, this value is <code>true</code>.</p>
35 pub fn is_truncated(&self) -> bool {
36 self.is_truncated
37 }
38 /// <p>The number of origin access controls returned in the response.</p>
39 pub fn quantity(&self) -> i32 {
40 self.quantity
41 }
42 /// <p>Contains the origin access controls in the list.</p>
43 ///
44 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.items.is_none()`.
45 pub fn items(&self) -> &[crate::types::OriginAccessControlSummary] {
46 self.items.as_deref().unwrap_or_default()
47 }
48}
49impl OriginAccessControlList {
50 /// Creates a new builder-style object to manufacture [`OriginAccessControlList`](crate::types::OriginAccessControlList).
51 pub fn builder() -> crate::types::builders::OriginAccessControlListBuilder {
52 crate::types::builders::OriginAccessControlListBuilder::default()
53 }
54}
55
56/// A builder for [`OriginAccessControlList`](crate::types::OriginAccessControlList).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct OriginAccessControlListBuilder {
60 pub(crate) marker: ::std::option::Option<::std::string::String>,
61 pub(crate) next_marker: ::std::option::Option<::std::string::String>,
62 pub(crate) max_items: ::std::option::Option<i32>,
63 pub(crate) is_truncated: ::std::option::Option<bool>,
64 pub(crate) quantity: ::std::option::Option<i32>,
65 pub(crate) items: ::std::option::Option<::std::vec::Vec<crate::types::OriginAccessControlSummary>>,
66}
67impl OriginAccessControlListBuilder {
68 /// <p>The value of the <code>Marker</code> field that was provided in the request.</p>
69 /// This field is required.
70 pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71 self.marker = ::std::option::Option::Some(input.into());
72 self
73 }
74 /// <p>The value of the <code>Marker</code> field that was provided in the request.</p>
75 pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76 self.marker = input;
77 self
78 }
79 /// <p>The value of the <code>Marker</code> field that was provided in the request.</p>
80 pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
81 &self.marker
82 }
83 /// <p>If there are more items in the list than are in this response, this element is present. It contains the value to use in the <code>Marker</code> field of another request to continue listing origin access controls.</p>
84 pub fn next_marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85 self.next_marker = ::std::option::Option::Some(input.into());
86 self
87 }
88 /// <p>If there are more items in the list than are in this response, this element is present. It contains the value to use in the <code>Marker</code> field of another request to continue listing origin access controls.</p>
89 pub fn set_next_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90 self.next_marker = input;
91 self
92 }
93 /// <p>If there are more items in the list than are in this response, this element is present. It contains the value to use in the <code>Marker</code> field of another request to continue listing origin access controls.</p>
94 pub fn get_next_marker(&self) -> &::std::option::Option<::std::string::String> {
95 &self.next_marker
96 }
97 /// <p>The maximum number of origin access controls requested.</p>
98 /// This field is required.
99 pub fn max_items(mut self, input: i32) -> Self {
100 self.max_items = ::std::option::Option::Some(input);
101 self
102 }
103 /// <p>The maximum number of origin access controls requested.</p>
104 pub fn set_max_items(mut self, input: ::std::option::Option<i32>) -> Self {
105 self.max_items = input;
106 self
107 }
108 /// <p>The maximum number of origin access controls requested.</p>
109 pub fn get_max_items(&self) -> &::std::option::Option<i32> {
110 &self.max_items
111 }
112 /// <p>If there are more items in the list than are in this response, this value is <code>true</code>.</p>
113 /// This field is required.
114 pub fn is_truncated(mut self, input: bool) -> Self {
115 self.is_truncated = ::std::option::Option::Some(input);
116 self
117 }
118 /// <p>If there are more items in the list than are in this response, this value is <code>true</code>.</p>
119 pub fn set_is_truncated(mut self, input: ::std::option::Option<bool>) -> Self {
120 self.is_truncated = input;
121 self
122 }
123 /// <p>If there are more items in the list than are in this response, this value is <code>true</code>.</p>
124 pub fn get_is_truncated(&self) -> &::std::option::Option<bool> {
125 &self.is_truncated
126 }
127 /// <p>The number of origin access controls returned in the response.</p>
128 /// This field is required.
129 pub fn quantity(mut self, input: i32) -> Self {
130 self.quantity = ::std::option::Option::Some(input);
131 self
132 }
133 /// <p>The number of origin access controls returned in the response.</p>
134 pub fn set_quantity(mut self, input: ::std::option::Option<i32>) -> Self {
135 self.quantity = input;
136 self
137 }
138 /// <p>The number of origin access controls returned in the response.</p>
139 pub fn get_quantity(&self) -> &::std::option::Option<i32> {
140 &self.quantity
141 }
142 /// Appends an item to `items`.
143 ///
144 /// To override the contents of this collection use [`set_items`](Self::set_items).
145 ///
146 /// <p>Contains the origin access controls in the list.</p>
147 pub fn items(mut self, input: crate::types::OriginAccessControlSummary) -> Self {
148 let mut v = self.items.unwrap_or_default();
149 v.push(input);
150 self.items = ::std::option::Option::Some(v);
151 self
152 }
153 /// <p>Contains the origin access controls in the list.</p>
154 pub fn set_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::OriginAccessControlSummary>>) -> Self {
155 self.items = input;
156 self
157 }
158 /// <p>Contains the origin access controls in the list.</p>
159 pub fn get_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::OriginAccessControlSummary>> {
160 &self.items
161 }
162 /// Consumes the builder and constructs a [`OriginAccessControlList`](crate::types::OriginAccessControlList).
163 /// This method will fail if any of the following fields are not set:
164 /// - [`marker`](crate::types::builders::OriginAccessControlListBuilder::marker)
165 /// - [`max_items`](crate::types::builders::OriginAccessControlListBuilder::max_items)
166 /// - [`is_truncated`](crate::types::builders::OriginAccessControlListBuilder::is_truncated)
167 /// - [`quantity`](crate::types::builders::OriginAccessControlListBuilder::quantity)
168 pub fn build(self) -> ::std::result::Result<crate::types::OriginAccessControlList, ::aws_smithy_types::error::operation::BuildError> {
169 ::std::result::Result::Ok(crate::types::OriginAccessControlList {
170 marker: self.marker.ok_or_else(|| {
171 ::aws_smithy_types::error::operation::BuildError::missing_field(
172 "marker",
173 "marker was not specified but it is required when building OriginAccessControlList",
174 )
175 })?,
176 next_marker: self.next_marker,
177 max_items: self.max_items.ok_or_else(|| {
178 ::aws_smithy_types::error::operation::BuildError::missing_field(
179 "max_items",
180 "max_items was not specified but it is required when building OriginAccessControlList",
181 )
182 })?,
183 is_truncated: self.is_truncated.ok_or_else(|| {
184 ::aws_smithy_types::error::operation::BuildError::missing_field(
185 "is_truncated",
186 "is_truncated was not specified but it is required when building OriginAccessControlList",
187 )
188 })?,
189 quantity: self.quantity.ok_or_else(|| {
190 ::aws_smithy_types::error::operation::BuildError::missing_field(
191 "quantity",
192 "quantity was not specified but it is required when building OriginAccessControlList",
193 )
194 })?,
195 items: self.items,
196 })
197 }
198}