aws_sdk_ivschat/operation/send_event/
_send_event_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 SendEventInput {
6    /// <p>Identifier of the room to which the event will be sent. Currently this must be an ARN.</p>
7    pub room_identifier: ::std::option::Option<::std::string::String>,
8    /// <p>Application-defined name of the event to send to clients.</p>
9    pub event_name: ::std::option::Option<::std::string::String>,
10    /// <p>Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.</p>
11    pub attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
12}
13impl SendEventInput {
14    /// <p>Identifier of the room to which the event will be sent. Currently this must be an ARN.</p>
15    pub fn room_identifier(&self) -> ::std::option::Option<&str> {
16        self.room_identifier.as_deref()
17    }
18    /// <p>Application-defined name of the event to send to clients.</p>
19    pub fn event_name(&self) -> ::std::option::Option<&str> {
20        self.event_name.as_deref()
21    }
22    /// <p>Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.</p>
23    pub fn attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
24        self.attributes.as_ref()
25    }
26}
27impl SendEventInput {
28    /// Creates a new builder-style object to manufacture [`SendEventInput`](crate::operation::send_event::SendEventInput).
29    pub fn builder() -> crate::operation::send_event::builders::SendEventInputBuilder {
30        crate::operation::send_event::builders::SendEventInputBuilder::default()
31    }
32}
33
34/// A builder for [`SendEventInput`](crate::operation::send_event::SendEventInput).
35#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
36#[non_exhaustive]
37pub struct SendEventInputBuilder {
38    pub(crate) room_identifier: ::std::option::Option<::std::string::String>,
39    pub(crate) event_name: ::std::option::Option<::std::string::String>,
40    pub(crate) attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
41}
42impl SendEventInputBuilder {
43    /// <p>Identifier of the room to which the event will be sent. Currently this must be an ARN.</p>
44    /// This field is required.
45    pub fn room_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46        self.room_identifier = ::std::option::Option::Some(input.into());
47        self
48    }
49    /// <p>Identifier of the room to which the event will be sent. Currently this must be an ARN.</p>
50    pub fn set_room_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.room_identifier = input;
52        self
53    }
54    /// <p>Identifier of the room to which the event will be sent. Currently this must be an ARN.</p>
55    pub fn get_room_identifier(&self) -> &::std::option::Option<::std::string::String> {
56        &self.room_identifier
57    }
58    /// <p>Application-defined name of the event to send to clients.</p>
59    /// This field is required.
60    pub fn event_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.event_name = ::std::option::Option::Some(input.into());
62        self
63    }
64    /// <p>Application-defined name of the event to send to clients.</p>
65    pub fn set_event_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
66        self.event_name = input;
67        self
68    }
69    /// <p>Application-defined name of the event to send to clients.</p>
70    pub fn get_event_name(&self) -> &::std::option::Option<::std::string::String> {
71        &self.event_name
72    }
73    /// Adds a key-value pair to `attributes`.
74    ///
75    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
76    ///
77    /// <p>Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.</p>
78    pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
79        let mut hash_map = self.attributes.unwrap_or_default();
80        hash_map.insert(k.into(), v.into());
81        self.attributes = ::std::option::Option::Some(hash_map);
82        self
83    }
84    /// <p>Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.</p>
85    pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
86        self.attributes = input;
87        self
88    }
89    /// <p>Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.</p>
90    pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
91        &self.attributes
92    }
93    /// Consumes the builder and constructs a [`SendEventInput`](crate::operation::send_event::SendEventInput).
94    pub fn build(self) -> ::std::result::Result<crate::operation::send_event::SendEventInput, ::aws_smithy_types::error::operation::BuildError> {
95        ::std::result::Result::Ok(crate::operation::send_event::SendEventInput {
96            room_identifier: self.room_identifier,
97            event_name: self.event_name,
98            attributes: self.attributes,
99        })
100    }
101}