aws_sdk_cloudfront/types/
_key_group.rs

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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A key group.</p>
/// <p>A key group contains a list of public keys that you can use with <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">CloudFront signed URLs and signed cookies</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct KeyGroup {
    /// <p>The identifier for the key group.</p>
    pub id: ::std::string::String,
    /// <p>The date and time when the key group was last modified.</p>
    pub last_modified_time: ::aws_smithy_types::DateTime,
    /// <p>The key group configuration.</p>
    pub key_group_config: ::std::option::Option<crate::types::KeyGroupConfig>,
}
impl KeyGroup {
    /// <p>The identifier for the key group.</p>
    pub fn id(&self) -> &str {
        use std::ops::Deref;
        self.id.deref()
    }
    /// <p>The date and time when the key group was last modified.</p>
    pub fn last_modified_time(&self) -> &::aws_smithy_types::DateTime {
        &self.last_modified_time
    }
    /// <p>The key group configuration.</p>
    pub fn key_group_config(&self) -> ::std::option::Option<&crate::types::KeyGroupConfig> {
        self.key_group_config.as_ref()
    }
}
impl KeyGroup {
    /// Creates a new builder-style object to manufacture [`KeyGroup`](crate::types::KeyGroup).
    pub fn builder() -> crate::types::builders::KeyGroupBuilder {
        crate::types::builders::KeyGroupBuilder::default()
    }
}

/// A builder for [`KeyGroup`](crate::types::KeyGroup).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct KeyGroupBuilder {
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) last_modified_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) key_group_config: ::std::option::Option<crate::types::KeyGroupConfig>,
}
impl KeyGroupBuilder {
    /// <p>The identifier for the key group.</p>
    /// This field is required.
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier for the key group.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The identifier for the key group.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// <p>The date and time when the key group was last modified.</p>
    /// This field is required.
    pub fn last_modified_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.last_modified_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>The date and time when the key group was last modified.</p>
    pub fn set_last_modified_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.last_modified_time = input;
        self
    }
    /// <p>The date and time when the key group was last modified.</p>
    pub fn get_last_modified_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.last_modified_time
    }
    /// <p>The key group configuration.</p>
    /// This field is required.
    pub fn key_group_config(mut self, input: crate::types::KeyGroupConfig) -> Self {
        self.key_group_config = ::std::option::Option::Some(input);
        self
    }
    /// <p>The key group configuration.</p>
    pub fn set_key_group_config(mut self, input: ::std::option::Option<crate::types::KeyGroupConfig>) -> Self {
        self.key_group_config = input;
        self
    }
    /// <p>The key group configuration.</p>
    pub fn get_key_group_config(&self) -> &::std::option::Option<crate::types::KeyGroupConfig> {
        &self.key_group_config
    }
    /// Consumes the builder and constructs a [`KeyGroup`](crate::types::KeyGroup).
    /// This method will fail if any of the following fields are not set:
    /// - [`id`](crate::types::builders::KeyGroupBuilder::id)
    /// - [`last_modified_time`](crate::types::builders::KeyGroupBuilder::last_modified_time)
    pub fn build(self) -> ::std::result::Result<crate::types::KeyGroup, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::KeyGroup {
            id: self.id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "id",
                    "id was not specified but it is required when building KeyGroup",
                )
            })?,
            last_modified_time: self.last_modified_time.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "last_modified_time",
                    "last_modified_time was not specified but it is required when building KeyGroup",
                )
            })?,
            key_group_config: self.key_group_config,
        })
    }
}