aws_sdk_iot/types/
_enable_io_t_logging_params.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Parameters used when defining a mitigation action that enable Amazon Web Services IoT Core logging.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct EnableIoTLoggingParams {
7    /// <p>The Amazon Resource Name (ARN) of the IAM role used for logging.</p>
8    pub role_arn_for_logging: ::std::string::String,
9    /// <p>Specifies the type of information to be logged.</p>
10    pub log_level: crate::types::LogLevel,
11}
12impl EnableIoTLoggingParams {
13    /// <p>The Amazon Resource Name (ARN) of the IAM role used for logging.</p>
14    pub fn role_arn_for_logging(&self) -> &str {
15        use std::ops::Deref;
16        self.role_arn_for_logging.deref()
17    }
18    /// <p>Specifies the type of information to be logged.</p>
19    pub fn log_level(&self) -> &crate::types::LogLevel {
20        &self.log_level
21    }
22}
23impl EnableIoTLoggingParams {
24    /// Creates a new builder-style object to manufacture [`EnableIoTLoggingParams`](crate::types::EnableIoTLoggingParams).
25    pub fn builder() -> crate::types::builders::EnableIoTLoggingParamsBuilder {
26        crate::types::builders::EnableIoTLoggingParamsBuilder::default()
27    }
28}
29
30/// A builder for [`EnableIoTLoggingParams`](crate::types::EnableIoTLoggingParams).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct EnableIoTLoggingParamsBuilder {
34    pub(crate) role_arn_for_logging: ::std::option::Option<::std::string::String>,
35    pub(crate) log_level: ::std::option::Option<crate::types::LogLevel>,
36}
37impl EnableIoTLoggingParamsBuilder {
38    /// <p>The Amazon Resource Name (ARN) of the IAM role used for logging.</p>
39    /// This field is required.
40    pub fn role_arn_for_logging(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.role_arn_for_logging = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The Amazon Resource Name (ARN) of the IAM role used for logging.</p>
45    pub fn set_role_arn_for_logging(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.role_arn_for_logging = input;
47        self
48    }
49    /// <p>The Amazon Resource Name (ARN) of the IAM role used for logging.</p>
50    pub fn get_role_arn_for_logging(&self) -> &::std::option::Option<::std::string::String> {
51        &self.role_arn_for_logging
52    }
53    /// <p>Specifies the type of information to be logged.</p>
54    /// This field is required.
55    pub fn log_level(mut self, input: crate::types::LogLevel) -> Self {
56        self.log_level = ::std::option::Option::Some(input);
57        self
58    }
59    /// <p>Specifies the type of information to be logged.</p>
60    pub fn set_log_level(mut self, input: ::std::option::Option<crate::types::LogLevel>) -> Self {
61        self.log_level = input;
62        self
63    }
64    /// <p>Specifies the type of information to be logged.</p>
65    pub fn get_log_level(&self) -> &::std::option::Option<crate::types::LogLevel> {
66        &self.log_level
67    }
68    /// Consumes the builder and constructs a [`EnableIoTLoggingParams`](crate::types::EnableIoTLoggingParams).
69    /// This method will fail if any of the following fields are not set:
70    /// - [`role_arn_for_logging`](crate::types::builders::EnableIoTLoggingParamsBuilder::role_arn_for_logging)
71    /// - [`log_level`](crate::types::builders::EnableIoTLoggingParamsBuilder::log_level)
72    pub fn build(self) -> ::std::result::Result<crate::types::EnableIoTLoggingParams, ::aws_smithy_types::error::operation::BuildError> {
73        ::std::result::Result::Ok(crate::types::EnableIoTLoggingParams {
74            role_arn_for_logging: self.role_arn_for_logging.ok_or_else(|| {
75                ::aws_smithy_types::error::operation::BuildError::missing_field(
76                    "role_arn_for_logging",
77                    "role_arn_for_logging was not specified but it is required when building EnableIoTLoggingParams",
78                )
79            })?,
80            log_level: self.log_level.ok_or_else(|| {
81                ::aws_smithy_types::error::operation::BuildError::missing_field(
82                    "log_level",
83                    "log_level was not specified but it is required when building EnableIoTLoggingParams",
84                )
85            })?,
86        })
87    }
88}