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

/// <p>An array of objects representing the replication destinations and repository filters for a replication configuration.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ReplicationRule {
    /// <p>An array of objects representing the destination for a replication rule.</p>
    pub destinations: ::std::vec::Vec<crate::types::ReplicationDestination>,
    /// <p>An array of objects representing the filters for a replication rule. Specifying a repository filter for a replication rule provides a method for controlling which repositories in a private registry are replicated.</p>
    pub repository_filters: ::std::option::Option<::std::vec::Vec<crate::types::RepositoryFilter>>,
}
impl ReplicationRule {
    /// <p>An array of objects representing the destination for a replication rule.</p>
    pub fn destinations(&self) -> &[crate::types::ReplicationDestination] {
        use std::ops::Deref;
        self.destinations.deref()
    }
    /// <p>An array of objects representing the filters for a replication rule. Specifying a repository filter for a replication rule provides a method for controlling which repositories in a private registry are replicated.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.repository_filters.is_none()`.
    pub fn repository_filters(&self) -> &[crate::types::RepositoryFilter] {
        self.repository_filters.as_deref().unwrap_or_default()
    }
}
impl ReplicationRule {
    /// Creates a new builder-style object to manufacture [`ReplicationRule`](crate::types::ReplicationRule).
    pub fn builder() -> crate::types::builders::ReplicationRuleBuilder {
        crate::types::builders::ReplicationRuleBuilder::default()
    }
}

/// A builder for [`ReplicationRule`](crate::types::ReplicationRule).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct ReplicationRuleBuilder {
    pub(crate) destinations: ::std::option::Option<::std::vec::Vec<crate::types::ReplicationDestination>>,
    pub(crate) repository_filters: ::std::option::Option<::std::vec::Vec<crate::types::RepositoryFilter>>,
}
impl ReplicationRuleBuilder {
    /// Appends an item to `destinations`.
    ///
    /// To override the contents of this collection use [`set_destinations`](Self::set_destinations).
    ///
    /// <p>An array of objects representing the destination for a replication rule.</p>
    pub fn destinations(mut self, input: crate::types::ReplicationDestination) -> Self {
        let mut v = self.destinations.unwrap_or_default();
        v.push(input);
        self.destinations = ::std::option::Option::Some(v);
        self
    }
    /// <p>An array of objects representing the destination for a replication rule.</p>
    pub fn set_destinations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ReplicationDestination>>) -> Self {
        self.destinations = input;
        self
    }
    /// <p>An array of objects representing the destination for a replication rule.</p>
    pub fn get_destinations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ReplicationDestination>> {
        &self.destinations
    }
    /// Appends an item to `repository_filters`.
    ///
    /// To override the contents of this collection use [`set_repository_filters`](Self::set_repository_filters).
    ///
    /// <p>An array of objects representing the filters for a replication rule. Specifying a repository filter for a replication rule provides a method for controlling which repositories in a private registry are replicated.</p>
    pub fn repository_filters(mut self, input: crate::types::RepositoryFilter) -> Self {
        let mut v = self.repository_filters.unwrap_or_default();
        v.push(input);
        self.repository_filters = ::std::option::Option::Some(v);
        self
    }
    /// <p>An array of objects representing the filters for a replication rule. Specifying a repository filter for a replication rule provides a method for controlling which repositories in a private registry are replicated.</p>
    pub fn set_repository_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RepositoryFilter>>) -> Self {
        self.repository_filters = input;
        self
    }
    /// <p>An array of objects representing the filters for a replication rule. Specifying a repository filter for a replication rule provides a method for controlling which repositories in a private registry are replicated.</p>
    pub fn get_repository_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RepositoryFilter>> {
        &self.repository_filters
    }
    /// Consumes the builder and constructs a [`ReplicationRule`](crate::types::ReplicationRule).
    /// This method will fail if any of the following fields are not set:
    /// - [`destinations`](crate::types::builders::ReplicationRuleBuilder::destinations)
    pub fn build(self) -> ::std::result::Result<crate::types::ReplicationRule, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::ReplicationRule {
            destinations: self.destinations.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "destinations",
                    "destinations was not specified but it is required when building ReplicationRule",
                )
            })?,
            repository_filters: self.repository_filters,
        })
    }
}