aws_sdk_iot/types/
_maintenance_window.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An optional configuration within the <code>SchedulingConfig</code> to setup a recurring maintenance window with a predetermined start time and duration for the rollout of a job document to all devices in a target group for a job.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct MaintenanceWindow {
7    /// <p>Displays the start time of the next maintenance window.</p>
8    pub start_time: ::std::string::String,
9    /// <p>Displays the duration of the next maintenance window.</p>
10    pub duration_in_minutes: i32,
11}
12impl MaintenanceWindow {
13    /// <p>Displays the start time of the next maintenance window.</p>
14    pub fn start_time(&self) -> &str {
15        use std::ops::Deref;
16        self.start_time.deref()
17    }
18    /// <p>Displays the duration of the next maintenance window.</p>
19    pub fn duration_in_minutes(&self) -> i32 {
20        self.duration_in_minutes
21    }
22}
23impl MaintenanceWindow {
24    /// Creates a new builder-style object to manufacture [`MaintenanceWindow`](crate::types::MaintenanceWindow).
25    pub fn builder() -> crate::types::builders::MaintenanceWindowBuilder {
26        crate::types::builders::MaintenanceWindowBuilder::default()
27    }
28}
29
30/// A builder for [`MaintenanceWindow`](crate::types::MaintenanceWindow).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct MaintenanceWindowBuilder {
34    pub(crate) start_time: ::std::option::Option<::std::string::String>,
35    pub(crate) duration_in_minutes: ::std::option::Option<i32>,
36}
37impl MaintenanceWindowBuilder {
38    /// <p>Displays the start time of the next maintenance window.</p>
39    /// This field is required.
40    pub fn start_time(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.start_time = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>Displays the start time of the next maintenance window.</p>
45    pub fn set_start_time(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.start_time = input;
47        self
48    }
49    /// <p>Displays the start time of the next maintenance window.</p>
50    pub fn get_start_time(&self) -> &::std::option::Option<::std::string::String> {
51        &self.start_time
52    }
53    /// <p>Displays the duration of the next maintenance window.</p>
54    /// This field is required.
55    pub fn duration_in_minutes(mut self, input: i32) -> Self {
56        self.duration_in_minutes = ::std::option::Option::Some(input);
57        self
58    }
59    /// <p>Displays the duration of the next maintenance window.</p>
60    pub fn set_duration_in_minutes(mut self, input: ::std::option::Option<i32>) -> Self {
61        self.duration_in_minutes = input;
62        self
63    }
64    /// <p>Displays the duration of the next maintenance window.</p>
65    pub fn get_duration_in_minutes(&self) -> &::std::option::Option<i32> {
66        &self.duration_in_minutes
67    }
68    /// Consumes the builder and constructs a [`MaintenanceWindow`](crate::types::MaintenanceWindow).
69    /// This method will fail if any of the following fields are not set:
70    /// - [`start_time`](crate::types::builders::MaintenanceWindowBuilder::start_time)
71    /// - [`duration_in_minutes`](crate::types::builders::MaintenanceWindowBuilder::duration_in_minutes)
72    pub fn build(self) -> ::std::result::Result<crate::types::MaintenanceWindow, ::aws_smithy_types::error::operation::BuildError> {
73        ::std::result::Result::Ok(crate::types::MaintenanceWindow {
74            start_time: self.start_time.ok_or_else(|| {
75                ::aws_smithy_types::error::operation::BuildError::missing_field(
76                    "start_time",
77                    "start_time was not specified but it is required when building MaintenanceWindow",
78                )
79            })?,
80            duration_in_minutes: self.duration_in_minutes.ok_or_else(|| {
81                ::aws_smithy_types::error::operation::BuildError::missing_field(
82                    "duration_in_minutes",
83                    "duration_in_minutes was not specified but it is required when building MaintenanceWindow",
84                )
85            })?,
86        })
87    }
88}