aws_sdk_bedrockagent/operation/update_prompt/
_update_prompt_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 UpdatePromptOutput {
6    /// <p>The name of the prompt.</p>
7    pub name: ::std::string::String,
8    /// <p>The description of the prompt.</p>
9    pub description: ::std::option::Option<::std::string::String>,
10    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
11    pub customer_encryption_key_arn: ::std::option::Option<::std::string::String>,
12    /// <p>The name of the default variant for the prompt. This value must match the <code>name</code> field in the relevant <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptVariant.html">PromptVariant</a> object.</p>
13    pub default_variant: ::std::option::Option<::std::string::String>,
14    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
15    pub variants: ::std::option::Option<::std::vec::Vec<crate::types::PromptVariant>>,
16    /// <p>The unique identifier of the prompt.</p>
17    pub id: ::std::string::String,
18    /// <p>The Amazon Resource Name (ARN) of the prompt.</p>
19    pub arn: ::std::string::String,
20    /// <p>The version of the prompt. When you update a prompt, the version updated is the <code>DRAFT</code> version.</p>
21    pub version: ::std::string::String,
22    /// <p>The time at which the prompt was created.</p>
23    pub created_at: ::aws_smithy_types::DateTime,
24    /// <p>The time at which the prompt was last updated.</p>
25    pub updated_at: ::aws_smithy_types::DateTime,
26    _request_id: Option<String>,
27}
28impl UpdatePromptOutput {
29    /// <p>The name of the prompt.</p>
30    pub fn name(&self) -> &str {
31        use std::ops::Deref;
32        self.name.deref()
33    }
34    /// <p>The description of the prompt.</p>
35    pub fn description(&self) -> ::std::option::Option<&str> {
36        self.description.as_deref()
37    }
38    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
39    pub fn customer_encryption_key_arn(&self) -> ::std::option::Option<&str> {
40        self.customer_encryption_key_arn.as_deref()
41    }
42    /// <p>The name of the default variant for the prompt. This value must match the <code>name</code> field in the relevant <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptVariant.html">PromptVariant</a> object.</p>
43    pub fn default_variant(&self) -> ::std::option::Option<&str> {
44        self.default_variant.as_deref()
45    }
46    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
47    ///
48    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.variants.is_none()`.
49    pub fn variants(&self) -> &[crate::types::PromptVariant] {
50        self.variants.as_deref().unwrap_or_default()
51    }
52    /// <p>The unique identifier of the prompt.</p>
53    pub fn id(&self) -> &str {
54        use std::ops::Deref;
55        self.id.deref()
56    }
57    /// <p>The Amazon Resource Name (ARN) of the prompt.</p>
58    pub fn arn(&self) -> &str {
59        use std::ops::Deref;
60        self.arn.deref()
61    }
62    /// <p>The version of the prompt. When you update a prompt, the version updated is the <code>DRAFT</code> version.</p>
63    pub fn version(&self) -> &str {
64        use std::ops::Deref;
65        self.version.deref()
66    }
67    /// <p>The time at which the prompt was created.</p>
68    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
69        &self.created_at
70    }
71    /// <p>The time at which the prompt was last updated.</p>
72    pub fn updated_at(&self) -> &::aws_smithy_types::DateTime {
73        &self.updated_at
74    }
75}
76impl ::std::fmt::Debug for UpdatePromptOutput {
77    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
78        let mut formatter = f.debug_struct("UpdatePromptOutput");
79        formatter.field("name", &self.name);
80        formatter.field("description", &self.description);
81        formatter.field("customer_encryption_key_arn", &self.customer_encryption_key_arn);
82        formatter.field("default_variant", &self.default_variant);
83        formatter.field("variants", &"*** Sensitive Data Redacted ***");
84        formatter.field("id", &self.id);
85        formatter.field("arn", &self.arn);
86        formatter.field("version", &self.version);
87        formatter.field("created_at", &self.created_at);
88        formatter.field("updated_at", &self.updated_at);
89        formatter.field("_request_id", &self._request_id);
90        formatter.finish()
91    }
92}
93impl ::aws_types::request_id::RequestId for UpdatePromptOutput {
94    fn request_id(&self) -> Option<&str> {
95        self._request_id.as_deref()
96    }
97}
98impl UpdatePromptOutput {
99    /// Creates a new builder-style object to manufacture [`UpdatePromptOutput`](crate::operation::update_prompt::UpdatePromptOutput).
100    pub fn builder() -> crate::operation::update_prompt::builders::UpdatePromptOutputBuilder {
101        crate::operation::update_prompt::builders::UpdatePromptOutputBuilder::default()
102    }
103}
104
105/// A builder for [`UpdatePromptOutput`](crate::operation::update_prompt::UpdatePromptOutput).
106#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
107#[non_exhaustive]
108pub struct UpdatePromptOutputBuilder {
109    pub(crate) name: ::std::option::Option<::std::string::String>,
110    pub(crate) description: ::std::option::Option<::std::string::String>,
111    pub(crate) customer_encryption_key_arn: ::std::option::Option<::std::string::String>,
112    pub(crate) default_variant: ::std::option::Option<::std::string::String>,
113    pub(crate) variants: ::std::option::Option<::std::vec::Vec<crate::types::PromptVariant>>,
114    pub(crate) id: ::std::option::Option<::std::string::String>,
115    pub(crate) arn: ::std::option::Option<::std::string::String>,
116    pub(crate) version: ::std::option::Option<::std::string::String>,
117    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
118    pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
119    _request_id: Option<String>,
120}
121impl UpdatePromptOutputBuilder {
122    /// <p>The name of the prompt.</p>
123    /// This field is required.
124    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.name = ::std::option::Option::Some(input.into());
126        self
127    }
128    /// <p>The name of the prompt.</p>
129    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.name = input;
131        self
132    }
133    /// <p>The name of the prompt.</p>
134    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
135        &self.name
136    }
137    /// <p>The description of the prompt.</p>
138    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.description = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>The description of the prompt.</p>
143    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.description = input;
145        self
146    }
147    /// <p>The description of the prompt.</p>
148    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
149        &self.description
150    }
151    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
152    pub fn customer_encryption_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.customer_encryption_key_arn = ::std::option::Option::Some(input.into());
154        self
155    }
156    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
157    pub fn set_customer_encryption_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.customer_encryption_key_arn = input;
159        self
160    }
161    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
162    pub fn get_customer_encryption_key_arn(&self) -> &::std::option::Option<::std::string::String> {
163        &self.customer_encryption_key_arn
164    }
165    /// <p>The name of the default variant for the prompt. This value must match the <code>name</code> field in the relevant <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptVariant.html">PromptVariant</a> object.</p>
166    pub fn default_variant(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.default_variant = ::std::option::Option::Some(input.into());
168        self
169    }
170    /// <p>The name of the default variant for the prompt. This value must match the <code>name</code> field in the relevant <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptVariant.html">PromptVariant</a> object.</p>
171    pub fn set_default_variant(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.default_variant = input;
173        self
174    }
175    /// <p>The name of the default variant for the prompt. This value must match the <code>name</code> field in the relevant <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptVariant.html">PromptVariant</a> object.</p>
176    pub fn get_default_variant(&self) -> &::std::option::Option<::std::string::String> {
177        &self.default_variant
178    }
179    /// Appends an item to `variants`.
180    ///
181    /// To override the contents of this collection use [`set_variants`](Self::set_variants).
182    ///
183    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
184    pub fn variants(mut self, input: crate::types::PromptVariant) -> Self {
185        let mut v = self.variants.unwrap_or_default();
186        v.push(input);
187        self.variants = ::std::option::Option::Some(v);
188        self
189    }
190    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
191    pub fn set_variants(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PromptVariant>>) -> Self {
192        self.variants = input;
193        self
194    }
195    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
196    pub fn get_variants(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PromptVariant>> {
197        &self.variants
198    }
199    /// <p>The unique identifier of the prompt.</p>
200    /// This field is required.
201    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202        self.id = ::std::option::Option::Some(input.into());
203        self
204    }
205    /// <p>The unique identifier of the prompt.</p>
206    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207        self.id = input;
208        self
209    }
210    /// <p>The unique identifier of the prompt.</p>
211    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
212        &self.id
213    }
214    /// <p>The Amazon Resource Name (ARN) of the prompt.</p>
215    /// This field is required.
216    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217        self.arn = ::std::option::Option::Some(input.into());
218        self
219    }
220    /// <p>The Amazon Resource Name (ARN) of the prompt.</p>
221    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222        self.arn = input;
223        self
224    }
225    /// <p>The Amazon Resource Name (ARN) of the prompt.</p>
226    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
227        &self.arn
228    }
229    /// <p>The version of the prompt. When you update a prompt, the version updated is the <code>DRAFT</code> version.</p>
230    /// This field is required.
231    pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232        self.version = ::std::option::Option::Some(input.into());
233        self
234    }
235    /// <p>The version of the prompt. When you update a prompt, the version updated is the <code>DRAFT</code> version.</p>
236    pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
237        self.version = input;
238        self
239    }
240    /// <p>The version of the prompt. When you update a prompt, the version updated is the <code>DRAFT</code> version.</p>
241    pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
242        &self.version
243    }
244    /// <p>The time at which the prompt was created.</p>
245    /// This field is required.
246    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
247        self.created_at = ::std::option::Option::Some(input);
248        self
249    }
250    /// <p>The time at which the prompt was created.</p>
251    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
252        self.created_at = input;
253        self
254    }
255    /// <p>The time at which the prompt was created.</p>
256    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
257        &self.created_at
258    }
259    /// <p>The time at which the prompt was last updated.</p>
260    /// This field is required.
261    pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
262        self.updated_at = ::std::option::Option::Some(input);
263        self
264    }
265    /// <p>The time at which the prompt was last updated.</p>
266    pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
267        self.updated_at = input;
268        self
269    }
270    /// <p>The time at which the prompt was last updated.</p>
271    pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
272        &self.updated_at
273    }
274    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
275        self._request_id = Some(request_id.into());
276        self
277    }
278
279    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
280        self._request_id = request_id;
281        self
282    }
283    /// Consumes the builder and constructs a [`UpdatePromptOutput`](crate::operation::update_prompt::UpdatePromptOutput).
284    /// This method will fail if any of the following fields are not set:
285    /// - [`name`](crate::operation::update_prompt::builders::UpdatePromptOutputBuilder::name)
286    /// - [`id`](crate::operation::update_prompt::builders::UpdatePromptOutputBuilder::id)
287    /// - [`arn`](crate::operation::update_prompt::builders::UpdatePromptOutputBuilder::arn)
288    /// - [`version`](crate::operation::update_prompt::builders::UpdatePromptOutputBuilder::version)
289    /// - [`created_at`](crate::operation::update_prompt::builders::UpdatePromptOutputBuilder::created_at)
290    /// - [`updated_at`](crate::operation::update_prompt::builders::UpdatePromptOutputBuilder::updated_at)
291    pub fn build(
292        self,
293    ) -> ::std::result::Result<crate::operation::update_prompt::UpdatePromptOutput, ::aws_smithy_types::error::operation::BuildError> {
294        ::std::result::Result::Ok(crate::operation::update_prompt::UpdatePromptOutput {
295            name: self.name.ok_or_else(|| {
296                ::aws_smithy_types::error::operation::BuildError::missing_field(
297                    "name",
298                    "name was not specified but it is required when building UpdatePromptOutput",
299                )
300            })?,
301            description: self.description,
302            customer_encryption_key_arn: self.customer_encryption_key_arn,
303            default_variant: self.default_variant,
304            variants: self.variants,
305            id: self.id.ok_or_else(|| {
306                ::aws_smithy_types::error::operation::BuildError::missing_field(
307                    "id",
308                    "id was not specified but it is required when building UpdatePromptOutput",
309                )
310            })?,
311            arn: self.arn.ok_or_else(|| {
312                ::aws_smithy_types::error::operation::BuildError::missing_field(
313                    "arn",
314                    "arn was not specified but it is required when building UpdatePromptOutput",
315                )
316            })?,
317            version: self.version.ok_or_else(|| {
318                ::aws_smithy_types::error::operation::BuildError::missing_field(
319                    "version",
320                    "version was not specified but it is required when building UpdatePromptOutput",
321                )
322            })?,
323            created_at: self.created_at.ok_or_else(|| {
324                ::aws_smithy_types::error::operation::BuildError::missing_field(
325                    "created_at",
326                    "created_at was not specified but it is required when building UpdatePromptOutput",
327                )
328            })?,
329            updated_at: self.updated_at.ok_or_else(|| {
330                ::aws_smithy_types::error::operation::BuildError::missing_field(
331                    "updated_at",
332                    "updated_at was not specified but it is required when building UpdatePromptOutput",
333                )
334            })?,
335            _request_id: self._request_id,
336        })
337    }
338}
339impl ::std::fmt::Debug for UpdatePromptOutputBuilder {
340    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
341        let mut formatter = f.debug_struct("UpdatePromptOutputBuilder");
342        formatter.field("name", &self.name);
343        formatter.field("description", &self.description);
344        formatter.field("customer_encryption_key_arn", &self.customer_encryption_key_arn);
345        formatter.field("default_variant", &self.default_variant);
346        formatter.field("variants", &"*** Sensitive Data Redacted ***");
347        formatter.field("id", &self.id);
348        formatter.field("arn", &self.arn);
349        formatter.field("version", &self.version);
350        formatter.field("created_at", &self.created_at);
351        formatter.field("updated_at", &self.updated_at);
352        formatter.field("_request_id", &self._request_id);
353        formatter.finish()
354    }
355}