aws_sdk_bedrockagentruntime/operation/update_session/
_update_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 UpdateSessionInput {
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 unique identifier of the session to modify. You can specify either the session's <code>sessionId</code> or its Amazon Resource Name (ARN).</p>
9    pub session_identifier: ::std::option::Option<::std::string::String>,
10}
11impl UpdateSessionInput {
12    /// <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>
13    pub fn session_metadata(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
14        self.session_metadata.as_ref()
15    }
16    /// <p>The unique identifier of the session to modify. You can specify either the session's <code>sessionId</code> or its Amazon Resource Name (ARN).</p>
17    pub fn session_identifier(&self) -> ::std::option::Option<&str> {
18        self.session_identifier.as_deref()
19    }
20}
21impl UpdateSessionInput {
22    /// Creates a new builder-style object to manufacture [`UpdateSessionInput`](crate::operation::update_session::UpdateSessionInput).
23    pub fn builder() -> crate::operation::update_session::builders::UpdateSessionInputBuilder {
24        crate::operation::update_session::builders::UpdateSessionInputBuilder::default()
25    }
26}
27
28/// A builder for [`UpdateSessionInput`](crate::operation::update_session::UpdateSessionInput).
29#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
30#[non_exhaustive]
31pub struct UpdateSessionInputBuilder {
32    pub(crate) session_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
33    pub(crate) session_identifier: ::std::option::Option<::std::string::String>,
34}
35impl UpdateSessionInputBuilder {
36    /// Adds a key-value pair to `session_metadata`.
37    ///
38    /// To override the contents of this collection use [`set_session_metadata`](Self::set_session_metadata).
39    ///
40    /// <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>
41    pub fn session_metadata(
42        mut self,
43        k: impl ::std::convert::Into<::std::string::String>,
44        v: impl ::std::convert::Into<::std::string::String>,
45    ) -> Self {
46        let mut hash_map = self.session_metadata.unwrap_or_default();
47        hash_map.insert(k.into(), v.into());
48        self.session_metadata = ::std::option::Option::Some(hash_map);
49        self
50    }
51    /// <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>
52    pub fn set_session_metadata(
53        mut self,
54        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
55    ) -> Self {
56        self.session_metadata = input;
57        self
58    }
59    /// <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>
60    pub fn get_session_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
61        &self.session_metadata
62    }
63    /// <p>The unique identifier of the session to modify. You can specify either the session's <code>sessionId</code> or its Amazon Resource Name (ARN).</p>
64    /// This field is required.
65    pub fn session_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.session_identifier = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// <p>The unique identifier of the session to modify. You can specify either the session's <code>sessionId</code> or its Amazon Resource Name (ARN).</p>
70    pub fn set_session_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.session_identifier = input;
72        self
73    }
74    /// <p>The unique identifier of the session to modify. You can specify either the session's <code>sessionId</code> or its Amazon Resource Name (ARN).</p>
75    pub fn get_session_identifier(&self) -> &::std::option::Option<::std::string::String> {
76        &self.session_identifier
77    }
78    /// Consumes the builder and constructs a [`UpdateSessionInput`](crate::operation::update_session::UpdateSessionInput).
79    pub fn build(
80        self,
81    ) -> ::std::result::Result<crate::operation::update_session::UpdateSessionInput, ::aws_smithy_types::error::operation::BuildError> {
82        ::std::result::Result::Ok(crate::operation::update_session::UpdateSessionInput {
83            session_metadata: self.session_metadata,
84            session_identifier: self.session_identifier,
85        })
86    }
87}