aws-sdk-glue 1.149.0

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

/// <p>Specifies a transform that writes samples of the data to an Amazon S3 bucket.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Spigot {
    /// <p>The name of the transform node.</p>
    pub name: ::std::string::String,
    /// <p>The data inputs identified by their node names.</p>
    pub inputs: ::std::vec::Vec<::std::string::String>,
    /// <p>A path in Amazon S3 where the transform will write a subset of records from the dataset to a JSON file in an Amazon S3 bucket.</p>
    pub path: ::std::string::String,
    /// <p>Specifies a number of records to write starting from the beginning of the dataset.</p>
    pub topk: ::std::option::Option<i32>,
    /// <p>The probability (a decimal value with a maximum value of 1) of picking any given record. A value of 1 indicates that each row read from the dataset should be included in the sample output.</p>
    pub prob: ::std::option::Option<f64>,
}
impl Spigot {
    /// <p>The name of the transform node.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>The data inputs identified by their node names.</p>
    pub fn inputs(&self) -> &[::std::string::String] {
        use std::ops::Deref;
        self.inputs.deref()
    }
    /// <p>A path in Amazon S3 where the transform will write a subset of records from the dataset to a JSON file in an Amazon S3 bucket.</p>
    pub fn path(&self) -> &str {
        use std::ops::Deref;
        self.path.deref()
    }
    /// <p>Specifies a number of records to write starting from the beginning of the dataset.</p>
    pub fn topk(&self) -> ::std::option::Option<i32> {
        self.topk
    }
    /// <p>The probability (a decimal value with a maximum value of 1) of picking any given record. A value of 1 indicates that each row read from the dataset should be included in the sample output.</p>
    pub fn prob(&self) -> ::std::option::Option<f64> {
        self.prob
    }
}
impl Spigot {
    /// Creates a new builder-style object to manufacture [`Spigot`](crate::types::Spigot).
    pub fn builder() -> crate::types::builders::SpigotBuilder {
        crate::types::builders::SpigotBuilder::default()
    }
}

/// A builder for [`Spigot`](crate::types::Spigot).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SpigotBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) inputs: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) path: ::std::option::Option<::std::string::String>,
    pub(crate) topk: ::std::option::Option<i32>,
    pub(crate) prob: ::std::option::Option<f64>,
}
impl SpigotBuilder {
    /// <p>The name of the transform node.</p>
    /// This field is required.
    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 transform node.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the transform node.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// Appends an item to `inputs`.
    ///
    /// To override the contents of this collection use [`set_inputs`](Self::set_inputs).
    ///
    /// <p>The data inputs identified by their node names.</p>
    pub fn inputs(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.inputs.unwrap_or_default();
        v.push(input.into());
        self.inputs = ::std::option::Option::Some(v);
        self
    }
    /// <p>The data inputs identified by their node names.</p>
    pub fn set_inputs(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.inputs = input;
        self
    }
    /// <p>The data inputs identified by their node names.</p>
    pub fn get_inputs(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.inputs
    }
    /// <p>A path in Amazon S3 where the transform will write a subset of records from the dataset to a JSON file in an Amazon S3 bucket.</p>
    /// This field is required.
    pub fn path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.path = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A path in Amazon S3 where the transform will write a subset of records from the dataset to a JSON file in an Amazon S3 bucket.</p>
    pub fn set_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.path = input;
        self
    }
    /// <p>A path in Amazon S3 where the transform will write a subset of records from the dataset to a JSON file in an Amazon S3 bucket.</p>
    pub fn get_path(&self) -> &::std::option::Option<::std::string::String> {
        &self.path
    }
    /// <p>Specifies a number of records to write starting from the beginning of the dataset.</p>
    pub fn topk(mut self, input: i32) -> Self {
        self.topk = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies a number of records to write starting from the beginning of the dataset.</p>
    pub fn set_topk(mut self, input: ::std::option::Option<i32>) -> Self {
        self.topk = input;
        self
    }
    /// <p>Specifies a number of records to write starting from the beginning of the dataset.</p>
    pub fn get_topk(&self) -> &::std::option::Option<i32> {
        &self.topk
    }
    /// <p>The probability (a decimal value with a maximum value of 1) of picking any given record. A value of 1 indicates that each row read from the dataset should be included in the sample output.</p>
    pub fn prob(mut self, input: f64) -> Self {
        self.prob = ::std::option::Option::Some(input);
        self
    }
    /// <p>The probability (a decimal value with a maximum value of 1) of picking any given record. A value of 1 indicates that each row read from the dataset should be included in the sample output.</p>
    pub fn set_prob(mut self, input: ::std::option::Option<f64>) -> Self {
        self.prob = input;
        self
    }
    /// <p>The probability (a decimal value with a maximum value of 1) of picking any given record. A value of 1 indicates that each row read from the dataset should be included in the sample output.</p>
    pub fn get_prob(&self) -> &::std::option::Option<f64> {
        &self.prob
    }
    /// Consumes the builder and constructs a [`Spigot`](crate::types::Spigot).
    /// This method will fail if any of the following fields are not set:
    /// - [`name`](crate::types::builders::SpigotBuilder::name)
    /// - [`inputs`](crate::types::builders::SpigotBuilder::inputs)
    /// - [`path`](crate::types::builders::SpigotBuilder::path)
    pub fn build(self) -> ::std::result::Result<crate::types::Spigot, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Spigot {
            name: self.name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "name",
                    "name was not specified but it is required when building Spigot",
                )
            })?,
            inputs: self.inputs.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "inputs",
                    "inputs was not specified but it is required when building Spigot",
                )
            })?,
            path: self.path.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "path",
                    "path was not specified but it is required when building Spigot",
                )
            })?,
            topk: self.topk,
            prob: self.prob,
        })
    }
}