aws_sdk_machinelearning/operation/predict/
_predict_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct PredictInput {
6    /// <p>A unique identifier of the <code>MLModel</code>.</p>
7    pub ml_model_id: ::std::option::Option<::std::string::String>,
8    /// <p>A map of variable name-value pairs that represent an observation.</p>
9    pub record: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
10    #[allow(missing_docs)] // documentation missing in model
11    pub predict_endpoint: ::std::option::Option<::std::string::String>,
12}
13impl PredictInput {
14    /// <p>A unique identifier of the <code>MLModel</code>.</p>
15    pub fn ml_model_id(&self) -> ::std::option::Option<&str> {
16        self.ml_model_id.as_deref()
17    }
18    /// <p>A map of variable name-value pairs that represent an observation.</p>
19    pub fn record(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
20        self.record.as_ref()
21    }
22    #[allow(missing_docs)] // documentation missing in model
23    pub fn predict_endpoint(&self) -> ::std::option::Option<&str> {
24        self.predict_endpoint.as_deref()
25    }
26}
27impl PredictInput {
28    /// Creates a new builder-style object to manufacture [`PredictInput`](crate::operation::predict::PredictInput).
29    pub fn builder() -> crate::operation::predict::builders::PredictInputBuilder {
30        crate::operation::predict::builders::PredictInputBuilder::default()
31    }
32}
33
34/// A builder for [`PredictInput`](crate::operation::predict::PredictInput).
35#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
36#[non_exhaustive]
37pub struct PredictInputBuilder {
38    pub(crate) ml_model_id: ::std::option::Option<::std::string::String>,
39    pub(crate) record: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
40    pub(crate) predict_endpoint: ::std::option::Option<::std::string::String>,
41}
42impl PredictInputBuilder {
43    /// <p>A unique identifier of the <code>MLModel</code>.</p>
44    /// This field is required.
45    pub fn ml_model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46        self.ml_model_id = ::std::option::Option::Some(input.into());
47        self
48    }
49    /// <p>A unique identifier of the <code>MLModel</code>.</p>
50    pub fn set_ml_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.ml_model_id = input;
52        self
53    }
54    /// <p>A unique identifier of the <code>MLModel</code>.</p>
55    pub fn get_ml_model_id(&self) -> &::std::option::Option<::std::string::String> {
56        &self.ml_model_id
57    }
58    /// Adds a key-value pair to `record`.
59    ///
60    /// To override the contents of this collection use [`set_record`](Self::set_record).
61    ///
62    /// <p>A map of variable name-value pairs that represent an observation.</p>
63    pub fn record(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
64        let mut hash_map = self.record.unwrap_or_default();
65        hash_map.insert(k.into(), v.into());
66        self.record = ::std::option::Option::Some(hash_map);
67        self
68    }
69    /// <p>A map of variable name-value pairs that represent an observation.</p>
70    pub fn set_record(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
71        self.record = input;
72        self
73    }
74    /// <p>A map of variable name-value pairs that represent an observation.</p>
75    pub fn get_record(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
76        &self.record
77    }
78    #[allow(missing_docs)] // documentation missing in model
79    /// This field is required.
80    pub fn predict_endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.predict_endpoint = ::std::option::Option::Some(input.into());
82        self
83    }
84    #[allow(missing_docs)] // documentation missing in model
85    pub fn set_predict_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86        self.predict_endpoint = input;
87        self
88    }
89    #[allow(missing_docs)] // documentation missing in model
90    pub fn get_predict_endpoint(&self) -> &::std::option::Option<::std::string::String> {
91        &self.predict_endpoint
92    }
93    /// Consumes the builder and constructs a [`PredictInput`](crate::operation::predict::PredictInput).
94    pub fn build(self) -> ::std::result::Result<crate::operation::predict::PredictInput, ::aws_smithy_types::error::operation::BuildError> {
95        ::std::result::Result::Ok(crate::operation::predict::PredictInput {
96            ml_model_id: self.ml_model_id,
97            record: self.record,
98            predict_endpoint: self.predict_endpoint,
99        })
100    }
101}