#[non_exhaustive]
pub enum RecordState {
    Active,
    Archived,
    Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against RecordState, 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 recordstate = unimplemented!();
match recordstate {
    RecordState::Active => { /* ... */ },
    RecordState::Archived => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

The above code demonstrates that when recordstate represents NewFeature, the execution path will lead to the second last match arm, even though the enum does not contain a variant RecordState::NewFeature in the current version of SDK. The reason is that the variable other, created by the @ operator, is bound to RecordState::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 RecordState::NewFeature is defined. Specifically, when recordstate represents NewFeature, the execution path will hit the second last match arm as before by virtue of calling as_str on RecordState::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.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Active

§

Archived

§

Unknown(UnknownVariantValue)

Unknown contains new variants that have been added since this code was generated.

Implementations§

Returns the &str value of the enum member.

Examples found in repository?
src/model.rs (line 4270)
4269
4270
4271
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 591)
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
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
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
pub fn serialize_structure_crate_input_update_findings_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateFindingsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_108) = &input.filters {
        #[allow(unused_mut)]
        let mut object_109 = object.key("Filters").start_object();
        crate::json_ser::serialize_structure_crate_model_aws_security_finding_filters(
            &mut object_109,
            var_108,
        )?;
        object_109.finish();
    }
    if let Some(var_110) = &input.note {
        #[allow(unused_mut)]
        let mut object_111 = object.key("Note").start_object();
        crate::json_ser::serialize_structure_crate_model_note_update(&mut object_111, var_110)?;
        object_111.finish();
    }
    if let Some(var_112) = &input.record_state {
        object.key("RecordState").string(var_112.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_insight_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateInsightInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_113) = &input.filters {
        #[allow(unused_mut)]
        let mut object_114 = object.key("Filters").start_object();
        crate::json_ser::serialize_structure_crate_model_aws_security_finding_filters(
            &mut object_114,
            var_113,
        )?;
        object_114.finish();
    }
    if let Some(var_115) = &input.group_by_attribute {
        object.key("GroupByAttribute").string(var_115.as_str());
    }
    if let Some(var_116) = &input.name {
        object.key("Name").string(var_116.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_organization_configuration_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateOrganizationConfigurationInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    {
        object.key("AutoEnable").boolean(input.auto_enable);
    }
    if let Some(var_117) = &input.auto_enable_standards {
        object.key("AutoEnableStandards").string(var_117.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_security_hub_configuration_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateSecurityHubConfigurationInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if input.auto_enable_controls {
        object
            .key("AutoEnableControls")
            .boolean(input.auto_enable_controls);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_standards_control_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateStandardsControlInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_118) = &input.control_status {
        object.key("ControlStatus").string(var_118.as_str());
    }
    if let Some(var_119) = &input.disabled_reason {
        object.key("DisabledReason").string(var_119.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_standards_subscription_request(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::StandardsSubscriptionRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_120) = &input.standards_arn {
        object.key("StandardsArn").string(var_120.as_str());
    }
    if let Some(var_121) = &input.standards_input {
        #[allow(unused_mut)]
        let mut object_122 = object.key("StandardsInput").start_object();
        for (key_123, value_124) in var_121 {
            {
                object_122.key(key_123.as_str()).string(value_124.as_str());
            }
        }
        object_122.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_aws_security_finding(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::AwsSecurityFinding,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_125) = &input.schema_version {
        object.key("SchemaVersion").string(var_125.as_str());
    }
    if let Some(var_126) = &input.id {
        object.key("Id").string(var_126.as_str());
    }
    if let Some(var_127) = &input.product_arn {
        object.key("ProductArn").string(var_127.as_str());
    }
    if let Some(var_128) = &input.product_name {
        object.key("ProductName").string(var_128.as_str());
    }
    if let Some(var_129) = &input.company_name {
        object.key("CompanyName").string(var_129.as_str());
    }
    if let Some(var_130) = &input.region {
        object.key("Region").string(var_130.as_str());
    }
    if let Some(var_131) = &input.generator_id {
        object.key("GeneratorId").string(var_131.as_str());
    }
    if let Some(var_132) = &input.aws_account_id {
        object.key("AwsAccountId").string(var_132.as_str());
    }
    if let Some(var_133) = &input.types {
        let mut array_134 = object.key("Types").start_array();
        for item_135 in var_133 {
            {
                array_134.value().string(item_135.as_str());
            }
        }
        array_134.finish();
    }
    if let Some(var_136) = &input.first_observed_at {
        object.key("FirstObservedAt").string(var_136.as_str());
    }
    if let Some(var_137) = &input.last_observed_at {
        object.key("LastObservedAt").string(var_137.as_str());
    }
    if let Some(var_138) = &input.created_at {
        object.key("CreatedAt").string(var_138.as_str());
    }
    if let Some(var_139) = &input.updated_at {
        object.key("UpdatedAt").string(var_139.as_str());
    }
    if let Some(var_140) = &input.severity {
        #[allow(unused_mut)]
        let mut object_141 = object.key("Severity").start_object();
        crate::json_ser::serialize_structure_crate_model_severity(&mut object_141, var_140)?;
        object_141.finish();
    }
    if input.confidence != 0 {
        object.key("Confidence").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.confidence).into()),
        );
    }
    if input.criticality != 0 {
        object.key("Criticality").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.criticality).into()),
        );
    }
    if let Some(var_142) = &input.title {
        object.key("Title").string(var_142.as_str());
    }
    if let Some(var_143) = &input.description {
        object.key("Description").string(var_143.as_str());
    }
    if let Some(var_144) = &input.remediation {
        #[allow(unused_mut)]
        let mut object_145 = object.key("Remediation").start_object();
        crate::json_ser::serialize_structure_crate_model_remediation(&mut object_145, var_144)?;
        object_145.finish();
    }
    if let Some(var_146) = &input.source_url {
        object.key("SourceUrl").string(var_146.as_str());
    }
    if let Some(var_147) = &input.product_fields {
        #[allow(unused_mut)]
        let mut object_148 = object.key("ProductFields").start_object();
        for (key_149, value_150) in var_147 {
            {
                object_148.key(key_149.as_str()).string(value_150.as_str());
            }
        }
        object_148.finish();
    }
    if let Some(var_151) = &input.user_defined_fields {
        #[allow(unused_mut)]
        let mut object_152 = object.key("UserDefinedFields").start_object();
        for (key_153, value_154) in var_151 {
            {
                object_152.key(key_153.as_str()).string(value_154.as_str());
            }
        }
        object_152.finish();
    }
    if let Some(var_155) = &input.malware {
        let mut array_156 = object.key("Malware").start_array();
        for item_157 in var_155 {
            {
                #[allow(unused_mut)]
                let mut object_158 = array_156.value().start_object();
                crate::json_ser::serialize_structure_crate_model_malware(
                    &mut object_158,
                    item_157,
                )?;
                object_158.finish();
            }
        }
        array_156.finish();
    }
    if let Some(var_159) = &input.network {
        #[allow(unused_mut)]
        let mut object_160 = object.key("Network").start_object();
        crate::json_ser::serialize_structure_crate_model_network(&mut object_160, var_159)?;
        object_160.finish();
    }
    if let Some(var_161) = &input.network_path {
        let mut array_162 = object.key("NetworkPath").start_array();
        for item_163 in var_161 {
            {
                #[allow(unused_mut)]
                let mut object_164 = array_162.value().start_object();
                crate::json_ser::serialize_structure_crate_model_network_path_component(
                    &mut object_164,
                    item_163,
                )?;
                object_164.finish();
            }
        }
        array_162.finish();
    }
    if let Some(var_165) = &input.process {
        #[allow(unused_mut)]
        let mut object_166 = object.key("Process").start_object();
        crate::json_ser::serialize_structure_crate_model_process_details(&mut object_166, var_165)?;
        object_166.finish();
    }
    if let Some(var_167) = &input.threats {
        let mut array_168 = object.key("Threats").start_array();
        for item_169 in var_167 {
            {
                #[allow(unused_mut)]
                let mut object_170 = array_168.value().start_object();
                crate::json_ser::serialize_structure_crate_model_threat(&mut object_170, item_169)?;
                object_170.finish();
            }
        }
        array_168.finish();
    }
    if let Some(var_171) = &input.threat_intel_indicators {
        let mut array_172 = object.key("ThreatIntelIndicators").start_array();
        for item_173 in var_171 {
            {
                #[allow(unused_mut)]
                let mut object_174 = array_172.value().start_object();
                crate::json_ser::serialize_structure_crate_model_threat_intel_indicator(
                    &mut object_174,
                    item_173,
                )?;
                object_174.finish();
            }
        }
        array_172.finish();
    }
    if let Some(var_175) = &input.resources {
        let mut array_176 = object.key("Resources").start_array();
        for item_177 in var_175 {
            {
                #[allow(unused_mut)]
                let mut object_178 = array_176.value().start_object();
                crate::json_ser::serialize_structure_crate_model_resource(
                    &mut object_178,
                    item_177,
                )?;
                object_178.finish();
            }
        }
        array_176.finish();
    }
    if let Some(var_179) = &input.compliance {
        #[allow(unused_mut)]
        let mut object_180 = object.key("Compliance").start_object();
        crate::json_ser::serialize_structure_crate_model_compliance(&mut object_180, var_179)?;
        object_180.finish();
    }
    if let Some(var_181) = &input.verification_state {
        object.key("VerificationState").string(var_181.as_str());
    }
    if let Some(var_182) = &input.workflow_state {
        object.key("WorkflowState").string(var_182.as_str());
    }
    if let Some(var_183) = &input.workflow {
        #[allow(unused_mut)]
        let mut object_184 = object.key("Workflow").start_object();
        crate::json_ser::serialize_structure_crate_model_workflow(&mut object_184, var_183)?;
        object_184.finish();
    }
    if let Some(var_185) = &input.record_state {
        object.key("RecordState").string(var_185.as_str());
    }
    if let Some(var_186) = &input.related_findings {
        let mut array_187 = object.key("RelatedFindings").start_array();
        for item_188 in var_186 {
            {
                #[allow(unused_mut)]
                let mut object_189 = array_187.value().start_object();
                crate::json_ser::serialize_structure_crate_model_related_finding(
                    &mut object_189,
                    item_188,
                )?;
                object_189.finish();
            }
        }
        array_187.finish();
    }
    if let Some(var_190) = &input.note {
        #[allow(unused_mut)]
        let mut object_191 = object.key("Note").start_object();
        crate::json_ser::serialize_structure_crate_model_note(&mut object_191, var_190)?;
        object_191.finish();
    }
    if let Some(var_192) = &input.vulnerabilities {
        let mut array_193 = object.key("Vulnerabilities").start_array();
        for item_194 in var_192 {
            {
                #[allow(unused_mut)]
                let mut object_195 = array_193.value().start_object();
                crate::json_ser::serialize_structure_crate_model_vulnerability(
                    &mut object_195,
                    item_194,
                )?;
                object_195.finish();
            }
        }
        array_193.finish();
    }
    if let Some(var_196) = &input.patch_summary {
        #[allow(unused_mut)]
        let mut object_197 = object.key("PatchSummary").start_object();
        crate::json_ser::serialize_structure_crate_model_patch_summary(&mut object_197, var_196)?;
        object_197.finish();
    }
    if let Some(var_198) = &input.action {
        #[allow(unused_mut)]
        let mut object_199 = object.key("Action").start_object();
        crate::json_ser::serialize_structure_crate_model_action(&mut object_199, var_198)?;
        object_199.finish();
    }
    if let Some(var_200) = &input.finding_provider_fields {
        #[allow(unused_mut)]
        let mut object_201 = object.key("FindingProviderFields").start_object();
        crate::json_ser::serialize_structure_crate_model_finding_provider_fields(
            &mut object_201,
            var_200,
        )?;
        object_201.finish();
    }
    if input.sample {
        object.key("Sample").boolean(input.sample);
    }
    Ok(())
}

Returns all the &str values of the enum members.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more