aws_sdk_cloudtrail/operation/create_dashboard/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_dashboard::_create_dashboard_output::CreateDashboardOutputBuilder;
3
4pub use crate::operation::create_dashboard::_create_dashboard_input::CreateDashboardInputBuilder;
5
6impl crate::operation::create_dashboard::builders::CreateDashboardInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_dashboard::CreateDashboardOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_dashboard::CreateDashboardError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_dashboard();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDashboard`.
24///
25/// <p>Creates a custom dashboard or the Highlights dashboard.</p>
26/// <ul>
27/// <li>
28/// <p><b>Custom dashboards</b> - Custom dashboards allow you to query events in any event data store type. You can add up to 10 widgets to a custom dashboard. You can manually refresh a custom dashboard, or you can set a refresh schedule.</p></li>
29/// <li>
30/// <p><b>Highlights dashboard</b> - You can create the Highlights dashboard to see a summary of key user activities and API usage across all your event data stores. CloudTrail Lake manages the Highlights dashboard and refreshes the dashboard every 6 hours. To create the Highlights dashboard, you must set and enable a refresh schedule.</p></li>
31/// </ul>
32/// <p>CloudTrail runs queries to populate the dashboard's widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the <code>StartQuery</code> operation on your behalf. To provide permissions, run the <code>PutResourcePolicy</code> operation to attach a resource-based policy to each event data store. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-eds-dashboard">Example: Allow CloudTrail to run queries to populate a dashboard</a> in the <i>CloudTrail User Guide</i>.</p>
33/// <p>To set a refresh schedule, CloudTrail must be granted permissions to run the <code>StartDashboardRefresh</code> operation to refresh the dashboard on your behalf. To provide permissions, run the <code>PutResourcePolicy</code> operation to attach a resource-based policy to the dashboard. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/security_iam_resource-based-policy-examples.html#security_iam_resource-based-policy-examples-dashboards"> Resource-based policy example for a dashboard</a> in the <i>CloudTrail User Guide</i>.</p>
34/// <p>For more information about dashboards, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-dashboard.html">CloudTrail Lake dashboards</a> in the <i>CloudTrail User Guide</i>.</p>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct CreateDashboardFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::create_dashboard::builders::CreateDashboardInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::create_dashboard::CreateDashboardOutput,
44        crate::operation::create_dashboard::CreateDashboardError,
45    > for CreateDashboardFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::create_dashboard::CreateDashboardOutput,
53            crate::operation::create_dashboard::CreateDashboardError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl CreateDashboardFluentBuilder {
60    /// Creates a new `CreateDashboardFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the CreateDashboard as a reference.
69    pub fn as_input(&self) -> &crate::operation::create_dashboard::builders::CreateDashboardInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::create_dashboard::CreateDashboardOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::create_dashboard::CreateDashboardError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::create_dashboard::CreateDashboard::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::create_dashboard::CreateDashboard::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::create_dashboard::CreateDashboardOutput,
106        crate::operation::create_dashboard::CreateDashboardError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>The name of the dashboard. The name must be unique to your account.</p>
121    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
122    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.name(input.into());
124        self
125    }
126    /// <p>The name of the dashboard. The name must be unique to your account.</p>
127    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
128    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.inner = self.inner.set_name(input);
130        self
131    }
132    /// <p>The name of the dashboard. The name must be unique to your account.</p>
133    /// <p>To create the Highlights dashboard, the name must be <code>AWSCloudTrail-Highlights</code>.</p>
134    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
135        self.inner.get_name()
136    }
137    /// <p>The refresh schedule configuration for the dashboard.</p>
138    /// <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>
139    pub fn refresh_schedule(mut self, input: crate::types::RefreshSchedule) -> Self {
140        self.inner = self.inner.refresh_schedule(input);
141        self
142    }
143    /// <p>The refresh schedule configuration for the dashboard.</p>
144    /// <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>
145    pub fn set_refresh_schedule(mut self, input: ::std::option::Option<crate::types::RefreshSchedule>) -> Self {
146        self.inner = self.inner.set_refresh_schedule(input);
147        self
148    }
149    /// <p>The refresh schedule configuration for the dashboard.</p>
150    /// <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>
151    pub fn get_refresh_schedule(&self) -> &::std::option::Option<crate::types::RefreshSchedule> {
152        self.inner.get_refresh_schedule()
153    }
154    ///
155    /// Appends an item to `TagsList`.
156    ///
157    /// To override the contents of this collection use [`set_tags_list`](Self::set_tags_list).
158    ///
159    /// <p>A list of tags.</p>
160    pub fn tags_list(mut self, input: crate::types::Tag) -> Self {
161        self.inner = self.inner.tags_list(input);
162        self
163    }
164    /// <p>A list of tags.</p>
165    pub fn set_tags_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
166        self.inner = self.inner.set_tags_list(input);
167        self
168    }
169    /// <p>A list of tags.</p>
170    pub fn get_tags_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
171        self.inner.get_tags_list()
172    }
173    /// <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>
174    pub fn termination_protection_enabled(mut self, input: bool) -> Self {
175        self.inner = self.inner.termination_protection_enabled(input);
176        self
177    }
178    /// <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>
179    pub fn set_termination_protection_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
180        self.inner = self.inner.set_termination_protection_enabled(input);
181        self
182    }
183    /// <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>
184    pub fn get_termination_protection_enabled(&self) -> &::std::option::Option<bool> {
185        self.inner.get_termination_protection_enabled()
186    }
187    ///
188    /// Appends an item to `Widgets`.
189    ///
190    /// To override the contents of this collection use [`set_widgets`](Self::set_widgets).
191    ///
192    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
193    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
194    pub fn widgets(mut self, input: crate::types::RequestWidget) -> Self {
195        self.inner = self.inner.widgets(input);
196        self
197    }
198    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
199    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
200    pub fn set_widgets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RequestWidget>>) -> Self {
201        self.inner = self.inner.set_widgets(input);
202        self
203    }
204    /// <p>An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.</p>
205    /// <p>You do not need to specify widgets for the Highlights dashboard.</p>
206    pub fn get_widgets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RequestWidget>> {
207        self.inner.get_widgets()
208    }
209}