aws_sdk_bedrockagentruntime/operation/create_session/_create_session_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, ::std::fmt::Debug)]
5pub struct CreateSessionInput {
6 /// <p>A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using.</p>
7 pub session_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
8 /// <p>The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
9 pub encryption_key_arn: ::std::option::Option<::std::string::String>,
10 /// <p>Specify the key-value pairs for the tags that you want to attach to the session.</p>
11 pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
12}
13impl CreateSessionInput {
14 /// <p>A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using.</p>
15 pub fn session_metadata(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
16 self.session_metadata.as_ref()
17 }
18 /// <p>The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
19 pub fn encryption_key_arn(&self) -> ::std::option::Option<&str> {
20 self.encryption_key_arn.as_deref()
21 }
22 /// <p>Specify the key-value pairs for the tags that you want to attach to the session.</p>
23 pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
24 self.tags.as_ref()
25 }
26}
27impl CreateSessionInput {
28 /// Creates a new builder-style object to manufacture [`CreateSessionInput`](crate::operation::create_session::CreateSessionInput).
29 pub fn builder() -> crate::operation::create_session::builders::CreateSessionInputBuilder {
30 crate::operation::create_session::builders::CreateSessionInputBuilder::default()
31 }
32}
33
34/// A builder for [`CreateSessionInput`](crate::operation::create_session::CreateSessionInput).
35#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
36#[non_exhaustive]
37pub struct CreateSessionInputBuilder {
38 pub(crate) session_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
39 pub(crate) encryption_key_arn: ::std::option::Option<::std::string::String>,
40 pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
41}
42impl CreateSessionInputBuilder {
43 /// Adds a key-value pair to `session_metadata`.
44 ///
45 /// To override the contents of this collection use [`set_session_metadata`](Self::set_session_metadata).
46 ///
47 /// <p>A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using.</p>
48 pub fn session_metadata(
49 mut self,
50 k: impl ::std::convert::Into<::std::string::String>,
51 v: impl ::std::convert::Into<::std::string::String>,
52 ) -> Self {
53 let mut hash_map = self.session_metadata.unwrap_or_default();
54 hash_map.insert(k.into(), v.into());
55 self.session_metadata = ::std::option::Option::Some(hash_map);
56 self
57 }
58 /// <p>A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using.</p>
59 pub fn set_session_metadata(
60 mut self,
61 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
62 ) -> Self {
63 self.session_metadata = input;
64 self
65 }
66 /// <p>A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using.</p>
67 pub fn get_session_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
68 &self.session_metadata
69 }
70 /// <p>The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
71 pub fn encryption_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
72 self.encryption_key_arn = ::std::option::Option::Some(input.into());
73 self
74 }
75 /// <p>The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
76 pub fn set_encryption_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
77 self.encryption_key_arn = input;
78 self
79 }
80 /// <p>The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
81 pub fn get_encryption_key_arn(&self) -> &::std::option::Option<::std::string::String> {
82 &self.encryption_key_arn
83 }
84 /// Adds a key-value pair to `tags`.
85 ///
86 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
87 ///
88 /// <p>Specify the key-value pairs for the tags that you want to attach to the session.</p>
89 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
90 let mut hash_map = self.tags.unwrap_or_default();
91 hash_map.insert(k.into(), v.into());
92 self.tags = ::std::option::Option::Some(hash_map);
93 self
94 }
95 /// <p>Specify the key-value pairs for the tags that you want to attach to the session.</p>
96 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
97 self.tags = input;
98 self
99 }
100 /// <p>Specify the key-value pairs for the tags that you want to attach to the session.</p>
101 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
102 &self.tags
103 }
104 /// Consumes the builder and constructs a [`CreateSessionInput`](crate::operation::create_session::CreateSessionInput).
105 pub fn build(
106 self,
107 ) -> ::std::result::Result<crate::operation::create_session::CreateSessionInput, ::aws_smithy_types::error::operation::BuildError> {
108 ::std::result::Result::Ok(crate::operation::create_session::CreateSessionInput {
109 session_metadata: self.session_metadata,
110 encryption_key_arn: self.encryption_key_arn,
111 tags: self.tags,
112 })
113 }
114}