#[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
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
AwsCognitoSigninUserAdmin
Openid
Phone
Profile
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl OAuthScopesElement
impl OAuthScopesElement
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
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(())
}Trait Implementations§
source§impl AsRef<str> for OAuthScopesElement
impl AsRef<str> for OAuthScopesElement
source§impl Clone for OAuthScopesElement
impl Clone for OAuthScopesElement
source§fn clone(&self) -> OAuthScopesElement
fn clone(&self) -> OAuthScopesElement
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for OAuthScopesElement
impl Debug for OAuthScopesElement
source§impl From<&str> for OAuthScopesElement
impl From<&str> for OAuthScopesElement
source§impl FromStr for OAuthScopesElement
impl FromStr for OAuthScopesElement
source§impl Hash for OAuthScopesElement
impl Hash for OAuthScopesElement
source§impl Ord for OAuthScopesElement
impl Ord for OAuthScopesElement
source§fn cmp(&self, other: &OAuthScopesElement) -> Ordering
fn cmp(&self, other: &OAuthScopesElement) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<OAuthScopesElement> for OAuthScopesElement
impl PartialEq<OAuthScopesElement> for OAuthScopesElement
source§fn eq(&self, other: &OAuthScopesElement) -> bool
fn eq(&self, other: &OAuthScopesElement) -> bool
source§impl PartialOrd<OAuthScopesElement> for OAuthScopesElement
impl PartialOrd<OAuthScopesElement> for OAuthScopesElement
source§fn partial_cmp(&self, other: &OAuthScopesElement) -> Option<Ordering>
fn partial_cmp(&self, other: &OAuthScopesElement) -> 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 OAuthScopesElement
impl StructuralEq for OAuthScopesElement
impl StructuralPartialEq for OAuthScopesElement
Auto Trait Implementations§
impl RefUnwindSafe for OAuthScopesElement
impl Send for OAuthScopesElement
impl Sync for OAuthScopesElement
impl Unpin for OAuthScopesElement
impl UnwindSafe for OAuthScopesElement
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.