1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Describes the configuration of an event. You can bind an event and a corresponding action to a <code>Component</code> or a <code>ComponentChild</code>. A button click is an example of an event. </p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ComponentEvent {
/// <p>The action to perform when a specific event is raised.</p>
pub action: ::std::option::Option<::std::string::String>,
/// <p>Describes information about the action.</p>
pub parameters: ::std::option::Option<crate::types::ActionParameters>,
/// <p>Binds an event to an action on a component. When you specify a <code>bindingEvent</code>, the event is called when the action is performed.</p>
pub binding_event: ::std::option::Option<::std::string::String>,
}
impl ComponentEvent {
/// <p>The action to perform when a specific event is raised.</p>
pub fn action(&self) -> ::std::option::Option<&str> {
self.action.as_deref()
}
/// <p>Describes information about the action.</p>
pub fn parameters(&self) -> ::std::option::Option<&crate::types::ActionParameters> {
self.parameters.as_ref()
}
/// <p>Binds an event to an action on a component. When you specify a <code>bindingEvent</code>, the event is called when the action is performed.</p>
pub fn binding_event(&self) -> ::std::option::Option<&str> {
self.binding_event.as_deref()
}
}
impl ComponentEvent {
/// Creates a new builder-style object to manufacture [`ComponentEvent`](crate::types::ComponentEvent).
pub fn builder() -> crate::types::builders::ComponentEventBuilder {
crate::types::builders::ComponentEventBuilder::default()
}
}
/// A builder for [`ComponentEvent`](crate::types::ComponentEvent).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct ComponentEventBuilder {
pub(crate) action: ::std::option::Option<::std::string::String>,
pub(crate) parameters: ::std::option::Option<crate::types::ActionParameters>,
pub(crate) binding_event: ::std::option::Option<::std::string::String>,
}
impl ComponentEventBuilder {
/// <p>The action to perform when a specific event is raised.</p>
pub fn action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.action = ::std::option::Option::Some(input.into());
self
}
/// <p>The action to perform when a specific event is raised.</p>
pub fn set_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.action = input;
self
}
/// <p>The action to perform when a specific event is raised.</p>
pub fn get_action(&self) -> &::std::option::Option<::std::string::String> {
&self.action
}
/// <p>Describes information about the action.</p>
pub fn parameters(mut self, input: crate::types::ActionParameters) -> Self {
self.parameters = ::std::option::Option::Some(input);
self
}
/// <p>Describes information about the action.</p>
pub fn set_parameters(mut self, input: ::std::option::Option<crate::types::ActionParameters>) -> Self {
self.parameters = input;
self
}
/// <p>Describes information about the action.</p>
pub fn get_parameters(&self) -> &::std::option::Option<crate::types::ActionParameters> {
&self.parameters
}
/// <p>Binds an event to an action on a component. When you specify a <code>bindingEvent</code>, the event is called when the action is performed.</p>
pub fn binding_event(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.binding_event = ::std::option::Option::Some(input.into());
self
}
/// <p>Binds an event to an action on a component. When you specify a <code>bindingEvent</code>, the event is called when the action is performed.</p>
pub fn set_binding_event(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.binding_event = input;
self
}
/// <p>Binds an event to an action on a component. When you specify a <code>bindingEvent</code>, the event is called when the action is performed.</p>
pub fn get_binding_event(&self) -> &::std::option::Option<::std::string::String> {
&self.binding_event
}
/// Consumes the builder and constructs a [`ComponentEvent`](crate::types::ComponentEvent).
pub fn build(self) -> crate::types::ComponentEvent {
crate::types::ComponentEvent {
action: self.action,
parameters: self.parameters,
binding_event: self.binding_event,
}
}
}