#[non_exhaustive]
pub enum OrganizationConfigRuleTriggerType {
ConfigurationItemChangeNotification,
OversizedConfigurationItemChangeNotifcation,
ScheduledNotification,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against OrganizationConfigRuleTriggerType, it is important to ensure
your code is forward-compatible. That is, if a match arm handles a case for a
feature that is supported by the service but has not been represented as an enum
variant in a current version of SDK, your code should continue to work when you
upgrade SDK to a future version in which the enum does include a variant for that
feature.
Here is an example of how you can make a match expression forward-compatible:
# let organizationconfigruletriggertype = unimplemented!();
match organizationconfigruletriggertype {
OrganizationConfigRuleTriggerType::ConfigurationItemChangeNotification => { /* ... */ },
OrganizationConfigRuleTriggerType::OversizedConfigurationItemChangeNotifcation => { /* ... */ },
OrganizationConfigRuleTriggerType::ScheduledNotification => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when organizationconfigruletriggertype represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant OrganizationConfigRuleTriggerType::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
OrganizationConfigRuleTriggerType::Unknown(UnknownVariantValue("NewFeature".to_owned()))
and calling as_str on it yields "NewFeature".
This match expression is forward-compatible when executed with a newer
version of SDK where the variant OrganizationConfigRuleTriggerType::NewFeature is defined.
Specifically, when organizationconfigruletriggertype represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on OrganizationConfigRuleTriggerType::NewFeature also yielding "NewFeature".
Explicitly matching on the Unknown variant should
be avoided for two reasons:
- The inner data
UnknownVariantValueis opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ConfigurationItemChangeNotification
OversizedConfigurationItemChangeNotifcation
ScheduledNotification
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl OrganizationConfigRuleTriggerType
impl OrganizationConfigRuleTriggerType
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the &str value of the enum member.
Examples found in repository?
More examples
2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551
pub fn serialize_structure_crate_model_organization_custom_rule_metadata(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::OrganizationCustomRuleMetadata,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_444) = &input.description {
object.key("Description").string(var_444.as_str());
}
if let Some(var_445) = &input.lambda_function_arn {
object.key("LambdaFunctionArn").string(var_445.as_str());
}
if let Some(var_446) = &input.organization_config_rule_trigger_types {
let mut array_447 = object
.key("OrganizationConfigRuleTriggerTypes")
.start_array();
for item_448 in var_446 {
{
array_447.value().string(item_448.as_str());
}
}
array_447.finish();
}
if let Some(var_449) = &input.input_parameters {
object.key("InputParameters").string(var_449.as_str());
}
if let Some(var_450) = &input.maximum_execution_frequency {
object
.key("MaximumExecutionFrequency")
.string(var_450.as_str());
}
if let Some(var_451) = &input.resource_types_scope {
let mut array_452 = object.key("ResourceTypesScope").start_array();
for item_453 in var_451 {
{
array_452.value().string(item_453.as_str());
}
}
array_452.finish();
}
if let Some(var_454) = &input.resource_id_scope {
object.key("ResourceIdScope").string(var_454.as_str());
}
if let Some(var_455) = &input.tag_key_scope {
object.key("TagKeyScope").string(var_455.as_str());
}
if let Some(var_456) = &input.tag_value_scope {
object.key("TagValueScope").string(var_456.as_str());
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for OrganizationConfigRuleTriggerType
impl AsRef<str> for OrganizationConfigRuleTriggerType
source§impl Clone for OrganizationConfigRuleTriggerType
impl Clone for OrganizationConfigRuleTriggerType
source§fn clone(&self) -> OrganizationConfigRuleTriggerType
fn clone(&self) -> OrganizationConfigRuleTriggerType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl From<&str> for OrganizationConfigRuleTriggerType
impl From<&str> for OrganizationConfigRuleTriggerType
source§impl Ord for OrganizationConfigRuleTriggerType
impl Ord for OrganizationConfigRuleTriggerType
source§fn cmp(&self, other: &OrganizationConfigRuleTriggerType) -> Ordering
fn cmp(&self, other: &OrganizationConfigRuleTriggerType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<OrganizationConfigRuleTriggerType> for OrganizationConfigRuleTriggerType
impl PartialEq<OrganizationConfigRuleTriggerType> for OrganizationConfigRuleTriggerType
source§fn eq(&self, other: &OrganizationConfigRuleTriggerType) -> bool
fn eq(&self, other: &OrganizationConfigRuleTriggerType) -> bool
source§impl PartialOrd<OrganizationConfigRuleTriggerType> for OrganizationConfigRuleTriggerType
impl PartialOrd<OrganizationConfigRuleTriggerType> for OrganizationConfigRuleTriggerType
source§fn partial_cmp(
&self,
other: &OrganizationConfigRuleTriggerType
) -> Option<Ordering>
fn partial_cmp(
&self,
other: &OrganizationConfigRuleTriggerType
) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for OrganizationConfigRuleTriggerType
impl StructuralEq for OrganizationConfigRuleTriggerType
impl StructuralPartialEq for OrganizationConfigRuleTriggerType
Auto Trait Implementations§
impl RefUnwindSafe for OrganizationConfigRuleTriggerType
impl Send for OrganizationConfigRuleTriggerType
impl Sync for OrganizationConfigRuleTriggerType
impl Unpin for OrganizationConfigRuleTriggerType
impl UnwindSafe for OrganizationConfigRuleTriggerType
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.