aws_sdk_signer/types/
_encryption_algorithm_options.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The encryption algorithm options that are available to a code-signing job.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct EncryptionAlgorithmOptions {
7    /// <p>The set of accepted encryption algorithms that are allowed in a code-signing job.</p>
8    pub allowed_values: ::std::vec::Vec<crate::types::EncryptionAlgorithm>,
9    /// <p>The default encryption algorithm that is used by a code-signing job.</p>
10    pub default_value: crate::types::EncryptionAlgorithm,
11}
12impl EncryptionAlgorithmOptions {
13    /// <p>The set of accepted encryption algorithms that are allowed in a code-signing job.</p>
14    pub fn allowed_values(&self) -> &[crate::types::EncryptionAlgorithm] {
15        use std::ops::Deref;
16        self.allowed_values.deref()
17    }
18    /// <p>The default encryption algorithm that is used by a code-signing job.</p>
19    pub fn default_value(&self) -> &crate::types::EncryptionAlgorithm {
20        &self.default_value
21    }
22}
23impl EncryptionAlgorithmOptions {
24    /// Creates a new builder-style object to manufacture [`EncryptionAlgorithmOptions`](crate::types::EncryptionAlgorithmOptions).
25    pub fn builder() -> crate::types::builders::EncryptionAlgorithmOptionsBuilder {
26        crate::types::builders::EncryptionAlgorithmOptionsBuilder::default()
27    }
28}
29
30/// A builder for [`EncryptionAlgorithmOptions`](crate::types::EncryptionAlgorithmOptions).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct EncryptionAlgorithmOptionsBuilder {
34    pub(crate) allowed_values: ::std::option::Option<::std::vec::Vec<crate::types::EncryptionAlgorithm>>,
35    pub(crate) default_value: ::std::option::Option<crate::types::EncryptionAlgorithm>,
36}
37impl EncryptionAlgorithmOptionsBuilder {
38    /// Appends an item to `allowed_values`.
39    ///
40    /// To override the contents of this collection use [`set_allowed_values`](Self::set_allowed_values).
41    ///
42    /// <p>The set of accepted encryption algorithms that are allowed in a code-signing job.</p>
43    pub fn allowed_values(mut self, input: crate::types::EncryptionAlgorithm) -> Self {
44        let mut v = self.allowed_values.unwrap_or_default();
45        v.push(input);
46        self.allowed_values = ::std::option::Option::Some(v);
47        self
48    }
49    /// <p>The set of accepted encryption algorithms that are allowed in a code-signing job.</p>
50    pub fn set_allowed_values(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::EncryptionAlgorithm>>) -> Self {
51        self.allowed_values = input;
52        self
53    }
54    /// <p>The set of accepted encryption algorithms that are allowed in a code-signing job.</p>
55    pub fn get_allowed_values(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::EncryptionAlgorithm>> {
56        &self.allowed_values
57    }
58    /// <p>The default encryption algorithm that is used by a code-signing job.</p>
59    /// This field is required.
60    pub fn default_value(mut self, input: crate::types::EncryptionAlgorithm) -> Self {
61        self.default_value = ::std::option::Option::Some(input);
62        self
63    }
64    /// <p>The default encryption algorithm that is used by a code-signing job.</p>
65    pub fn set_default_value(mut self, input: ::std::option::Option<crate::types::EncryptionAlgorithm>) -> Self {
66        self.default_value = input;
67        self
68    }
69    /// <p>The default encryption algorithm that is used by a code-signing job.</p>
70    pub fn get_default_value(&self) -> &::std::option::Option<crate::types::EncryptionAlgorithm> {
71        &self.default_value
72    }
73    /// Consumes the builder and constructs a [`EncryptionAlgorithmOptions`](crate::types::EncryptionAlgorithmOptions).
74    /// This method will fail if any of the following fields are not set:
75    /// - [`allowed_values`](crate::types::builders::EncryptionAlgorithmOptionsBuilder::allowed_values)
76    /// - [`default_value`](crate::types::builders::EncryptionAlgorithmOptionsBuilder::default_value)
77    pub fn build(self) -> ::std::result::Result<crate::types::EncryptionAlgorithmOptions, ::aws_smithy_types::error::operation::BuildError> {
78        ::std::result::Result::Ok(crate::types::EncryptionAlgorithmOptions {
79            allowed_values: self.allowed_values.ok_or_else(|| {
80                ::aws_smithy_types::error::operation::BuildError::missing_field(
81                    "allowed_values",
82                    "allowed_values was not specified but it is required when building EncryptionAlgorithmOptions",
83                )
84            })?,
85            default_value: self.default_value.ok_or_else(|| {
86                ::aws_smithy_types::error::operation::BuildError::missing_field(
87                    "default_value",
88                    "default_value was not specified but it is required when building EncryptionAlgorithmOptions",
89                )
90            })?,
91        })
92    }
93}