aws_sdk_bedrockagent/operation/create_prompt/
_create_prompt_input.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 CreatePromptInput {
6    /// <p>A name for the prompt.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>A description for 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>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
17    pub client_token: ::std::option::Option<::std::string::String>,
18    /// <p>Any tags that you want to attach to the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources in Amazon Bedrock</a>.</p>
19    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
20}
21impl CreatePromptInput {
22    /// <p>A name for the prompt.</p>
23    pub fn name(&self) -> ::std::option::Option<&str> {
24        self.name.as_deref()
25    }
26    /// <p>A description for the prompt.</p>
27    pub fn description(&self) -> ::std::option::Option<&str> {
28        self.description.as_deref()
29    }
30    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
31    pub fn customer_encryption_key_arn(&self) -> ::std::option::Option<&str> {
32        self.customer_encryption_key_arn.as_deref()
33    }
34    /// <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>
35    pub fn default_variant(&self) -> ::std::option::Option<&str> {
36        self.default_variant.as_deref()
37    }
38    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
39    ///
40    /// 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()`.
41    pub fn variants(&self) -> &[crate::types::PromptVariant] {
42        self.variants.as_deref().unwrap_or_default()
43    }
44    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
45    pub fn client_token(&self) -> ::std::option::Option<&str> {
46        self.client_token.as_deref()
47    }
48    /// <p>Any tags that you want to attach to the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources in Amazon Bedrock</a>.</p>
49    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
50        self.tags.as_ref()
51    }
52}
53impl ::std::fmt::Debug for CreatePromptInput {
54    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
55        let mut formatter = f.debug_struct("CreatePromptInput");
56        formatter.field("name", &self.name);
57        formatter.field("description", &self.description);
58        formatter.field("customer_encryption_key_arn", &self.customer_encryption_key_arn);
59        formatter.field("default_variant", &self.default_variant);
60        formatter.field("variants", &"*** Sensitive Data Redacted ***");
61        formatter.field("client_token", &self.client_token);
62        formatter.field("tags", &self.tags);
63        formatter.finish()
64    }
65}
66impl CreatePromptInput {
67    /// Creates a new builder-style object to manufacture [`CreatePromptInput`](crate::operation::create_prompt::CreatePromptInput).
68    pub fn builder() -> crate::operation::create_prompt::builders::CreatePromptInputBuilder {
69        crate::operation::create_prompt::builders::CreatePromptInputBuilder::default()
70    }
71}
72
73/// A builder for [`CreatePromptInput`](crate::operation::create_prompt::CreatePromptInput).
74#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
75#[non_exhaustive]
76pub struct CreatePromptInputBuilder {
77    pub(crate) name: ::std::option::Option<::std::string::String>,
78    pub(crate) description: ::std::option::Option<::std::string::String>,
79    pub(crate) customer_encryption_key_arn: ::std::option::Option<::std::string::String>,
80    pub(crate) default_variant: ::std::option::Option<::std::string::String>,
81    pub(crate) variants: ::std::option::Option<::std::vec::Vec<crate::types::PromptVariant>>,
82    pub(crate) client_token: ::std::option::Option<::std::string::String>,
83    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
84}
85impl CreatePromptInputBuilder {
86    /// <p>A name for the prompt.</p>
87    /// This field is required.
88    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.name = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>A name for the prompt.</p>
93    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.name = input;
95        self
96    }
97    /// <p>A name for the prompt.</p>
98    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
99        &self.name
100    }
101    /// <p>A description for the prompt.</p>
102    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.description = ::std::option::Option::Some(input.into());
104        self
105    }
106    /// <p>A description for the prompt.</p>
107    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.description = input;
109        self
110    }
111    /// <p>A description for the prompt.</p>
112    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
113        &self.description
114    }
115    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
116    pub fn customer_encryption_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.customer_encryption_key_arn = ::std::option::Option::Some(input.into());
118        self
119    }
120    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
121    pub fn set_customer_encryption_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.customer_encryption_key_arn = input;
123        self
124    }
125    /// <p>The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.</p>
126    pub fn get_customer_encryption_key_arn(&self) -> &::std::option::Option<::std::string::String> {
127        &self.customer_encryption_key_arn
128    }
129    /// <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>
130    pub fn default_variant(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.default_variant = ::std::option::Option::Some(input.into());
132        self
133    }
134    /// <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>
135    pub fn set_default_variant(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.default_variant = input;
137        self
138    }
139    /// <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>
140    pub fn get_default_variant(&self) -> &::std::option::Option<::std::string::String> {
141        &self.default_variant
142    }
143    /// Appends an item to `variants`.
144    ///
145    /// To override the contents of this collection use [`set_variants`](Self::set_variants).
146    ///
147    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
148    pub fn variants(mut self, input: crate::types::PromptVariant) -> Self {
149        let mut v = self.variants.unwrap_or_default();
150        v.push(input);
151        self.variants = ::std::option::Option::Some(v);
152        self
153    }
154    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
155    pub fn set_variants(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PromptVariant>>) -> Self {
156        self.variants = input;
157        self
158    }
159    /// <p>A list of objects, each containing details about a variant of the prompt.</p>
160    pub fn get_variants(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PromptVariant>> {
161        &self.variants
162    }
163    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
164    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165        self.client_token = ::std::option::Option::Some(input.into());
166        self
167    }
168    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
169    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
170        self.client_token = input;
171        self
172    }
173    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
174    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
175        &self.client_token
176    }
177    /// Adds a key-value pair to `tags`.
178    ///
179    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
180    ///
181    /// <p>Any tags that you want to attach to the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources in Amazon Bedrock</a>.</p>
182    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
183        let mut hash_map = self.tags.unwrap_or_default();
184        hash_map.insert(k.into(), v.into());
185        self.tags = ::std::option::Option::Some(hash_map);
186        self
187    }
188    /// <p>Any tags that you want to attach to the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources in Amazon Bedrock</a>.</p>
189    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
190        self.tags = input;
191        self
192    }
193    /// <p>Any tags that you want to attach to the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources in Amazon Bedrock</a>.</p>
194    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
195        &self.tags
196    }
197    /// Consumes the builder and constructs a [`CreatePromptInput`](crate::operation::create_prompt::CreatePromptInput).
198    pub fn build(
199        self,
200    ) -> ::std::result::Result<crate::operation::create_prompt::CreatePromptInput, ::aws_smithy_types::error::operation::BuildError> {
201        ::std::result::Result::Ok(crate::operation::create_prompt::CreatePromptInput {
202            name: self.name,
203            description: self.description,
204            customer_encryption_key_arn: self.customer_encryption_key_arn,
205            default_variant: self.default_variant,
206            variants: self.variants,
207            client_token: self.client_token,
208            tags: self.tags,
209        })
210    }
211}
212impl ::std::fmt::Debug for CreatePromptInputBuilder {
213    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
214        let mut formatter = f.debug_struct("CreatePromptInputBuilder");
215        formatter.field("name", &self.name);
216        formatter.field("description", &self.description);
217        formatter.field("customer_encryption_key_arn", &self.customer_encryption_key_arn);
218        formatter.field("default_variant", &self.default_variant);
219        formatter.field("variants", &"*** Sensitive Data Redacted ***");
220        formatter.field("client_token", &self.client_token);
221        formatter.field("tags", &self.tags);
222        formatter.finish()
223    }
224}