Enum aws_sdk_emr::model::ScaleDownBehavior
source · #[non_exhaustive]
pub enum ScaleDownBehavior {
TerminateAtInstanceHour,
TerminateAtTaskCompletion,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against ScaleDownBehavior, 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 scaledownbehavior = unimplemented!();
match scaledownbehavior {
ScaleDownBehavior::TerminateAtInstanceHour => { /* ... */ },
ScaleDownBehavior::TerminateAtTaskCompletion => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when scaledownbehavior represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant ScaleDownBehavior::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
ScaleDownBehavior::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 ScaleDownBehavior::NewFeature is defined.
Specifically, when scaledownbehavior represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on ScaleDownBehavior::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
TerminateAtInstanceHour
TerminateAtTaskCompletion
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl ScaleDownBehavior
impl ScaleDownBehavior
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
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028
pub fn serialize_structure_crate_input_run_job_flow_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::RunJobFlowInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_154) = &input.name {
object.key("Name").string(var_154.as_str());
}
if let Some(var_155) = &input.log_uri {
object.key("LogUri").string(var_155.as_str());
}
if let Some(var_156) = &input.log_encryption_kms_key_id {
object.key("LogEncryptionKmsKeyId").string(var_156.as_str());
}
if let Some(var_157) = &input.additional_info {
object.key("AdditionalInfo").string(var_157.as_str());
}
if let Some(var_158) = &input.ami_version {
object.key("AmiVersion").string(var_158.as_str());
}
if let Some(var_159) = &input.release_label {
object.key("ReleaseLabel").string(var_159.as_str());
}
if let Some(var_160) = &input.instances {
#[allow(unused_mut)]
let mut object_161 = object.key("Instances").start_object();
crate::json_ser::serialize_structure_crate_model_job_flow_instances_config(
&mut object_161,
var_160,
)?;
object_161.finish();
}
if let Some(var_162) = &input.steps {
let mut array_163 = object.key("Steps").start_array();
for item_164 in var_162 {
{
#[allow(unused_mut)]
let mut object_165 = array_163.value().start_object();
crate::json_ser::serialize_structure_crate_model_step_config(
&mut object_165,
item_164,
)?;
object_165.finish();
}
}
array_163.finish();
}
if let Some(var_166) = &input.bootstrap_actions {
let mut array_167 = object.key("BootstrapActions").start_array();
for item_168 in var_166 {
{
#[allow(unused_mut)]
let mut object_169 = array_167.value().start_object();
crate::json_ser::serialize_structure_crate_model_bootstrap_action_config(
&mut object_169,
item_168,
)?;
object_169.finish();
}
}
array_167.finish();
}
if let Some(var_170) = &input.supported_products {
let mut array_171 = object.key("SupportedProducts").start_array();
for item_172 in var_170 {
{
array_171.value().string(item_172.as_str());
}
}
array_171.finish();
}
if let Some(var_173) = &input.new_supported_products {
let mut array_174 = object.key("NewSupportedProducts").start_array();
for item_175 in var_173 {
{
#[allow(unused_mut)]
let mut object_176 = array_174.value().start_object();
crate::json_ser::serialize_structure_crate_model_supported_product_config(
&mut object_176,
item_175,
)?;
object_176.finish();
}
}
array_174.finish();
}
if let Some(var_177) = &input.applications {
let mut array_178 = object.key("Applications").start_array();
for item_179 in var_177 {
{
#[allow(unused_mut)]
let mut object_180 = array_178.value().start_object();
crate::json_ser::serialize_structure_crate_model_application(
&mut object_180,
item_179,
)?;
object_180.finish();
}
}
array_178.finish();
}
if let Some(var_181) = &input.configurations {
let mut array_182 = object.key("Configurations").start_array();
for item_183 in var_181 {
{
#[allow(unused_mut)]
let mut object_184 = array_182.value().start_object();
crate::json_ser::serialize_structure_crate_model_configuration(
&mut object_184,
item_183,
)?;
object_184.finish();
}
}
array_182.finish();
}
if input.visible_to_all_users {
object
.key("VisibleToAllUsers")
.boolean(input.visible_to_all_users);
}
if let Some(var_185) = &input.job_flow_role {
object.key("JobFlowRole").string(var_185.as_str());
}
if let Some(var_186) = &input.service_role {
object.key("ServiceRole").string(var_186.as_str());
}
if let Some(var_187) = &input.tags {
let mut array_188 = object.key("Tags").start_array();
for item_189 in var_187 {
{
#[allow(unused_mut)]
let mut object_190 = array_188.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_190, item_189)?;
object_190.finish();
}
}
array_188.finish();
}
if let Some(var_191) = &input.security_configuration {
object.key("SecurityConfiguration").string(var_191.as_str());
}
if let Some(var_192) = &input.auto_scaling_role {
object.key("AutoScalingRole").string(var_192.as_str());
}
if let Some(var_193) = &input.scale_down_behavior {
object.key("ScaleDownBehavior").string(var_193.as_str());
}
if let Some(var_194) = &input.custom_ami_id {
object.key("CustomAmiId").string(var_194.as_str());
}
if let Some(var_195) = &input.ebs_root_volume_size {
object.key("EbsRootVolumeSize").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_195).into()),
);
}
if let Some(var_196) = &input.repo_upgrade_on_boot {
object.key("RepoUpgradeOnBoot").string(var_196.as_str());
}
if let Some(var_197) = &input.kerberos_attributes {
#[allow(unused_mut)]
let mut object_198 = object.key("KerberosAttributes").start_object();
crate::json_ser::serialize_structure_crate_model_kerberos_attributes(
&mut object_198,
var_197,
)?;
object_198.finish();
}
if let Some(var_199) = &input.step_concurrency_level {
object.key("StepConcurrencyLevel").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_199).into()),
);
}
if let Some(var_200) = &input.managed_scaling_policy {
#[allow(unused_mut)]
let mut object_201 = object.key("ManagedScalingPolicy").start_object();
crate::json_ser::serialize_structure_crate_model_managed_scaling_policy(
&mut object_201,
var_200,
)?;
object_201.finish();
}
if let Some(var_202) = &input.placement_group_configs {
let mut array_203 = object.key("PlacementGroupConfigs").start_array();
for item_204 in var_202 {
{
#[allow(unused_mut)]
let mut object_205 = array_203.value().start_object();
crate::json_ser::serialize_structure_crate_model_placement_group_config(
&mut object_205,
item_204,
)?;
object_205.finish();
}
}
array_203.finish();
}
if let Some(var_206) = &input.auto_termination_policy {
#[allow(unused_mut)]
let mut object_207 = object.key("AutoTerminationPolicy").start_object();
crate::json_ser::serialize_structure_crate_model_auto_termination_policy(
&mut object_207,
var_206,
)?;
object_207.finish();
}
if let Some(var_208) = &input.os_release_label {
object.key("OSReleaseLabel").string(var_208.as_str());
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for ScaleDownBehavior
impl AsRef<str> for ScaleDownBehavior
source§impl Clone for ScaleDownBehavior
impl Clone for ScaleDownBehavior
source§fn clone(&self) -> ScaleDownBehavior
fn clone(&self) -> ScaleDownBehavior
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ScaleDownBehavior
impl Debug for ScaleDownBehavior
source§impl From<&str> for ScaleDownBehavior
impl From<&str> for ScaleDownBehavior
source§impl FromStr for ScaleDownBehavior
impl FromStr for ScaleDownBehavior
source§impl Hash for ScaleDownBehavior
impl Hash for ScaleDownBehavior
source§impl Ord for ScaleDownBehavior
impl Ord for ScaleDownBehavior
source§fn cmp(&self, other: &ScaleDownBehavior) -> Ordering
fn cmp(&self, other: &ScaleDownBehavior) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ScaleDownBehavior> for ScaleDownBehavior
impl PartialEq<ScaleDownBehavior> for ScaleDownBehavior
source§fn eq(&self, other: &ScaleDownBehavior) -> bool
fn eq(&self, other: &ScaleDownBehavior) -> bool
source§impl PartialOrd<ScaleDownBehavior> for ScaleDownBehavior
impl PartialOrd<ScaleDownBehavior> for ScaleDownBehavior
source§fn partial_cmp(&self, other: &ScaleDownBehavior) -> Option<Ordering>
fn partial_cmp(&self, other: &ScaleDownBehavior) -> 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 ScaleDownBehavior
impl StructuralEq for ScaleDownBehavior
impl StructuralPartialEq for ScaleDownBehavior
Auto Trait Implementations§
impl RefUnwindSafe for ScaleDownBehavior
impl Send for ScaleDownBehavior
impl Sync for ScaleDownBehavior
impl Unpin for ScaleDownBehavior
impl UnwindSafe for ScaleDownBehavior
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.