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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Represents the event action configuration for an element of a <code>Component</code> or <code>ComponentChild</code>. Use for the workflow feature in Amplify Studio that allows you to bind events and actions to components. <code>ActionParameters</code> defines the action that is performed when an event occurs on the component.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ActionParameters {
/// <p>The type of navigation action. Valid values are <code>url</code> and <code>anchor</code>. This value is required for a navigation action.</p>
pub r#type: ::std::option::Option<crate::types::ComponentProperty>,
/// <p>The URL to the location to open. Specify this value for a navigation action.</p>
pub url: ::std::option::Option<crate::types::ComponentProperty>,
/// <p>The HTML anchor link to the location to open. Specify this value for a navigation action.</p>
pub anchor: ::std::option::Option<crate::types::ComponentProperty>,
/// <p>The element within the same component to modify when the action occurs.</p>
pub target: ::std::option::Option<crate::types::ComponentProperty>,
/// <p>Specifies whether the user should be signed out globally. Specify this value for an auth sign out action.</p>
pub global: ::std::option::Option<crate::types::ComponentProperty>,
/// <p>The name of the data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub model: ::std::option::Option<::std::string::String>,
/// <p>The unique ID of the component that the <code>ActionParameters</code> apply to.</p>
pub id: ::std::option::Option<crate::types::ComponentProperty>,
/// <p>A dictionary of key-value pairs mapping Amplify Studio properties to fields in a data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fields: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentProperty>>,
/// <p>A key-value pair that specifies the state property name and its initial value.</p>
pub state: ::std::option::Option<crate::types::MutationActionSetStateParameter>,
}
impl ActionParameters {
/// <p>The type of navigation action. Valid values are <code>url</code> and <code>anchor</code>. This value is required for a navigation action.</p>
pub fn r#type(&self) -> ::std::option::Option<&crate::types::ComponentProperty> {
self.r#type.as_ref()
}
/// <p>The URL to the location to open. Specify this value for a navigation action.</p>
pub fn url(&self) -> ::std::option::Option<&crate::types::ComponentProperty> {
self.url.as_ref()
}
/// <p>The HTML anchor link to the location to open. Specify this value for a navigation action.</p>
pub fn anchor(&self) -> ::std::option::Option<&crate::types::ComponentProperty> {
self.anchor.as_ref()
}
/// <p>The element within the same component to modify when the action occurs.</p>
pub fn target(&self) -> ::std::option::Option<&crate::types::ComponentProperty> {
self.target.as_ref()
}
/// <p>Specifies whether the user should be signed out globally. Specify this value for an auth sign out action.</p>
pub fn global(&self) -> ::std::option::Option<&crate::types::ComponentProperty> {
self.global.as_ref()
}
/// <p>The name of the data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn model(&self) -> ::std::option::Option<&str> {
self.model.as_deref()
}
/// <p>The unique ID of the component that the <code>ActionParameters</code> apply to.</p>
pub fn id(&self) -> ::std::option::Option<&crate::types::ComponentProperty> {
self.id.as_ref()
}
/// <p>A dictionary of key-value pairs mapping Amplify Studio properties to fields in a data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn fields(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::ComponentProperty>> {
self.fields.as_ref()
}
/// <p>A key-value pair that specifies the state property name and its initial value.</p>
pub fn state(&self) -> ::std::option::Option<&crate::types::MutationActionSetStateParameter> {
self.state.as_ref()
}
}
impl ActionParameters {
/// Creates a new builder-style object to manufacture [`ActionParameters`](crate::types::ActionParameters).
pub fn builder() -> crate::types::builders::ActionParametersBuilder {
crate::types::builders::ActionParametersBuilder::default()
}
}
/// A builder for [`ActionParameters`](crate::types::ActionParameters).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct ActionParametersBuilder {
pub(crate) r#type: ::std::option::Option<crate::types::ComponentProperty>,
pub(crate) url: ::std::option::Option<crate::types::ComponentProperty>,
pub(crate) anchor: ::std::option::Option<crate::types::ComponentProperty>,
pub(crate) target: ::std::option::Option<crate::types::ComponentProperty>,
pub(crate) global: ::std::option::Option<crate::types::ComponentProperty>,
pub(crate) model: ::std::option::Option<::std::string::String>,
pub(crate) id: ::std::option::Option<crate::types::ComponentProperty>,
pub(crate) fields: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentProperty>>,
pub(crate) state: ::std::option::Option<crate::types::MutationActionSetStateParameter>,
}
impl ActionParametersBuilder {
/// <p>The type of navigation action. Valid values are <code>url</code> and <code>anchor</code>. This value is required for a navigation action.</p>
pub fn r#type(mut self, input: crate::types::ComponentProperty) -> Self {
self.r#type = ::std::option::Option::Some(input);
self
}
/// <p>The type of navigation action. Valid values are <code>url</code> and <code>anchor</code>. This value is required for a navigation action.</p>
pub fn set_type(mut self, input: ::std::option::Option<crate::types::ComponentProperty>) -> Self {
self.r#type = input;
self
}
/// <p>The type of navigation action. Valid values are <code>url</code> and <code>anchor</code>. This value is required for a navigation action.</p>
pub fn get_type(&self) -> &::std::option::Option<crate::types::ComponentProperty> {
&self.r#type
}
/// <p>The URL to the location to open. Specify this value for a navigation action.</p>
pub fn url(mut self, input: crate::types::ComponentProperty) -> Self {
self.url = ::std::option::Option::Some(input);
self
}
/// <p>The URL to the location to open. Specify this value for a navigation action.</p>
pub fn set_url(mut self, input: ::std::option::Option<crate::types::ComponentProperty>) -> Self {
self.url = input;
self
}
/// <p>The URL to the location to open. Specify this value for a navigation action.</p>
pub fn get_url(&self) -> &::std::option::Option<crate::types::ComponentProperty> {
&self.url
}
/// <p>The HTML anchor link to the location to open. Specify this value for a navigation action.</p>
pub fn anchor(mut self, input: crate::types::ComponentProperty) -> Self {
self.anchor = ::std::option::Option::Some(input);
self
}
/// <p>The HTML anchor link to the location to open. Specify this value for a navigation action.</p>
pub fn set_anchor(mut self, input: ::std::option::Option<crate::types::ComponentProperty>) -> Self {
self.anchor = input;
self
}
/// <p>The HTML anchor link to the location to open. Specify this value for a navigation action.</p>
pub fn get_anchor(&self) -> &::std::option::Option<crate::types::ComponentProperty> {
&self.anchor
}
/// <p>The element within the same component to modify when the action occurs.</p>
pub fn target(mut self, input: crate::types::ComponentProperty) -> Self {
self.target = ::std::option::Option::Some(input);
self
}
/// <p>The element within the same component to modify when the action occurs.</p>
pub fn set_target(mut self, input: ::std::option::Option<crate::types::ComponentProperty>) -> Self {
self.target = input;
self
}
/// <p>The element within the same component to modify when the action occurs.</p>
pub fn get_target(&self) -> &::std::option::Option<crate::types::ComponentProperty> {
&self.target
}
/// <p>Specifies whether the user should be signed out globally. Specify this value for an auth sign out action.</p>
pub fn global(mut self, input: crate::types::ComponentProperty) -> Self {
self.global = ::std::option::Option::Some(input);
self
}
/// <p>Specifies whether the user should be signed out globally. Specify this value for an auth sign out action.</p>
pub fn set_global(mut self, input: ::std::option::Option<crate::types::ComponentProperty>) -> Self {
self.global = input;
self
}
/// <p>Specifies whether the user should be signed out globally. Specify this value for an auth sign out action.</p>
pub fn get_global(&self) -> &::std::option::Option<crate::types::ComponentProperty> {
&self.global
}
/// <p>The name of the data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn model(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.model = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn set_model(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.model = input;
self
}
/// <p>The name of the data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn get_model(&self) -> &::std::option::Option<::std::string::String> {
&self.model
}
/// <p>The unique ID of the component that the <code>ActionParameters</code> apply to.</p>
pub fn id(mut self, input: crate::types::ComponentProperty) -> Self {
self.id = ::std::option::Option::Some(input);
self
}
/// <p>The unique ID of the component that the <code>ActionParameters</code> apply to.</p>
pub fn set_id(mut self, input: ::std::option::Option<crate::types::ComponentProperty>) -> Self {
self.id = input;
self
}
/// <p>The unique ID of the component that the <code>ActionParameters</code> apply to.</p>
pub fn get_id(&self) -> &::std::option::Option<crate::types::ComponentProperty> {
&self.id
}
/// Adds a key-value pair to `fields`.
///
/// To override the contents of this collection use [`set_fields`](Self::set_fields).
///
/// <p>A dictionary of key-value pairs mapping Amplify Studio properties to fields in a data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn fields(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::ComponentProperty) -> Self {
let mut hash_map = self.fields.unwrap_or_default();
hash_map.insert(k.into(), v);
self.fields = ::std::option::Option::Some(hash_map);
self
}
/// <p>A dictionary of key-value pairs mapping Amplify Studio properties to fields in a data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn set_fields(
mut self,
input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentProperty>>,
) -> Self {
self.fields = input;
self
}
/// <p>A dictionary of key-value pairs mapping Amplify Studio properties to fields in a data model. Use when the action performs an operation on an Amplify DataStore model.</p>
pub fn get_fields(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentProperty>> {
&self.fields
}
/// <p>A key-value pair that specifies the state property name and its initial value.</p>
pub fn state(mut self, input: crate::types::MutationActionSetStateParameter) -> Self {
self.state = ::std::option::Option::Some(input);
self
}
/// <p>A key-value pair that specifies the state property name and its initial value.</p>
pub fn set_state(mut self, input: ::std::option::Option<crate::types::MutationActionSetStateParameter>) -> Self {
self.state = input;
self
}
/// <p>A key-value pair that specifies the state property name and its initial value.</p>
pub fn get_state(&self) -> &::std::option::Option<crate::types::MutationActionSetStateParameter> {
&self.state
}
/// Consumes the builder and constructs a [`ActionParameters`](crate::types::ActionParameters).
pub fn build(self) -> crate::types::ActionParameters {
crate::types::ActionParameters {
r#type: self.r#type,
url: self.url,
anchor: self.anchor,
target: self.target,
global: self.global,
model: self.model,
id: self.id,
fields: self.fields,
state: self.state,
}
}
}