aws-sdk-emr 1.121.0

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

/// <p>An entity describing an executable that runs on a cluster.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Command {
    /// <p>The name of the command.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The Amazon S3 location of the command script.</p>
    pub script_path: ::std::option::Option<::std::string::String>,
    /// <p>Arguments for Amazon EMR to pass to the command for execution.</p>
    pub args: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Command {
    /// <p>The name of the command.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The Amazon S3 location of the command script.</p>
    pub fn script_path(&self) -> ::std::option::Option<&str> {
        self.script_path.as_deref()
    }
    /// <p>Arguments for Amazon EMR to pass to the command for execution.</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 `.args.is_none()`.
    pub fn args(&self) -> &[::std::string::String] {
        self.args.as_deref().unwrap_or_default()
    }
}
impl Command {
    /// Creates a new builder-style object to manufacture [`Command`](crate::types::Command).
    pub fn builder() -> crate::types::builders::CommandBuilder {
        crate::types::builders::CommandBuilder::default()
    }
}

/// A builder for [`Command`](crate::types::Command).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CommandBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) script_path: ::std::option::Option<::std::string::String>,
    pub(crate) args: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl CommandBuilder {
    /// <p>The name of the command.</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the command.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the command.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>The Amazon S3 location of the command script.</p>
    pub fn script_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.script_path = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon S3 location of the command script.</p>
    pub fn set_script_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.script_path = input;
        self
    }
    /// <p>The Amazon S3 location of the command script.</p>
    pub fn get_script_path(&self) -> &::std::option::Option<::std::string::String> {
        &self.script_path
    }
    /// Appends an item to `args`.
    ///
    /// To override the contents of this collection use [`set_args`](Self::set_args).
    ///
    /// <p>Arguments for Amazon EMR to pass to the command for execution.</p>
    pub fn args(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.args.unwrap_or_default();
        v.push(input.into());
        self.args = ::std::option::Option::Some(v);
        self
    }
    /// <p>Arguments for Amazon EMR to pass to the command for execution.</p>
    pub fn set_args(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.args = input;
        self
    }
    /// <p>Arguments for Amazon EMR to pass to the command for execution.</p>
    pub fn get_args(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.args
    }
    /// Consumes the builder and constructs a [`Command`](crate::types::Command).
    pub fn build(self) -> crate::types::Command {
        crate::types::Command {
            name: self.name,
            script_path: self.script_path,
            args: self.args,
        }
    }
}