aws_sdk_datazone/operation/create_rule/
_create_rule_output.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)]
5pub struct CreateRuleOutput {
6    /// <p>The ID of the rule.</p>
7    pub identifier: ::std::string::String,
8    /// <p>The name of the rule.</p>
9    pub name: ::std::string::String,
10    /// <p>The type of the rule.</p>
11    pub rule_type: crate::types::RuleType,
12    /// <p>The target of the rule.</p>
13    pub target: ::std::option::Option<crate::types::RuleTarget>,
14    /// <p>The action of the rule.</p>
15    pub action: crate::types::RuleAction,
16    /// <p>The scope of the rule.</p>
17    pub scope: ::std::option::Option<crate::types::RuleScope>,
18    /// <p>The detail of the rule.</p>
19    pub detail: ::std::option::Option<crate::types::RuleDetail>,
20    /// <p>The target type of the rule.</p>
21    pub target_type: ::std::option::Option<crate::types::RuleTargetType>,
22    /// <p>The description of the rule.</p>
23    pub description: ::std::option::Option<::std::string::String>,
24    /// <p>The timestamp at which the rule is created.</p>
25    pub created_at: ::aws_smithy_types::DateTime,
26    /// <p>The user who creates the rule.</p>
27    pub created_by: ::std::string::String,
28    _request_id: Option<String>,
29}
30impl CreateRuleOutput {
31    /// <p>The ID of the rule.</p>
32    pub fn identifier(&self) -> &str {
33        use std::ops::Deref;
34        self.identifier.deref()
35    }
36    /// <p>The name of the rule.</p>
37    pub fn name(&self) -> &str {
38        use std::ops::Deref;
39        self.name.deref()
40    }
41    /// <p>The type of the rule.</p>
42    pub fn rule_type(&self) -> &crate::types::RuleType {
43        &self.rule_type
44    }
45    /// <p>The target of the rule.</p>
46    pub fn target(&self) -> ::std::option::Option<&crate::types::RuleTarget> {
47        self.target.as_ref()
48    }
49    /// <p>The action of the rule.</p>
50    pub fn action(&self) -> &crate::types::RuleAction {
51        &self.action
52    }
53    /// <p>The scope of the rule.</p>
54    pub fn scope(&self) -> ::std::option::Option<&crate::types::RuleScope> {
55        self.scope.as_ref()
56    }
57    /// <p>The detail of the rule.</p>
58    pub fn detail(&self) -> ::std::option::Option<&crate::types::RuleDetail> {
59        self.detail.as_ref()
60    }
61    /// <p>The target type of the rule.</p>
62    pub fn target_type(&self) -> ::std::option::Option<&crate::types::RuleTargetType> {
63        self.target_type.as_ref()
64    }
65    /// <p>The description of the rule.</p>
66    pub fn description(&self) -> ::std::option::Option<&str> {
67        self.description.as_deref()
68    }
69    /// <p>The timestamp at which the rule is created.</p>
70    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
71        &self.created_at
72    }
73    /// <p>The user who creates the rule.</p>
74    pub fn created_by(&self) -> &str {
75        use std::ops::Deref;
76        self.created_by.deref()
77    }
78}
79impl ::std::fmt::Debug for CreateRuleOutput {
80    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
81        let mut formatter = f.debug_struct("CreateRuleOutput");
82        formatter.field("identifier", &self.identifier);
83        formatter.field("name", &"*** Sensitive Data Redacted ***");
84        formatter.field("rule_type", &self.rule_type);
85        formatter.field("target", &self.target);
86        formatter.field("action", &self.action);
87        formatter.field("scope", &self.scope);
88        formatter.field("detail", &self.detail);
89        formatter.field("target_type", &self.target_type);
90        formatter.field("description", &"*** Sensitive Data Redacted ***");
91        formatter.field("created_at", &self.created_at);
92        formatter.field("created_by", &self.created_by);
93        formatter.field("_request_id", &self._request_id);
94        formatter.finish()
95    }
96}
97impl ::aws_types::request_id::RequestId for CreateRuleOutput {
98    fn request_id(&self) -> Option<&str> {
99        self._request_id.as_deref()
100    }
101}
102impl CreateRuleOutput {
103    /// Creates a new builder-style object to manufacture [`CreateRuleOutput`](crate::operation::create_rule::CreateRuleOutput).
104    pub fn builder() -> crate::operation::create_rule::builders::CreateRuleOutputBuilder {
105        crate::operation::create_rule::builders::CreateRuleOutputBuilder::default()
106    }
107}
108
109/// A builder for [`CreateRuleOutput`](crate::operation::create_rule::CreateRuleOutput).
110#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
111#[non_exhaustive]
112pub struct CreateRuleOutputBuilder {
113    pub(crate) identifier: ::std::option::Option<::std::string::String>,
114    pub(crate) name: ::std::option::Option<::std::string::String>,
115    pub(crate) rule_type: ::std::option::Option<crate::types::RuleType>,
116    pub(crate) target: ::std::option::Option<crate::types::RuleTarget>,
117    pub(crate) action: ::std::option::Option<crate::types::RuleAction>,
118    pub(crate) scope: ::std::option::Option<crate::types::RuleScope>,
119    pub(crate) detail: ::std::option::Option<crate::types::RuleDetail>,
120    pub(crate) target_type: ::std::option::Option<crate::types::RuleTargetType>,
121    pub(crate) description: ::std::option::Option<::std::string::String>,
122    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
123    pub(crate) created_by: ::std::option::Option<::std::string::String>,
124    _request_id: Option<String>,
125}
126impl CreateRuleOutputBuilder {
127    /// <p>The ID of the rule.</p>
128    /// This field is required.
129    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.identifier = ::std::option::Option::Some(input.into());
131        self
132    }
133    /// <p>The ID of the rule.</p>
134    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.identifier = input;
136        self
137    }
138    /// <p>The ID of the rule.</p>
139    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
140        &self.identifier
141    }
142    /// <p>The name of the rule.</p>
143    /// This field is required.
144    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.name = ::std::option::Option::Some(input.into());
146        self
147    }
148    /// <p>The name of the rule.</p>
149    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.name = input;
151        self
152    }
153    /// <p>The name of the rule.</p>
154    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
155        &self.name
156    }
157    /// <p>The type of the rule.</p>
158    /// This field is required.
159    pub fn rule_type(mut self, input: crate::types::RuleType) -> Self {
160        self.rule_type = ::std::option::Option::Some(input);
161        self
162    }
163    /// <p>The type of the rule.</p>
164    pub fn set_rule_type(mut self, input: ::std::option::Option<crate::types::RuleType>) -> Self {
165        self.rule_type = input;
166        self
167    }
168    /// <p>The type of the rule.</p>
169    pub fn get_rule_type(&self) -> &::std::option::Option<crate::types::RuleType> {
170        &self.rule_type
171    }
172    /// <p>The target of the rule.</p>
173    /// This field is required.
174    pub fn target(mut self, input: crate::types::RuleTarget) -> Self {
175        self.target = ::std::option::Option::Some(input);
176        self
177    }
178    /// <p>The target of the rule.</p>
179    pub fn set_target(mut self, input: ::std::option::Option<crate::types::RuleTarget>) -> Self {
180        self.target = input;
181        self
182    }
183    /// <p>The target of the rule.</p>
184    pub fn get_target(&self) -> &::std::option::Option<crate::types::RuleTarget> {
185        &self.target
186    }
187    /// <p>The action of the rule.</p>
188    /// This field is required.
189    pub fn action(mut self, input: crate::types::RuleAction) -> Self {
190        self.action = ::std::option::Option::Some(input);
191        self
192    }
193    /// <p>The action of the rule.</p>
194    pub fn set_action(mut self, input: ::std::option::Option<crate::types::RuleAction>) -> Self {
195        self.action = input;
196        self
197    }
198    /// <p>The action of the rule.</p>
199    pub fn get_action(&self) -> &::std::option::Option<crate::types::RuleAction> {
200        &self.action
201    }
202    /// <p>The scope of the rule.</p>
203    /// This field is required.
204    pub fn scope(mut self, input: crate::types::RuleScope) -> Self {
205        self.scope = ::std::option::Option::Some(input);
206        self
207    }
208    /// <p>The scope of the rule.</p>
209    pub fn set_scope(mut self, input: ::std::option::Option<crate::types::RuleScope>) -> Self {
210        self.scope = input;
211        self
212    }
213    /// <p>The scope of the rule.</p>
214    pub fn get_scope(&self) -> &::std::option::Option<crate::types::RuleScope> {
215        &self.scope
216    }
217    /// <p>The detail of the rule.</p>
218    /// This field is required.
219    pub fn detail(mut self, input: crate::types::RuleDetail) -> Self {
220        self.detail = ::std::option::Option::Some(input);
221        self
222    }
223    /// <p>The detail of the rule.</p>
224    pub fn set_detail(mut self, input: ::std::option::Option<crate::types::RuleDetail>) -> Self {
225        self.detail = input;
226        self
227    }
228    /// <p>The detail of the rule.</p>
229    pub fn get_detail(&self) -> &::std::option::Option<crate::types::RuleDetail> {
230        &self.detail
231    }
232    /// <p>The target type of the rule.</p>
233    pub fn target_type(mut self, input: crate::types::RuleTargetType) -> Self {
234        self.target_type = ::std::option::Option::Some(input);
235        self
236    }
237    /// <p>The target type of the rule.</p>
238    pub fn set_target_type(mut self, input: ::std::option::Option<crate::types::RuleTargetType>) -> Self {
239        self.target_type = input;
240        self
241    }
242    /// <p>The target type of the rule.</p>
243    pub fn get_target_type(&self) -> &::std::option::Option<crate::types::RuleTargetType> {
244        &self.target_type
245    }
246    /// <p>The description of the rule.</p>
247    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
248        self.description = ::std::option::Option::Some(input.into());
249        self
250    }
251    /// <p>The description of the rule.</p>
252    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
253        self.description = input;
254        self
255    }
256    /// <p>The description of the rule.</p>
257    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
258        &self.description
259    }
260    /// <p>The timestamp at which the rule is created.</p>
261    /// This field is required.
262    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
263        self.created_at = ::std::option::Option::Some(input);
264        self
265    }
266    /// <p>The timestamp at which the rule is created.</p>
267    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
268        self.created_at = input;
269        self
270    }
271    /// <p>The timestamp at which the rule is created.</p>
272    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
273        &self.created_at
274    }
275    /// <p>The user who creates the rule.</p>
276    /// This field is required.
277    pub fn created_by(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
278        self.created_by = ::std::option::Option::Some(input.into());
279        self
280    }
281    /// <p>The user who creates the rule.</p>
282    pub fn set_created_by(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
283        self.created_by = input;
284        self
285    }
286    /// <p>The user who creates the rule.</p>
287    pub fn get_created_by(&self) -> &::std::option::Option<::std::string::String> {
288        &self.created_by
289    }
290    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
291        self._request_id = Some(request_id.into());
292        self
293    }
294
295    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
296        self._request_id = request_id;
297        self
298    }
299    /// Consumes the builder and constructs a [`CreateRuleOutput`](crate::operation::create_rule::CreateRuleOutput).
300    /// This method will fail if any of the following fields are not set:
301    /// - [`identifier`](crate::operation::create_rule::builders::CreateRuleOutputBuilder::identifier)
302    /// - [`name`](crate::operation::create_rule::builders::CreateRuleOutputBuilder::name)
303    /// - [`rule_type`](crate::operation::create_rule::builders::CreateRuleOutputBuilder::rule_type)
304    /// - [`action`](crate::operation::create_rule::builders::CreateRuleOutputBuilder::action)
305    /// - [`created_at`](crate::operation::create_rule::builders::CreateRuleOutputBuilder::created_at)
306    /// - [`created_by`](crate::operation::create_rule::builders::CreateRuleOutputBuilder::created_by)
307    pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleOutput, ::aws_smithy_types::error::operation::BuildError> {
308        ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleOutput {
309            identifier: self.identifier.ok_or_else(|| {
310                ::aws_smithy_types::error::operation::BuildError::missing_field(
311                    "identifier",
312                    "identifier was not specified but it is required when building CreateRuleOutput",
313                )
314            })?,
315            name: self.name.ok_or_else(|| {
316                ::aws_smithy_types::error::operation::BuildError::missing_field(
317                    "name",
318                    "name was not specified but it is required when building CreateRuleOutput",
319                )
320            })?,
321            rule_type: self.rule_type.ok_or_else(|| {
322                ::aws_smithy_types::error::operation::BuildError::missing_field(
323                    "rule_type",
324                    "rule_type was not specified but it is required when building CreateRuleOutput",
325                )
326            })?,
327            target: self.target,
328            action: self.action.ok_or_else(|| {
329                ::aws_smithy_types::error::operation::BuildError::missing_field(
330                    "action",
331                    "action was not specified but it is required when building CreateRuleOutput",
332                )
333            })?,
334            scope: self.scope,
335            detail: self.detail,
336            target_type: self.target_type,
337            description: self.description,
338            created_at: self.created_at.ok_or_else(|| {
339                ::aws_smithy_types::error::operation::BuildError::missing_field(
340                    "created_at",
341                    "created_at was not specified but it is required when building CreateRuleOutput",
342                )
343            })?,
344            created_by: self.created_by.ok_or_else(|| {
345                ::aws_smithy_types::error::operation::BuildError::missing_field(
346                    "created_by",
347                    "created_by was not specified but it is required when building CreateRuleOutput",
348                )
349            })?,
350            _request_id: self._request_id,
351        })
352    }
353}
354impl ::std::fmt::Debug for CreateRuleOutputBuilder {
355    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
356        let mut formatter = f.debug_struct("CreateRuleOutputBuilder");
357        formatter.field("identifier", &self.identifier);
358        formatter.field("name", &"*** Sensitive Data Redacted ***");
359        formatter.field("rule_type", &self.rule_type);
360        formatter.field("target", &self.target);
361        formatter.field("action", &self.action);
362        formatter.field("scope", &self.scope);
363        formatter.field("detail", &self.detail);
364        formatter.field("target_type", &self.target_type);
365        formatter.field("description", &"*** Sensitive Data Redacted ***");
366        formatter.field("created_at", &self.created_at);
367        formatter.field("created_by", &self.created_by);
368        formatter.field("_request_id", &self._request_id);
369        formatter.finish()
370    }
371}