aws-sdk-batch 1.114.0

AWS SDK for AWS Batch
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>An object that represents a container instance host device.</p><note>
/// <p>This object isn't applicable to jobs that are running on Fargate resources and shouldn't be provided.</p>
/// </note>
#[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::option::Option<::std::string::String>,
    /// <p>The path inside the container that's used to expose the host device. By default, the <code>hostPath</code> value is used.</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) -> ::std::option::Option<&str> {
        self.host_path.as_deref()
    }
    /// <p>The path inside the container that's used to expose the host device. By default, the <code>hostPath</code> value is used.</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 that's used to expose the host device. By default, the <code>hostPath</code> value is used.</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 that's used to expose the host device. By default, the <code>hostPath</code> value is used.</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 that's used to expose the host device. By default, the <code>hostPath</code> value is used.</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).
    pub fn build(self) -> crate::types::Device {
        crate::types::Device {
            host_path: self.host_path,
            container_path: self.container_path,
            permissions: self.permissions,
        }
    }
}