aws_sdk_bedrock/operation/create_guardrail/
_create_guardrail_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, ::std::fmt::Debug)]
5pub struct CreateGuardrailOutput {
6    /// <p>The unique identifier of the guardrail that was created.</p>
7    pub guardrail_id: ::std::string::String,
8    /// <p>The ARN of the guardrail.</p>
9    pub guardrail_arn: ::std::string::String,
10    /// <p>The version of the guardrail that was created. This value will always be <code>DRAFT</code>.</p>
11    pub version: ::std::string::String,
12    /// <p>The time at which the guardrail was created.</p>
13    pub created_at: ::aws_smithy_types::DateTime,
14    _request_id: Option<String>,
15}
16impl CreateGuardrailOutput {
17    /// <p>The unique identifier of the guardrail that was created.</p>
18    pub fn guardrail_id(&self) -> &str {
19        use std::ops::Deref;
20        self.guardrail_id.deref()
21    }
22    /// <p>The ARN of the guardrail.</p>
23    pub fn guardrail_arn(&self) -> &str {
24        use std::ops::Deref;
25        self.guardrail_arn.deref()
26    }
27    /// <p>The version of the guardrail that was created. This value will always be <code>DRAFT</code>.</p>
28    pub fn version(&self) -> &str {
29        use std::ops::Deref;
30        self.version.deref()
31    }
32    /// <p>The time at which the guardrail was created.</p>
33    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
34        &self.created_at
35    }
36}
37impl ::aws_types::request_id::RequestId for CreateGuardrailOutput {
38    fn request_id(&self) -> Option<&str> {
39        self._request_id.as_deref()
40    }
41}
42impl CreateGuardrailOutput {
43    /// Creates a new builder-style object to manufacture [`CreateGuardrailOutput`](crate::operation::create_guardrail::CreateGuardrailOutput).
44    pub fn builder() -> crate::operation::create_guardrail::builders::CreateGuardrailOutputBuilder {
45        crate::operation::create_guardrail::builders::CreateGuardrailOutputBuilder::default()
46    }
47}
48
49/// A builder for [`CreateGuardrailOutput`](crate::operation::create_guardrail::CreateGuardrailOutput).
50#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
51#[non_exhaustive]
52pub struct CreateGuardrailOutputBuilder {
53    pub(crate) guardrail_id: ::std::option::Option<::std::string::String>,
54    pub(crate) guardrail_arn: ::std::option::Option<::std::string::String>,
55    pub(crate) version: ::std::option::Option<::std::string::String>,
56    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
57    _request_id: Option<String>,
58}
59impl CreateGuardrailOutputBuilder {
60    /// <p>The unique identifier of the guardrail that was created.</p>
61    /// This field is required.
62    pub fn guardrail_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63        self.guardrail_id = ::std::option::Option::Some(input.into());
64        self
65    }
66    /// <p>The unique identifier of the guardrail that was created.</p>
67    pub fn set_guardrail_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
68        self.guardrail_id = input;
69        self
70    }
71    /// <p>The unique identifier of the guardrail that was created.</p>
72    pub fn get_guardrail_id(&self) -> &::std::option::Option<::std::string::String> {
73        &self.guardrail_id
74    }
75    /// <p>The ARN of the guardrail.</p>
76    /// This field is required.
77    pub fn guardrail_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.guardrail_arn = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <p>The ARN of the guardrail.</p>
82    pub fn set_guardrail_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.guardrail_arn = input;
84        self
85    }
86    /// <p>The ARN of the guardrail.</p>
87    pub fn get_guardrail_arn(&self) -> &::std::option::Option<::std::string::String> {
88        &self.guardrail_arn
89    }
90    /// <p>The version of the guardrail that was created. This value will always be <code>DRAFT</code>.</p>
91    /// This field is required.
92    pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93        self.version = ::std::option::Option::Some(input.into());
94        self
95    }
96    /// <p>The version of the guardrail that was created. This value will always be <code>DRAFT</code>.</p>
97    pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98        self.version = input;
99        self
100    }
101    /// <p>The version of the guardrail that was created. This value will always be <code>DRAFT</code>.</p>
102    pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
103        &self.version
104    }
105    /// <p>The time at which the guardrail was created.</p>
106    /// This field is required.
107    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
108        self.created_at = ::std::option::Option::Some(input);
109        self
110    }
111    /// <p>The time at which the guardrail was created.</p>
112    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
113        self.created_at = input;
114        self
115    }
116    /// <p>The time at which the guardrail was created.</p>
117    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
118        &self.created_at
119    }
120    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
121        self._request_id = Some(request_id.into());
122        self
123    }
124
125    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
126        self._request_id = request_id;
127        self
128    }
129    /// Consumes the builder and constructs a [`CreateGuardrailOutput`](crate::operation::create_guardrail::CreateGuardrailOutput).
130    /// This method will fail if any of the following fields are not set:
131    /// - [`guardrail_id`](crate::operation::create_guardrail::builders::CreateGuardrailOutputBuilder::guardrail_id)
132    /// - [`guardrail_arn`](crate::operation::create_guardrail::builders::CreateGuardrailOutputBuilder::guardrail_arn)
133    /// - [`version`](crate::operation::create_guardrail::builders::CreateGuardrailOutputBuilder::version)
134    /// - [`created_at`](crate::operation::create_guardrail::builders::CreateGuardrailOutputBuilder::created_at)
135    pub fn build(
136        self,
137    ) -> ::std::result::Result<crate::operation::create_guardrail::CreateGuardrailOutput, ::aws_smithy_types::error::operation::BuildError> {
138        ::std::result::Result::Ok(crate::operation::create_guardrail::CreateGuardrailOutput {
139            guardrail_id: self.guardrail_id.ok_or_else(|| {
140                ::aws_smithy_types::error::operation::BuildError::missing_field(
141                    "guardrail_id",
142                    "guardrail_id was not specified but it is required when building CreateGuardrailOutput",
143                )
144            })?,
145            guardrail_arn: self.guardrail_arn.ok_or_else(|| {
146                ::aws_smithy_types::error::operation::BuildError::missing_field(
147                    "guardrail_arn",
148                    "guardrail_arn was not specified but it is required when building CreateGuardrailOutput",
149                )
150            })?,
151            version: self.version.ok_or_else(|| {
152                ::aws_smithy_types::error::operation::BuildError::missing_field(
153                    "version",
154                    "version was not specified but it is required when building CreateGuardrailOutput",
155                )
156            })?,
157            created_at: self.created_at.ok_or_else(|| {
158                ::aws_smithy_types::error::operation::BuildError::missing_field(
159                    "created_at",
160                    "created_at was not specified but it is required when building CreateGuardrailOutput",
161                )
162            })?,
163            _request_id: self._request_id,
164        })
165    }
166}