#[non_exhaustive]
pub enum AutoTuneDesiredState {
Disabled,
Enabled,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against AutoTuneDesiredState
, 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 autotunedesiredstate = unimplemented!();
match autotunedesiredstate {
AutoTuneDesiredState::Disabled => { /* ... */ },
AutoTuneDesiredState::Enabled => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when autotunedesiredstate
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant AutoTuneDesiredState::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
AutoTuneDesiredState::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 AutoTuneDesiredState::NewFeature
is defined.
Specifically, when autotunedesiredstate
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on AutoTuneDesiredState::NewFeature
also yielding "NewFeature"
.
Explicitly matching on the Unknown
variant should
be avoided for two reasons:
- The inner data
UnknownVariantValue
is opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
The Auto-Tune desired state. Valid values are ENABLED and DISABLED.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Disabled
Enabled
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl AutoTuneDesiredState
impl AutoTuneDesiredState
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
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 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
pub fn serialize_structure_crate_model_auto_tune_options_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::AutoTuneOptionsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_131) = &input.desired_state {
object.key("DesiredState").string(var_131.as_str());
}
if let Some(var_132) = &input.maintenance_schedules {
let mut array_133 = object.key("MaintenanceSchedules").start_array();
for item_134 in var_132 {
{
#[allow(unused_mut)]
let mut object_135 = array_133.value().start_object();
crate::json_ser::serialize_structure_crate_model_auto_tune_maintenance_schedule(
&mut object_135,
item_134,
)?;
object_135.finish();
}
}
array_133.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_cluster_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ClusterConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_136) = &input.instance_type {
object.key("InstanceType").string(var_136.as_str());
}
if let Some(var_137) = &input.instance_count {
object.key("InstanceCount").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_137).into()),
);
}
if let Some(var_138) = &input.dedicated_master_enabled {
object.key("DedicatedMasterEnabled").boolean(*var_138);
}
if let Some(var_139) = &input.zone_awareness_enabled {
object.key("ZoneAwarenessEnabled").boolean(*var_139);
}
if let Some(var_140) = &input.zone_awareness_config {
#[allow(unused_mut)]
let mut object_141 = object.key("ZoneAwarenessConfig").start_object();
crate::json_ser::serialize_structure_crate_model_zone_awareness_config(
&mut object_141,
var_140,
)?;
object_141.finish();
}
if let Some(var_142) = &input.dedicated_master_type {
object.key("DedicatedMasterType").string(var_142.as_str());
}
if let Some(var_143) = &input.dedicated_master_count {
object.key("DedicatedMasterCount").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_143).into()),
);
}
if let Some(var_144) = &input.warm_enabled {
object.key("WarmEnabled").boolean(*var_144);
}
if let Some(var_145) = &input.warm_type {
object.key("WarmType").string(var_145.as_str());
}
if let Some(var_146) = &input.warm_count {
object.key("WarmCount").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_146).into()),
);
}
if let Some(var_147) = &input.cold_storage_options {
#[allow(unused_mut)]
let mut object_148 = object.key("ColdStorageOptions").start_object();
crate::json_ser::serialize_structure_crate_model_cold_storage_options(
&mut object_148,
var_147,
)?;
object_148.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_cognito_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CognitoOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_149) = &input.enabled {
object.key("Enabled").boolean(*var_149);
}
if let Some(var_150) = &input.user_pool_id {
object.key("UserPoolId").string(var_150.as_str());
}
if let Some(var_151) = &input.identity_pool_id {
object.key("IdentityPoolId").string(var_151.as_str());
}
if let Some(var_152) = &input.role_arn {
object.key("RoleArn").string(var_152.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_domain_endpoint_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::DomainEndpointOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_153) = &input.enforce_https {
object.key("EnforceHTTPS").boolean(*var_153);
}
if let Some(var_154) = &input.tls_security_policy {
object.key("TLSSecurityPolicy").string(var_154.as_str());
}
if let Some(var_155) = &input.custom_endpoint_enabled {
object.key("CustomEndpointEnabled").boolean(*var_155);
}
if let Some(var_156) = &input.custom_endpoint {
object.key("CustomEndpoint").string(var_156.as_str());
}
if let Some(var_157) = &input.custom_endpoint_certificate_arn {
object
.key("CustomEndpointCertificateArn")
.string(var_157.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_ebs_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::EbsOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_158) = &input.ebs_enabled {
object.key("EBSEnabled").boolean(*var_158);
}
if let Some(var_159) = &input.volume_type {
object.key("VolumeType").string(var_159.as_str());
}
if let Some(var_160) = &input.volume_size {
object.key("VolumeSize").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_160).into()),
);
}
if let Some(var_161) = &input.iops {
object.key("Iops").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_161).into()),
);
}
if let Some(var_162) = &input.throughput {
object.key("Throughput").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_162).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_model_encryption_at_rest_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::EncryptionAtRestOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_163) = &input.enabled {
object.key("Enabled").boolean(*var_163);
}
if let Some(var_164) = &input.kms_key_id {
object.key("KmsKeyId").string(var_164.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_log_publishing_option(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::LogPublishingOption,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_165) = &input.cloud_watch_logs_log_group_arn {
object
.key("CloudWatchLogsLogGroupArn")
.string(var_165.as_str());
}
if let Some(var_166) = &input.enabled {
object.key("Enabled").boolean(*var_166);
}
Ok(())
}
pub fn serialize_structure_crate_model_node_to_node_encryption_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::NodeToNodeEncryptionOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_167) = &input.enabled {
object.key("Enabled").boolean(*var_167);
}
Ok(())
}
pub fn serialize_structure_crate_model_snapshot_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::SnapshotOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_168) = &input.automated_snapshot_start_hour {
object.key("AutomatedSnapshotStartHour").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_168).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_model_vpc_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::VpcOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_169) = &input.subnet_ids {
let mut array_170 = object.key("SubnetIds").start_array();
for item_171 in var_169 {
{
array_170.value().string(item_171.as_str());
}
}
array_170.finish();
}
if let Some(var_172) = &input.security_group_ids {
let mut array_173 = object.key("SecurityGroupIds").start_array();
for item_174 in var_172 {
{
array_173.value().string(item_174.as_str());
}
}
array_173.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_domain_information_container(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::DomainInformationContainer,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_175) = &input.aws_domain_information {
#[allow(unused_mut)]
let mut object_176 = object.key("AWSDomainInformation").start_object();
crate::json_ser::serialize_structure_crate_model_aws_domain_information(
&mut object_176,
var_175,
)?;
object_176.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_package_source(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::PackageSource,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_177) = &input.s3_bucket_name {
object.key("S3BucketName").string(var_177.as_str());
}
if let Some(var_178) = &input.s3_key {
object.key("S3Key").string(var_178.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::Filter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_179) = &input.name {
object.key("Name").string(var_179.as_str());
}
if let Some(var_180) = &input.values {
let mut array_181 = object.key("Values").start_array();
for item_182 in var_180 {
{
array_181.value().string(item_182.as_str());
}
}
array_181.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_describe_packages_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::DescribePackagesFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_183) = &input.name {
object.key("Name").string(var_183.as_str());
}
if let Some(var_184) = &input.value {
let mut array_185 = object.key("Value").start_array();
for item_186 in var_184 {
{
array_185.value().string(item_186.as_str());
}
}
array_185.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_auto_tune_options(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::AutoTuneOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_187) = &input.desired_state {
object.key("DesiredState").string(var_187.as_str());
}
if let Some(var_188) = &input.rollback_on_disable {
object.key("RollbackOnDisable").string(var_188.as_str());
}
if let Some(var_189) = &input.maintenance_schedules {
let mut array_190 = object.key("MaintenanceSchedules").start_array();
for item_191 in var_189 {
{
#[allow(unused_mut)]
let mut object_192 = array_190.value().start_object();
crate::json_ser::serialize_structure_crate_model_auto_tune_maintenance_schedule(
&mut object_192,
item_191,
)?;
object_192.finish();
}
}
array_190.finish();
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for AutoTuneDesiredState
impl AsRef<str> for AutoTuneDesiredState
source§impl Clone for AutoTuneDesiredState
impl Clone for AutoTuneDesiredState
source§fn clone(&self) -> AutoTuneDesiredState
fn clone(&self) -> AutoTuneDesiredState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AutoTuneDesiredState
impl Debug for AutoTuneDesiredState
source§impl From<&str> for AutoTuneDesiredState
impl From<&str> for AutoTuneDesiredState
source§impl FromStr for AutoTuneDesiredState
impl FromStr for AutoTuneDesiredState
source§impl Hash for AutoTuneDesiredState
impl Hash for AutoTuneDesiredState
source§impl Ord for AutoTuneDesiredState
impl Ord for AutoTuneDesiredState
source§fn cmp(&self, other: &AutoTuneDesiredState) -> Ordering
fn cmp(&self, other: &AutoTuneDesiredState) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<AutoTuneDesiredState> for AutoTuneDesiredState
impl PartialEq<AutoTuneDesiredState> for AutoTuneDesiredState
source§fn eq(&self, other: &AutoTuneDesiredState) -> bool
fn eq(&self, other: &AutoTuneDesiredState) -> bool
source§impl PartialOrd<AutoTuneDesiredState> for AutoTuneDesiredState
impl PartialOrd<AutoTuneDesiredState> for AutoTuneDesiredState
source§fn partial_cmp(&self, other: &AutoTuneDesiredState) -> Option<Ordering>
fn partial_cmp(&self, other: &AutoTuneDesiredState) -> 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 AutoTuneDesiredState
impl StructuralEq for AutoTuneDesiredState
impl StructuralPartialEq for AutoTuneDesiredState
Auto Trait Implementations§
impl RefUnwindSafe for AutoTuneDesiredState
impl Send for AutoTuneDesiredState
impl Sync for AutoTuneDesiredState
impl Unpin for AutoTuneDesiredState
impl UnwindSafe for AutoTuneDesiredState
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.