1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>An object representing a container instance host device.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Device {
/// <p>The path for the device on the host container instance.</p>
pub host_path: ::std::string::String,
/// <p>The path inside the container at which to expose the host device.</p>
pub container_path: ::std::option::Option<::std::string::String>,
/// <p>The explicit permissions to provide to the container for the device. By default, the container has permissions for <code>read</code>, <code>write</code>, and <code>mknod</code> for the device.</p>
pub permissions: ::std::option::Option<::std::vec::Vec<crate::types::DeviceCgroupPermission>>,
}
impl Device {
/// <p>The path for the device on the host container instance.</p>
pub fn host_path(&self) -> &str {
use std::ops::Deref;
self.host_path.deref()
}
/// <p>The path inside the container at which to expose the host device.</p>
pub fn container_path(&self) -> ::std::option::Option<&str> {
self.container_path.as_deref()
}
/// <p>The explicit permissions to provide to the container for the device. By default, the container has permissions for <code>read</code>, <code>write</code>, and <code>mknod</code> for the device.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.permissions.is_none()`.
pub fn permissions(&self) -> &[crate::types::DeviceCgroupPermission] {
self.permissions.as_deref().unwrap_or_default()
}
}
impl Device {
/// Creates a new builder-style object to manufacture [`Device`](crate::types::Device).
pub fn builder() -> crate::types::builders::DeviceBuilder {
crate::types::builders::DeviceBuilder::default()
}
}
/// A builder for [`Device`](crate::types::Device).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct DeviceBuilder {
pub(crate) host_path: ::std::option::Option<::std::string::String>,
pub(crate) container_path: ::std::option::Option<::std::string::String>,
pub(crate) permissions: ::std::option::Option<::std::vec::Vec<crate::types::DeviceCgroupPermission>>,
}
impl DeviceBuilder {
/// <p>The path for the device on the host container instance.</p>
/// This field is required.
pub fn host_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.host_path = ::std::option::Option::Some(input.into());
self
}
/// <p>The path for the device on the host container instance.</p>
pub fn set_host_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.host_path = input;
self
}
/// <p>The path for the device on the host container instance.</p>
pub fn get_host_path(&self) -> &::std::option::Option<::std::string::String> {
&self.host_path
}
/// <p>The path inside the container at which to expose the host device.</p>
pub fn container_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.container_path = ::std::option::Option::Some(input.into());
self
}
/// <p>The path inside the container at which to expose the host device.</p>
pub fn set_container_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.container_path = input;
self
}
/// <p>The path inside the container at which to expose the host device.</p>
pub fn get_container_path(&self) -> &::std::option::Option<::std::string::String> {
&self.container_path
}
/// Appends an item to `permissions`.
///
/// To override the contents of this collection use [`set_permissions`](Self::set_permissions).
///
/// <p>The explicit permissions to provide to the container for the device. By default, the container has permissions for <code>read</code>, <code>write</code>, and <code>mknod</code> for the device.</p>
pub fn permissions(mut self, input: crate::types::DeviceCgroupPermission) -> Self {
let mut v = self.permissions.unwrap_or_default();
v.push(input);
self.permissions = ::std::option::Option::Some(v);
self
}
/// <p>The explicit permissions to provide to the container for the device. By default, the container has permissions for <code>read</code>, <code>write</code>, and <code>mknod</code> for the device.</p>
pub fn set_permissions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DeviceCgroupPermission>>) -> Self {
self.permissions = input;
self
}
/// <p>The explicit permissions to provide to the container for the device. By default, the container has permissions for <code>read</code>, <code>write</code>, and <code>mknod</code> for the device.</p>
pub fn get_permissions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DeviceCgroupPermission>> {
&self.permissions
}
/// Consumes the builder and constructs a [`Device`](crate::types::Device).
/// This method will fail if any of the following fields are not set:
/// - [`host_path`](crate::types::builders::DeviceBuilder::host_path)
pub fn build(self) -> ::std::result::Result<crate::types::Device, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Device {
host_path: self.host_path.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"host_path",
"host_path was not specified but it is required when building Device",
)
})?,
container_path: self.container_path,
permissions: self.permissions,
})
}
}