Skip to main content

aws_sdk_cloudfront/types/
_cloud_front_origin_access_identity.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>CloudFront origin access identity.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CloudFrontOriginAccessIdentity {
7    /// <p>The ID for the origin access identity, for example, <code>E74FTE3AJFJ256A</code>.</p>
8    pub id: ::std::string::String,
9    /// <p>The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.</p>
10    pub s3_canonical_user_id: ::std::string::String,
11    /// <p>The current configuration information for the identity.</p>
12    pub cloud_front_origin_access_identity_config: ::std::option::Option<crate::types::CloudFrontOriginAccessIdentityConfig>,
13}
14impl CloudFrontOriginAccessIdentity {
15    /// <p>The ID for the origin access identity, for example, <code>E74FTE3AJFJ256A</code>.</p>
16    pub fn id(&self) -> &str {
17        use std::ops::Deref;
18        self.id.deref()
19    }
20    /// <p>The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.</p>
21    pub fn s3_canonical_user_id(&self) -> &str {
22        use std::ops::Deref;
23        self.s3_canonical_user_id.deref()
24    }
25    /// <p>The current configuration information for the identity.</p>
26    pub fn cloud_front_origin_access_identity_config(&self) -> ::std::option::Option<&crate::types::CloudFrontOriginAccessIdentityConfig> {
27        self.cloud_front_origin_access_identity_config.as_ref()
28    }
29}
30impl CloudFrontOriginAccessIdentity {
31    /// Creates a new builder-style object to manufacture [`CloudFrontOriginAccessIdentity`](crate::types::CloudFrontOriginAccessIdentity).
32    pub fn builder() -> crate::types::builders::CloudFrontOriginAccessIdentityBuilder {
33        crate::types::builders::CloudFrontOriginAccessIdentityBuilder::default()
34    }
35}
36
37/// A builder for [`CloudFrontOriginAccessIdentity`](crate::types::CloudFrontOriginAccessIdentity).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct CloudFrontOriginAccessIdentityBuilder {
41    pub(crate) id: ::std::option::Option<::std::string::String>,
42    pub(crate) s3_canonical_user_id: ::std::option::Option<::std::string::String>,
43    pub(crate) cloud_front_origin_access_identity_config: ::std::option::Option<crate::types::CloudFrontOriginAccessIdentityConfig>,
44}
45impl CloudFrontOriginAccessIdentityBuilder {
46    /// <p>The ID for the origin access identity, for example, <code>E74FTE3AJFJ256A</code>.</p>
47    /// This field is required.
48    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
49        self.id = ::std::option::Option::Some(input.into());
50        self
51    }
52    /// <p>The ID for the origin access identity, for example, <code>E74FTE3AJFJ256A</code>.</p>
53    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
54        self.id = input;
55        self
56    }
57    /// <p>The ID for the origin access identity, for example, <code>E74FTE3AJFJ256A</code>.</p>
58    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
59        &self.id
60    }
61    /// <p>The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.</p>
62    /// This field is required.
63    pub fn s3_canonical_user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.s3_canonical_user_id = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.</p>
68    pub fn set_s3_canonical_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.s3_canonical_user_id = input;
70        self
71    }
72    /// <p>The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.</p>
73    pub fn get_s3_canonical_user_id(&self) -> &::std::option::Option<::std::string::String> {
74        &self.s3_canonical_user_id
75    }
76    /// <p>The current configuration information for the identity.</p>
77    pub fn cloud_front_origin_access_identity_config(mut self, input: crate::types::CloudFrontOriginAccessIdentityConfig) -> Self {
78        self.cloud_front_origin_access_identity_config = ::std::option::Option::Some(input);
79        self
80    }
81    /// <p>The current configuration information for the identity.</p>
82    pub fn set_cloud_front_origin_access_identity_config(
83        mut self,
84        input: ::std::option::Option<crate::types::CloudFrontOriginAccessIdentityConfig>,
85    ) -> Self {
86        self.cloud_front_origin_access_identity_config = input;
87        self
88    }
89    /// <p>The current configuration information for the identity.</p>
90    pub fn get_cloud_front_origin_access_identity_config(&self) -> &::std::option::Option<crate::types::CloudFrontOriginAccessIdentityConfig> {
91        &self.cloud_front_origin_access_identity_config
92    }
93    /// Consumes the builder and constructs a [`CloudFrontOriginAccessIdentity`](crate::types::CloudFrontOriginAccessIdentity).
94    /// This method will fail if any of the following fields are not set:
95    /// - [`id`](crate::types::builders::CloudFrontOriginAccessIdentityBuilder::id)
96    /// - [`s3_canonical_user_id`](crate::types::builders::CloudFrontOriginAccessIdentityBuilder::s3_canonical_user_id)
97    pub fn build(self) -> ::std::result::Result<crate::types::CloudFrontOriginAccessIdentity, ::aws_smithy_types::error::operation::BuildError> {
98        ::std::result::Result::Ok(crate::types::CloudFrontOriginAccessIdentity {
99            id: self.id.ok_or_else(|| {
100                ::aws_smithy_types::error::operation::BuildError::missing_field(
101                    "id",
102                    "id was not specified but it is required when building CloudFrontOriginAccessIdentity",
103                )
104            })?,
105            s3_canonical_user_id: self.s3_canonical_user_id.ok_or_else(|| {
106                ::aws_smithy_types::error::operation::BuildError::missing_field(
107                    "s3_canonical_user_id",
108                    "s3_canonical_user_id was not specified but it is required when building CloudFrontOriginAccessIdentity",
109                )
110            })?,
111            cloud_front_origin_access_identity_config: self.cloud_front_origin_access_identity_config,
112        })
113    }
114}