#[non_exhaustive]
pub enum OAuthScopesElement {
    AwsCognitoSigninUserAdmin,
    Email,
    Openid,
    Phone,
    Profile,
    Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against OAuthScopesElement, 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 oauthscopeselement = unimplemented!();
match oauthscopeselement {
    OAuthScopesElement::AwsCognitoSigninUserAdmin => { /* ... */ },
    OAuthScopesElement::Email => { /* ... */ },
    OAuthScopesElement::Openid => { /* ... */ },
    OAuthScopesElement::Phone => { /* ... */ },
    OAuthScopesElement::Profile => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

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

AwsCognitoSigninUserAdmin

§

Email

§

Openid

§

Phone

§

Profile

§

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 1945)
1944
1945
1946
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 840)
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
pub fn serialize_structure_crate_model_create_backend_auth_o_auth_config(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::CreateBackendAuthOAuthConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_144) = &input.domain_prefix {
        object.key("domainPrefix").string(var_144.as_str());
    }
    if let Some(var_145) = &input.o_auth_grant_type {
        object.key("oAuthGrantType").string(var_145.as_str());
    }
    if let Some(var_146) = &input.o_auth_scopes {
        let mut array_147 = object.key("oAuthScopes").start_array();
        for item_148 in var_146 {
            {
                array_147.value().string(item_148.as_str());
            }
        }
        array_147.finish();
    }
    if let Some(var_149) = &input.redirect_sign_in_ur_is {
        let mut array_150 = object.key("redirectSignInURIs").start_array();
        for item_151 in var_149 {
            {
                array_150.value().string(item_151.as_str());
            }
        }
        array_150.finish();
    }
    if let Some(var_152) = &input.redirect_sign_out_ur_is {
        let mut array_153 = object.key("redirectSignOutURIs").start_array();
        for item_154 in var_152 {
            {
                array_153.value().string(item_154.as_str());
            }
        }
        array_153.finish();
    }
    if let Some(var_155) = &input.social_provider_settings {
        #[allow(unused_mut)]
        let mut object_156 = object.key("socialProviderSettings").start_object();
        crate::json_ser::serialize_structure_crate_model_social_provider_settings(
            &mut object_156,
            var_155,
        )?;
        object_156.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_create_backend_auth_password_policy_config(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::CreateBackendAuthPasswordPolicyConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_157) = &input.additional_constraints {
        let mut array_158 = object.key("additionalConstraints").start_array();
        for item_159 in var_157 {
            {
                array_158.value().string(item_159.as_str());
            }
        }
        array_158.finish();
    }
    {
        object.key("minimumLength").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::Float((input.minimum_length).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_create_backend_auth_verification_message_config(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::CreateBackendAuthVerificationMessageConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_160) = &input.delivery_method {
        object.key("deliveryMethod").string(var_160.as_str());
    }
    if let Some(var_161) = &input.email_settings {
        #[allow(unused_mut)]
        let mut object_162 = object.key("emailSettings").start_object();
        crate::json_ser::serialize_structure_crate_model_email_settings(&mut object_162, var_161)?;
        object_162.finish();
    }
    if let Some(var_163) = &input.sms_settings {
        #[allow(unused_mut)]
        let mut object_164 = object.key("smsSettings").start_object();
        crate::json_ser::serialize_structure_crate_model_sms_settings(&mut object_164, var_163)?;
        object_164.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_update_backend_auth_forgot_password_config(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::UpdateBackendAuthForgotPasswordConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_165) = &input.delivery_method {
        object.key("deliveryMethod").string(var_165.as_str());
    }
    if let Some(var_166) = &input.email_settings {
        #[allow(unused_mut)]
        let mut object_167 = object.key("emailSettings").start_object();
        crate::json_ser::serialize_structure_crate_model_email_settings(&mut object_167, var_166)?;
        object_167.finish();
    }
    if let Some(var_168) = &input.sms_settings {
        #[allow(unused_mut)]
        let mut object_169 = object.key("smsSettings").start_object();
        crate::json_ser::serialize_structure_crate_model_sms_settings(&mut object_169, var_168)?;
        object_169.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_update_backend_auth_mfa_config(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::UpdateBackendAuthMfaConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_170) = &input.mfa_mode {
        object.key("MFAMode").string(var_170.as_str());
    }
    if let Some(var_171) = &input.settings {
        #[allow(unused_mut)]
        let mut object_172 = object.key("settings").start_object();
        crate::json_ser::serialize_structure_crate_model_settings(&mut object_172, var_171)?;
        object_172.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_update_backend_auth_o_auth_config(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::UpdateBackendAuthOAuthConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_173) = &input.domain_prefix {
        object.key("domainPrefix").string(var_173.as_str());
    }
    if let Some(var_174) = &input.o_auth_grant_type {
        object.key("oAuthGrantType").string(var_174.as_str());
    }
    if let Some(var_175) = &input.o_auth_scopes {
        let mut array_176 = object.key("oAuthScopes").start_array();
        for item_177 in var_175 {
            {
                array_176.value().string(item_177.as_str());
            }
        }
        array_176.finish();
    }
    if let Some(var_178) = &input.redirect_sign_in_ur_is {
        let mut array_179 = object.key("redirectSignInURIs").start_array();
        for item_180 in var_178 {
            {
                array_179.value().string(item_180.as_str());
            }
        }
        array_179.finish();
    }
    if let Some(var_181) = &input.redirect_sign_out_ur_is {
        let mut array_182 = object.key("redirectSignOutURIs").start_array();
        for item_183 in var_181 {
            {
                array_182.value().string(item_183.as_str());
            }
        }
        array_182.finish();
    }
    if let Some(var_184) = &input.social_provider_settings {
        #[allow(unused_mut)]
        let mut object_185 = object.key("socialProviderSettings").start_object();
        crate::json_ser::serialize_structure_crate_model_social_provider_settings(
            &mut object_185,
            var_184,
        )?;
        object_185.finish();
    }
    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