Skip to main content

aws_sdk_codebuild/types/
_cloud_watch_logs_config.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Information about CloudWatch Logs for a build project.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CloudWatchLogsConfig {
7    /// <p>The current status of the logs in CloudWatch Logs for a build project. Valid values are:</p>
8    /// <ul>
9    /// <li>
10    /// <p><code>ENABLED</code>: CloudWatch Logs are enabled for this build project.</p></li>
11    /// <li>
12    /// <p><code>DISABLED</code>: CloudWatch Logs are not enabled for this build project.</p></li>
13    /// </ul>
14    pub status: crate::types::LogsConfigStatusType,
15    /// <p>The group name of the logs in CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
16    pub group_name: ::std::option::Option<::std::string::String>,
17    /// <p>The prefix of the stream name of the CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
18    pub stream_name: ::std::option::Option<::std::string::String>,
19}
20impl CloudWatchLogsConfig {
21    /// <p>The current status of the logs in CloudWatch Logs for a build project. Valid values are:</p>
22    /// <ul>
23    /// <li>
24    /// <p><code>ENABLED</code>: CloudWatch Logs are enabled for this build project.</p></li>
25    /// <li>
26    /// <p><code>DISABLED</code>: CloudWatch Logs are not enabled for this build project.</p></li>
27    /// </ul>
28    pub fn status(&self) -> &crate::types::LogsConfigStatusType {
29        &self.status
30    }
31    /// <p>The group name of the logs in CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
32    pub fn group_name(&self) -> ::std::option::Option<&str> {
33        self.group_name.as_deref()
34    }
35    /// <p>The prefix of the stream name of the CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
36    pub fn stream_name(&self) -> ::std::option::Option<&str> {
37        self.stream_name.as_deref()
38    }
39}
40impl CloudWatchLogsConfig {
41    /// Creates a new builder-style object to manufacture [`CloudWatchLogsConfig`](crate::types::CloudWatchLogsConfig).
42    pub fn builder() -> crate::types::builders::CloudWatchLogsConfigBuilder {
43        crate::types::builders::CloudWatchLogsConfigBuilder::default()
44    }
45}
46
47/// A builder for [`CloudWatchLogsConfig`](crate::types::CloudWatchLogsConfig).
48#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
49#[non_exhaustive]
50pub struct CloudWatchLogsConfigBuilder {
51    pub(crate) status: ::std::option::Option<crate::types::LogsConfigStatusType>,
52    pub(crate) group_name: ::std::option::Option<::std::string::String>,
53    pub(crate) stream_name: ::std::option::Option<::std::string::String>,
54}
55impl CloudWatchLogsConfigBuilder {
56    /// <p>The current status of the logs in CloudWatch Logs for a build project. Valid values are:</p>
57    /// <ul>
58    /// <li>
59    /// <p><code>ENABLED</code>: CloudWatch Logs are enabled for this build project.</p></li>
60    /// <li>
61    /// <p><code>DISABLED</code>: CloudWatch Logs are not enabled for this build project.</p></li>
62    /// </ul>
63    /// This field is required.
64    pub fn status(mut self, input: crate::types::LogsConfigStatusType) -> Self {
65        self.status = ::std::option::Option::Some(input);
66        self
67    }
68    /// <p>The current status of the logs in CloudWatch Logs for a build project. Valid values are:</p>
69    /// <ul>
70    /// <li>
71    /// <p><code>ENABLED</code>: CloudWatch Logs are enabled for this build project.</p></li>
72    /// <li>
73    /// <p><code>DISABLED</code>: CloudWatch Logs are not enabled for this build project.</p></li>
74    /// </ul>
75    pub fn set_status(mut self, input: ::std::option::Option<crate::types::LogsConfigStatusType>) -> Self {
76        self.status = input;
77        self
78    }
79    /// <p>The current status of the logs in CloudWatch Logs for a build project. Valid values are:</p>
80    /// <ul>
81    /// <li>
82    /// <p><code>ENABLED</code>: CloudWatch Logs are enabled for this build project.</p></li>
83    /// <li>
84    /// <p><code>DISABLED</code>: CloudWatch Logs are not enabled for this build project.</p></li>
85    /// </ul>
86    pub fn get_status(&self) -> &::std::option::Option<crate::types::LogsConfigStatusType> {
87        &self.status
88    }
89    /// <p>The group name of the logs in CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
90    pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.group_name = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>The group name of the logs in CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
95    pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.group_name = input;
97        self
98    }
99    /// <p>The group name of the logs in CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
100    pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
101        &self.group_name
102    }
103    /// <p>The prefix of the stream name of the CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
104    pub fn stream_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.stream_name = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <p>The prefix of the stream name of the CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
109    pub fn set_stream_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110        self.stream_name = input;
111        self
112    }
113    /// <p>The prefix of the stream name of the CloudWatch Logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html">Working with Log Groups and Log Streams</a>.</p>
114    pub fn get_stream_name(&self) -> &::std::option::Option<::std::string::String> {
115        &self.stream_name
116    }
117    /// Consumes the builder and constructs a [`CloudWatchLogsConfig`](crate::types::CloudWatchLogsConfig).
118    /// This method will fail if any of the following fields are not set:
119    /// - [`status`](crate::types::builders::CloudWatchLogsConfigBuilder::status)
120    pub fn build(self) -> ::std::result::Result<crate::types::CloudWatchLogsConfig, ::aws_smithy_types::error::operation::BuildError> {
121        ::std::result::Result::Ok(crate::types::CloudWatchLogsConfig {
122            status: self.status.ok_or_else(|| {
123                ::aws_smithy_types::error::operation::BuildError::missing_field(
124                    "status",
125                    "status was not specified but it is required when building CloudWatchLogsConfig",
126                )
127            })?,
128            group_name: self.group_name,
129            stream_name: self.stream_name,
130        })
131    }
132}