aws_sdk_sagemaker/types/
_artifact_source.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A structure describing the source of an artifact.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ArtifactSource {
7    /// <p>The URI of the source.</p>
8    pub source_uri: ::std::option::Option<::std::string::String>,
9    /// <p>A list of source types.</p>
10    pub source_types: ::std::option::Option<::std::vec::Vec<crate::types::ArtifactSourceType>>,
11}
12impl ArtifactSource {
13    /// <p>The URI of the source.</p>
14    pub fn source_uri(&self) -> ::std::option::Option<&str> {
15        self.source_uri.as_deref()
16    }
17    /// <p>A list of source types.</p>
18    ///
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.source_types.is_none()`.
20    pub fn source_types(&self) -> &[crate::types::ArtifactSourceType] {
21        self.source_types.as_deref().unwrap_or_default()
22    }
23}
24impl ArtifactSource {
25    /// Creates a new builder-style object to manufacture [`ArtifactSource`](crate::types::ArtifactSource).
26    pub fn builder() -> crate::types::builders::ArtifactSourceBuilder {
27        crate::types::builders::ArtifactSourceBuilder::default()
28    }
29}
30
31/// A builder for [`ArtifactSource`](crate::types::ArtifactSource).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct ArtifactSourceBuilder {
35    pub(crate) source_uri: ::std::option::Option<::std::string::String>,
36    pub(crate) source_types: ::std::option::Option<::std::vec::Vec<crate::types::ArtifactSourceType>>,
37}
38impl ArtifactSourceBuilder {
39    /// <p>The URI of the source.</p>
40    /// This field is required.
41    pub fn source_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
42        self.source_uri = ::std::option::Option::Some(input.into());
43        self
44    }
45    /// <p>The URI of the source.</p>
46    pub fn set_source_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
47        self.source_uri = input;
48        self
49    }
50    /// <p>The URI of the source.</p>
51    pub fn get_source_uri(&self) -> &::std::option::Option<::std::string::String> {
52        &self.source_uri
53    }
54    /// Appends an item to `source_types`.
55    ///
56    /// To override the contents of this collection use [`set_source_types`](Self::set_source_types).
57    ///
58    /// <p>A list of source types.</p>
59    pub fn source_types(mut self, input: crate::types::ArtifactSourceType) -> Self {
60        let mut v = self.source_types.unwrap_or_default();
61        v.push(input);
62        self.source_types = ::std::option::Option::Some(v);
63        self
64    }
65    /// <p>A list of source types.</p>
66    pub fn set_source_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ArtifactSourceType>>) -> Self {
67        self.source_types = input;
68        self
69    }
70    /// <p>A list of source types.</p>
71    pub fn get_source_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ArtifactSourceType>> {
72        &self.source_types
73    }
74    /// Consumes the builder and constructs a [`ArtifactSource`](crate::types::ArtifactSource).
75    pub fn build(self) -> crate::types::ArtifactSource {
76        crate::types::ArtifactSource {
77            source_uri: self.source_uri,
78            source_types: self.source_types,
79        }
80    }
81}