aws_sdk_cloudtrail/operation/create_dashboard/
_create_dashboard_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateDashboardInput {
6    /// <p>The name of the dashboard. The name must be unique to your account.</p>
7    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
8    pub name: ::std::option::Option<::std::string::String>,
9    /// <p>The refresh schedule configuration for the dashboard.</p>
10    /// <p>To create the Highlights dashboard, you must set a refresh schedule and set the <code>Status</code> to <code>ENABLED</code>. The <code>Unit</code> for the refresh schedule must be <code>HOURS</code> and the <code>Value</code> must be <code>6</code>.</p>
11    pub refresh_schedule: ::std::option::Option<crate::types::RefreshSchedule>,
12    /// <p>A list of tags.</p>
13    pub tags_list: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14    /// <p>Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.</p>
15    pub termination_protection_enabled: ::std::option::Option<bool>,
16    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
17    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
18    pub widgets: ::std::option::Option<::std::vec::Vec<crate::types::RequestWidget>>,
19}
20impl CreateDashboardInput {
21    /// <p>The name of the dashboard. The name must be unique to your account.</p>
22    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
23    pub fn name(&self) -> ::std::option::Option<&str> {
24        self.name.as_deref()
25    }
26    /// <p>The refresh schedule configuration for the dashboard.</p>
27    /// <p>To create the Highlights dashboard, you must set a refresh schedule and set the <code>Status</code> to <code>ENABLED</code>. The <code>Unit</code> for the refresh schedule must be <code>HOURS</code> and the <code>Value</code> must be <code>6</code>.</p>
28    pub fn refresh_schedule(&self) -> ::std::option::Option<&crate::types::RefreshSchedule> {
29        self.refresh_schedule.as_ref()
30    }
31    /// <p>A list of tags.</p>
32    ///
33    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags_list.is_none()`.
34    pub fn tags_list(&self) -> &[crate::types::Tag] {
35        self.tags_list.as_deref().unwrap_or_default()
36    }
37    /// <p>Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.</p>
38    pub fn termination_protection_enabled(&self) -> ::std::option::Option<bool> {
39        self.termination_protection_enabled
40    }
41    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
42    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
43    ///
44    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.widgets.is_none()`.
45    pub fn widgets(&self) -> &[crate::types::RequestWidget] {
46        self.widgets.as_deref().unwrap_or_default()
47    }
48}
49impl CreateDashboardInput {
50    /// Creates a new builder-style object to manufacture [`CreateDashboardInput`](crate::operation::create_dashboard::CreateDashboardInput).
51    pub fn builder() -> crate::operation::create_dashboard::builders::CreateDashboardInputBuilder {
52        crate::operation::create_dashboard::builders::CreateDashboardInputBuilder::default()
53    }
54}
55
56/// A builder for [`CreateDashboardInput`](crate::operation::create_dashboard::CreateDashboardInput).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct CreateDashboardInputBuilder {
60    pub(crate) name: ::std::option::Option<::std::string::String>,
61    pub(crate) refresh_schedule: ::std::option::Option<crate::types::RefreshSchedule>,
62    pub(crate) tags_list: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
63    pub(crate) termination_protection_enabled: ::std::option::Option<bool>,
64    pub(crate) widgets: ::std::option::Option<::std::vec::Vec<crate::types::RequestWidget>>,
65}
66impl CreateDashboardInputBuilder {
67    /// <p>The name of the dashboard. The name must be unique to your account.</p>
68    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
69    /// This field is required.
70    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.name = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The name of the dashboard. The name must be unique to your account.</p>
75    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
76    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
77        self.name = input;
78        self
79    }
80    /// <p>The name of the dashboard. The name must be unique to your account.</p>
81    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
82    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
83        &self.name
84    }
85    /// <p>The refresh schedule configuration for the dashboard.</p>
86    /// <p>To create the Highlights dashboard, you must set a refresh schedule and set the <code>Status</code> to <code>ENABLED</code>. The <code>Unit</code> for the refresh schedule must be <code>HOURS</code> and the <code>Value</code> must be <code>6</code>.</p>
87    pub fn refresh_schedule(mut self, input: crate::types::RefreshSchedule) -> Self {
88        self.refresh_schedule = ::std::option::Option::Some(input);
89        self
90    }
91    /// <p>The refresh schedule configuration for the dashboard.</p>
92    /// <p>To create the Highlights dashboard, you must set a refresh schedule and set the <code>Status</code> to <code>ENABLED</code>. The <code>Unit</code> for the refresh schedule must be <code>HOURS</code> and the <code>Value</code> must be <code>6</code>.</p>
93    pub fn set_refresh_schedule(mut self, input: ::std::option::Option<crate::types::RefreshSchedule>) -> Self {
94        self.refresh_schedule = input;
95        self
96    }
97    /// <p>The refresh schedule configuration for the dashboard.</p>
98    /// <p>To create the Highlights dashboard, you must set a refresh schedule and set the <code>Status</code> to <code>ENABLED</code>. The <code>Unit</code> for the refresh schedule must be <code>HOURS</code> and the <code>Value</code> must be <code>6</code>.</p>
99    pub fn get_refresh_schedule(&self) -> &::std::option::Option<crate::types::RefreshSchedule> {
100        &self.refresh_schedule
101    }
102    /// Appends an item to `tags_list`.
103    ///
104    /// To override the contents of this collection use [`set_tags_list`](Self::set_tags_list).
105    ///
106    /// <p>A list of tags.</p>
107    pub fn tags_list(mut self, input: crate::types::Tag) -> Self {
108        let mut v = self.tags_list.unwrap_or_default();
109        v.push(input);
110        self.tags_list = ::std::option::Option::Some(v);
111        self
112    }
113    /// <p>A list of tags.</p>
114    pub fn set_tags_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
115        self.tags_list = input;
116        self
117    }
118    /// <p>A list of tags.</p>
119    pub fn get_tags_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
120        &self.tags_list
121    }
122    /// <p>Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.</p>
123    pub fn termination_protection_enabled(mut self, input: bool) -> Self {
124        self.termination_protection_enabled = ::std::option::Option::Some(input);
125        self
126    }
127    /// <p>Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.</p>
128    pub fn set_termination_protection_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
129        self.termination_protection_enabled = input;
130        self
131    }
132    /// <p>Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.</p>
133    pub fn get_termination_protection_enabled(&self) -> &::std::option::Option<bool> {
134        &self.termination_protection_enabled
135    }
136    /// Appends an item to `widgets`.
137    ///
138    /// To override the contents of this collection use [`set_widgets`](Self::set_widgets).
139    ///
140    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
141    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
142    pub fn widgets(mut self, input: crate::types::RequestWidget) -> Self {
143        let mut v = self.widgets.unwrap_or_default();
144        v.push(input);
145        self.widgets = ::std::option::Option::Some(v);
146        self
147    }
148    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
149    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
150    pub fn set_widgets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RequestWidget>>) -> Self {
151        self.widgets = input;
152        self
153    }
154    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
155    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
156    pub fn get_widgets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RequestWidget>> {
157        &self.widgets
158    }
159    /// Consumes the builder and constructs a [`CreateDashboardInput`](crate::operation::create_dashboard::CreateDashboardInput).
160    pub fn build(
161        self,
162    ) -> ::std::result::Result<crate::operation::create_dashboard::CreateDashboardInput, ::aws_smithy_types::error::operation::BuildError> {
163        ::std::result::Result::Ok(crate::operation::create_dashboard::CreateDashboardInput {
164            name: self.name,
165            refresh_schedule: self.refresh_schedule,
166            tags_list: self.tags_list,
167            termination_protection_enabled: self.termination_protection_enabled,
168            widgets: self.widgets,
169        })
170    }
171}