aws_sdk_cloudfront/types/_active_trusted_key_groups.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A list of key groups, and the public keys in each key group, that CloudFront can use to verify the signatures of signed URLs and signed cookies.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ActiveTrustedKeyGroups {
7 /// <p>This field is <code>true</code> if any of the key groups have public keys that CloudFront can use to verify the signatures of signed URLs and signed cookies. If not, this field is <code>false</code>.</p>
8 pub enabled: bool,
9 /// <p>The number of key groups in the list.</p>
10 pub quantity: i32,
11 /// <p>A list of key groups, including the identifiers of the public keys in each key group that CloudFront can use to verify the signatures of signed URLs and signed cookies.</p>
12 pub items: ::std::option::Option<::std::vec::Vec<crate::types::KgKeyPairIds>>,
13}
14impl ActiveTrustedKeyGroups {
15 /// <p>This field is <code>true</code> if any of the key groups have public keys that CloudFront can use to verify the signatures of signed URLs and signed cookies. If not, this field is <code>false</code>.</p>
16 pub fn enabled(&self) -> bool {
17 self.enabled
18 }
19 /// <p>The number of key groups in the list.</p>
20 pub fn quantity(&self) -> i32 {
21 self.quantity
22 }
23 /// <p>A list of key groups, including the identifiers of the public keys in each key group that CloudFront can use to verify the signatures of signed URLs and signed cookies.</p>
24 ///
25 /// 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()`.
26 pub fn items(&self) -> &[crate::types::KgKeyPairIds] {
27 self.items.as_deref().unwrap_or_default()
28 }
29}
30impl ActiveTrustedKeyGroups {
31 /// Creates a new builder-style object to manufacture [`ActiveTrustedKeyGroups`](crate::types::ActiveTrustedKeyGroups).
32 pub fn builder() -> crate::types::builders::ActiveTrustedKeyGroupsBuilder {
33 crate::types::builders::ActiveTrustedKeyGroupsBuilder::default()
34 }
35}
36
37/// A builder for [`ActiveTrustedKeyGroups`](crate::types::ActiveTrustedKeyGroups).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct ActiveTrustedKeyGroupsBuilder {
41 pub(crate) enabled: ::std::option::Option<bool>,
42 pub(crate) quantity: ::std::option::Option<i32>,
43 pub(crate) items: ::std::option::Option<::std::vec::Vec<crate::types::KgKeyPairIds>>,
44}
45impl ActiveTrustedKeyGroupsBuilder {
46 /// <p>This field is <code>true</code> if any of the key groups have public keys that CloudFront can use to verify the signatures of signed URLs and signed cookies. If not, this field is <code>false</code>.</p>
47 /// This field is required.
48 pub fn enabled(mut self, input: bool) -> Self {
49 self.enabled = ::std::option::Option::Some(input);
50 self
51 }
52 /// <p>This field is <code>true</code> if any of the key groups have public keys that CloudFront can use to verify the signatures of signed URLs and signed cookies. If not, this field is <code>false</code>.</p>
53 pub fn set_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
54 self.enabled = input;
55 self
56 }
57 /// <p>This field is <code>true</code> if any of the key groups have public keys that CloudFront can use to verify the signatures of signed URLs and signed cookies. If not, this field is <code>false</code>.</p>
58 pub fn get_enabled(&self) -> &::std::option::Option<bool> {
59 &self.enabled
60 }
61 /// <p>The number of key groups in the list.</p>
62 /// This field is required.
63 pub fn quantity(mut self, input: i32) -> Self {
64 self.quantity = ::std::option::Option::Some(input);
65 self
66 }
67 /// <p>The number of key groups in the list.</p>
68 pub fn set_quantity(mut self, input: ::std::option::Option<i32>) -> Self {
69 self.quantity = input;
70 self
71 }
72 /// <p>The number of key groups in the list.</p>
73 pub fn get_quantity(&self) -> &::std::option::Option<i32> {
74 &self.quantity
75 }
76 /// Appends an item to `items`.
77 ///
78 /// To override the contents of this collection use [`set_items`](Self::set_items).
79 ///
80 /// <p>A list of key groups, including the identifiers of the public keys in each key group that CloudFront can use to verify the signatures of signed URLs and signed cookies.</p>
81 pub fn items(mut self, input: crate::types::KgKeyPairIds) -> Self {
82 let mut v = self.items.unwrap_or_default();
83 v.push(input);
84 self.items = ::std::option::Option::Some(v);
85 self
86 }
87 /// <p>A list of key groups, including the identifiers of the public keys in each key group that CloudFront can use to verify the signatures of signed URLs and signed cookies.</p>
88 pub fn set_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::KgKeyPairIds>>) -> Self {
89 self.items = input;
90 self
91 }
92 /// <p>A list of key groups, including the identifiers of the public keys in each key group that CloudFront can use to verify the signatures of signed URLs and signed cookies.</p>
93 pub fn get_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::KgKeyPairIds>> {
94 &self.items
95 }
96 /// Consumes the builder and constructs a [`ActiveTrustedKeyGroups`](crate::types::ActiveTrustedKeyGroups).
97 /// This method will fail if any of the following fields are not set:
98 /// - [`enabled`](crate::types::builders::ActiveTrustedKeyGroupsBuilder::enabled)
99 /// - [`quantity`](crate::types::builders::ActiveTrustedKeyGroupsBuilder::quantity)
100 pub fn build(self) -> ::std::result::Result<crate::types::ActiveTrustedKeyGroups, ::aws_smithy_types::error::operation::BuildError> {
101 ::std::result::Result::Ok(crate::types::ActiveTrustedKeyGroups {
102 enabled: self.enabled.ok_or_else(|| {
103 ::aws_smithy_types::error::operation::BuildError::missing_field(
104 "enabled",
105 "enabled was not specified but it is required when building ActiveTrustedKeyGroups",
106 )
107 })?,
108 quantity: self.quantity.ok_or_else(|| {
109 ::aws_smithy_types::error::operation::BuildError::missing_field(
110 "quantity",
111 "quantity was not specified but it is required when building ActiveTrustedKeyGroups",
112 )
113 })?,
114 items: self.items,
115 })
116 }
117}