Enum aws_sdk_elasticache::model::OutpostMode
source · #[non_exhaustive]
pub enum OutpostMode {
CrossOutpost,
SingleOutpost,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against OutpostMode
, 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 outpostmode = unimplemented!();
match outpostmode {
OutpostMode::CrossOutpost => { /* ... */ },
OutpostMode::SingleOutpost => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when outpostmode
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant OutpostMode::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
OutpostMode::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 OutpostMode::NewFeature
is defined.
Specifically, when outpostmode
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on OutpostMode::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
CrossOutpost
SingleOutpost
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl OutpostMode
impl OutpostMode
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
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398
pub fn serialize_operation_crate_operation_create_cache_cluster(
input: &crate::input::CreateCacheClusterInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::error::SerializationError> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
aws_smithy_query::QueryWriter::new(&mut out, "CreateCacheCluster", "2015-02-02");
#[allow(unused_mut)]
let mut scope_54 = writer.prefix("CacheClusterId");
if let Some(var_55) = &input.cache_cluster_id {
scope_54.string(var_55);
}
#[allow(unused_mut)]
let mut scope_56 = writer.prefix("ReplicationGroupId");
if let Some(var_57) = &input.replication_group_id {
scope_56.string(var_57);
}
#[allow(unused_mut)]
let mut scope_58 = writer.prefix("AZMode");
if let Some(var_59) = &input.az_mode {
scope_58.string(var_59.as_str());
}
#[allow(unused_mut)]
let mut scope_60 = writer.prefix("PreferredAvailabilityZone");
if let Some(var_61) = &input.preferred_availability_zone {
scope_60.string(var_61);
}
#[allow(unused_mut)]
let mut scope_62 = writer.prefix("PreferredAvailabilityZones");
if let Some(var_63) = &input.preferred_availability_zones {
let mut list_65 = scope_62.start_list(false, Some("PreferredAvailabilityZone"));
for item_64 in var_63 {
#[allow(unused_mut)]
let mut entry_66 = list_65.entry();
entry_66.string(item_64);
}
list_65.finish();
}
#[allow(unused_mut)]
let mut scope_67 = writer.prefix("NumCacheNodes");
if let Some(var_68) = &input.num_cache_nodes {
scope_67.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_68).into()),
);
}
#[allow(unused_mut)]
let mut scope_69 = writer.prefix("CacheNodeType");
if let Some(var_70) = &input.cache_node_type {
scope_69.string(var_70);
}
#[allow(unused_mut)]
let mut scope_71 = writer.prefix("Engine");
if let Some(var_72) = &input.engine {
scope_71.string(var_72);
}
#[allow(unused_mut)]
let mut scope_73 = writer.prefix("EngineVersion");
if let Some(var_74) = &input.engine_version {
scope_73.string(var_74);
}
#[allow(unused_mut)]
let mut scope_75 = writer.prefix("CacheParameterGroupName");
if let Some(var_76) = &input.cache_parameter_group_name {
scope_75.string(var_76);
}
#[allow(unused_mut)]
let mut scope_77 = writer.prefix("CacheSubnetGroupName");
if let Some(var_78) = &input.cache_subnet_group_name {
scope_77.string(var_78);
}
#[allow(unused_mut)]
let mut scope_79 = writer.prefix("CacheSecurityGroupNames");
if let Some(var_80) = &input.cache_security_group_names {
let mut list_82 = scope_79.start_list(false, Some("CacheSecurityGroupName"));
for item_81 in var_80 {
#[allow(unused_mut)]
let mut entry_83 = list_82.entry();
entry_83.string(item_81);
}
list_82.finish();
}
#[allow(unused_mut)]
let mut scope_84 = writer.prefix("SecurityGroupIds");
if let Some(var_85) = &input.security_group_ids {
let mut list_87 = scope_84.start_list(false, Some("SecurityGroupId"));
for item_86 in var_85 {
#[allow(unused_mut)]
let mut entry_88 = list_87.entry();
entry_88.string(item_86);
}
list_87.finish();
}
#[allow(unused_mut)]
let mut scope_89 = writer.prefix("Tags");
if let Some(var_90) = &input.tags {
let mut list_92 = scope_89.start_list(false, Some("Tag"));
for item_91 in var_90 {
#[allow(unused_mut)]
let mut entry_93 = list_92.entry();
crate::query_ser::serialize_structure_crate_model_tag(entry_93, item_91)?;
}
list_92.finish();
}
#[allow(unused_mut)]
let mut scope_94 = writer.prefix("SnapshotArns");
if let Some(var_95) = &input.snapshot_arns {
let mut list_97 = scope_94.start_list(false, Some("SnapshotArn"));
for item_96 in var_95 {
#[allow(unused_mut)]
let mut entry_98 = list_97.entry();
entry_98.string(item_96);
}
list_97.finish();
}
#[allow(unused_mut)]
let mut scope_99 = writer.prefix("SnapshotName");
if let Some(var_100) = &input.snapshot_name {
scope_99.string(var_100);
}
#[allow(unused_mut)]
let mut scope_101 = writer.prefix("PreferredMaintenanceWindow");
if let Some(var_102) = &input.preferred_maintenance_window {
scope_101.string(var_102);
}
#[allow(unused_mut)]
let mut scope_103 = writer.prefix("Port");
if let Some(var_104) = &input.port {
scope_103.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_104).into()),
);
}
#[allow(unused_mut)]
let mut scope_105 = writer.prefix("NotificationTopicArn");
if let Some(var_106) = &input.notification_topic_arn {
scope_105.string(var_106);
}
#[allow(unused_mut)]
let mut scope_107 = writer.prefix("AutoMinorVersionUpgrade");
if let Some(var_108) = &input.auto_minor_version_upgrade {
scope_107.boolean(*var_108);
}
#[allow(unused_mut)]
let mut scope_109 = writer.prefix("SnapshotRetentionLimit");
if let Some(var_110) = &input.snapshot_retention_limit {
scope_109.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_110).into()),
);
}
#[allow(unused_mut)]
let mut scope_111 = writer.prefix("SnapshotWindow");
if let Some(var_112) = &input.snapshot_window {
scope_111.string(var_112);
}
#[allow(unused_mut)]
let mut scope_113 = writer.prefix("AuthToken");
if let Some(var_114) = &input.auth_token {
scope_113.string(var_114);
}
#[allow(unused_mut)]
let mut scope_115 = writer.prefix("OutpostMode");
if let Some(var_116) = &input.outpost_mode {
scope_115.string(var_116.as_str());
}
#[allow(unused_mut)]
let mut scope_117 = writer.prefix("PreferredOutpostArn");
if let Some(var_118) = &input.preferred_outpost_arn {
scope_117.string(var_118);
}
#[allow(unused_mut)]
let mut scope_119 = writer.prefix("PreferredOutpostArns");
if let Some(var_120) = &input.preferred_outpost_arns {
let mut list_122 = scope_119.start_list(false, Some("PreferredOutpostArn"));
for item_121 in var_120 {
#[allow(unused_mut)]
let mut entry_123 = list_122.entry();
entry_123.string(item_121);
}
list_122.finish();
}
#[allow(unused_mut)]
let mut scope_124 = writer.prefix("LogDeliveryConfigurations");
if let Some(var_125) = &input.log_delivery_configurations {
let mut list_127 = scope_124.start_list(false, Some("LogDeliveryConfigurationRequest"));
for item_126 in var_125 {
#[allow(unused_mut)]
let mut entry_128 = list_127.entry();
crate::query_ser::serialize_structure_crate_model_log_delivery_configuration_request(
entry_128, item_126,
)?;
}
list_127.finish();
}
#[allow(unused_mut)]
let mut scope_129 = writer.prefix("TransitEncryptionEnabled");
if let Some(var_130) = &input.transit_encryption_enabled {
scope_129.boolean(*var_130);
}
writer.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
Trait Implementations§
source§impl AsRef<str> for OutpostMode
impl AsRef<str> for OutpostMode
source§impl Clone for OutpostMode
impl Clone for OutpostMode
source§fn clone(&self) -> OutpostMode
fn clone(&self) -> OutpostMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for OutpostMode
impl Debug for OutpostMode
source§impl From<&str> for OutpostMode
impl From<&str> for OutpostMode
source§impl FromStr for OutpostMode
impl FromStr for OutpostMode
source§impl Hash for OutpostMode
impl Hash for OutpostMode
source§impl Ord for OutpostMode
impl Ord for OutpostMode
source§fn cmp(&self, other: &OutpostMode) -> Ordering
fn cmp(&self, other: &OutpostMode) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<OutpostMode> for OutpostMode
impl PartialEq<OutpostMode> for OutpostMode
source§fn eq(&self, other: &OutpostMode) -> bool
fn eq(&self, other: &OutpostMode) -> bool
source§impl PartialOrd<OutpostMode> for OutpostMode
impl PartialOrd<OutpostMode> for OutpostMode
source§fn partial_cmp(&self, other: &OutpostMode) -> Option<Ordering>
fn partial_cmp(&self, other: &OutpostMode) -> 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 OutpostMode
impl StructuralEq for OutpostMode
impl StructuralPartialEq for OutpostMode
Auto Trait Implementations§
impl RefUnwindSafe for OutpostMode
impl Send for OutpostMode
impl Sync for OutpostMode
impl Unpin for OutpostMode
impl UnwindSafe for OutpostMode
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.