aws_sdk_datazone/types/
_resource.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Resource {
7 pub provider: ::std::option::Option<::std::string::String>,
9 pub name: ::std::option::Option<::std::string::String>,
11 pub value: ::std::string::String,
13 pub r#type: ::std::string::String,
15}
16impl Resource {
17 pub fn provider(&self) -> ::std::option::Option<&str> {
19 self.provider.as_deref()
20 }
21 pub fn name(&self) -> ::std::option::Option<&str> {
23 self.name.as_deref()
24 }
25 pub fn value(&self) -> &str {
27 use std::ops::Deref;
28 self.value.deref()
29 }
30 pub fn r#type(&self) -> &str {
32 use std::ops::Deref;
33 self.r#type.deref()
34 }
35}
36impl Resource {
37 pub fn builder() -> crate::types::builders::ResourceBuilder {
39 crate::types::builders::ResourceBuilder::default()
40 }
41}
42
43#[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 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 pub fn set_provider(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60 self.provider = input;
61 self
62 }
63 pub fn get_provider(&self) -> &::std::option::Option<::std::string::String> {
65 &self.provider
66 }
67 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 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74 self.name = input;
75 self
76 }
77 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
79 &self.name
80 }
81 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 pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89 self.value = input;
90 self
91 }
92 pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
94 &self.value
95 }
96 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 pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104 self.r#type = input;
105 self
106 }
107 pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
109 &self.r#type
110 }
111 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}