Skip to main content

aws_sdk_datazone/types/
_resource.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The details of a provisioned resource of this Amazon DataZone environment.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Resource {
7    /// <p>The provider of a provisioned resource of this Amazon DataZone environment.</p>
8    pub provider: ::std::option::Option<::std::string::String>,
9    /// <p>The name of a provisioned resource of this Amazon DataZone environment.</p>
10    pub name: ::std::option::Option<::std::string::String>,
11    /// <p>The value of a provisioned resource of this Amazon DataZone environment.</p>
12    pub value: ::std::string::String,
13    /// <p>The type of a provisioned resource of this Amazon DataZone environment.</p>
14    pub r#type: ::std::string::String,
15}
16impl Resource {
17    /// <p>The provider of a provisioned resource of this Amazon DataZone environment.</p>
18    pub fn provider(&self) -> ::std::option::Option<&str> {
19        self.provider.as_deref()
20    }
21    /// <p>The name of a provisioned resource of this Amazon DataZone environment.</p>
22    pub fn name(&self) -> ::std::option::Option<&str> {
23        self.name.as_deref()
24    }
25    /// <p>The value of a provisioned resource of this Amazon DataZone environment.</p>
26    pub fn value(&self) -> &str {
27        use std::ops::Deref;
28        self.value.deref()
29    }
30    /// <p>The type of a provisioned resource of this Amazon DataZone environment.</p>
31    pub fn r#type(&self) -> &str {
32        use std::ops::Deref;
33        self.r#type.deref()
34    }
35}
36impl Resource {
37    /// Creates a new builder-style object to manufacture [`Resource`](crate::types::Resource).
38    pub fn builder() -> crate::types::builders::ResourceBuilder {
39        crate::types::builders::ResourceBuilder::default()
40    }
41}
42
43/// A builder for [`Resource`](crate::types::Resource).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct ResourceBuilder {
47    pub(crate) provider: ::std::option::Option<::std::string::String>,
48    pub(crate) name: ::std::option::Option<::std::string::String>,
49    pub(crate) value: ::std::option::Option<::std::string::String>,
50    pub(crate) r#type: ::std::option::Option<::std::string::String>,
51}
52impl ResourceBuilder {
53    /// <p>The provider of a provisioned resource of this Amazon DataZone environment.</p>
54    pub fn provider(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.provider = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>The provider of a provisioned resource of this Amazon DataZone environment.</p>
59    pub fn set_provider(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.provider = input;
61        self
62    }
63    /// <p>The provider of a provisioned resource of this Amazon DataZone environment.</p>
64    pub fn get_provider(&self) -> &::std::option::Option<::std::string::String> {
65        &self.provider
66    }
67    /// <p>The name of a provisioned resource of this Amazon DataZone environment.</p>
68    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The name of a provisioned resource of this Amazon DataZone environment.</p>
73    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.name = input;
75        self
76    }
77    /// <p>The name of a provisioned resource of this Amazon DataZone environment.</p>
78    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.name
80    }
81    /// <p>The value of a provisioned resource of this Amazon DataZone environment.</p>
82    /// This field is required.
83    pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.value = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The value of a provisioned resource of this Amazon DataZone environment.</p>
88    pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.value = input;
90        self
91    }
92    /// <p>The value of a provisioned resource of this Amazon DataZone environment.</p>
93    pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
94        &self.value
95    }
96    /// <p>The type of a provisioned resource of this Amazon DataZone environment.</p>
97    /// This field is required.
98    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.r#type = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The type of a provisioned resource of this Amazon DataZone environment.</p>
103    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.r#type = input;
105        self
106    }
107    /// <p>The type of a provisioned resource of this Amazon DataZone environment.</p>
108    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
109        &self.r#type
110    }
111    /// Consumes the builder and constructs a [`Resource`](crate::types::Resource).
112    /// This method will fail if any of the following fields are not set:
113    /// - [`value`](crate::types::builders::ResourceBuilder::value)
114    /// - [`r#type`](crate::types::builders::ResourceBuilder::type)
115    pub fn build(self) -> ::std::result::Result<crate::types::Resource, ::aws_smithy_types::error::operation::BuildError> {
116        ::std::result::Result::Ok(crate::types::Resource {
117            provider: self.provider,
118            name: self.name,
119            value: self.value.ok_or_else(|| {
120                ::aws_smithy_types::error::operation::BuildError::missing_field(
121                    "value",
122                    "value was not specified but it is required when building Resource",
123                )
124            })?,
125            r#type: self.r#type.ok_or_else(|| {
126                ::aws_smithy_types::error::operation::BuildError::missing_field(
127                    "r#type",
128                    "r#type was not specified but it is required when building Resource",
129                )
130            })?,
131        })
132    }
133}