Enum aws_sdk_lambda::model::Architecture
source · #[non_exhaustive]
pub enum Architecture {
Arm64,
X8664,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against Architecture
, 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 architecture = unimplemented!();
match architecture {
Architecture::Arm64 => { /* ... */ },
Architecture::X8664 => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when architecture
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant Architecture::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
Architecture::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 Architecture::NewFeature
is defined.
Specifically, when architecture
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on Architecture::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
Arm64
X8664
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl Architecture
impl Architecture
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
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 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 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
pub fn serialize_structure_crate_input_create_function_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateFunctionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_59) = &input.architectures {
let mut array_60 = object.key("Architectures").start_array();
for item_61 in var_59 {
{
array_60.value().string(item_61.as_str());
}
}
array_60.finish();
}
if let Some(var_62) = &input.code {
#[allow(unused_mut)]
let mut object_63 = object.key("Code").start_object();
crate::json_ser::serialize_structure_crate_model_function_code(&mut object_63, var_62)?;
object_63.finish();
}
if let Some(var_64) = &input.code_signing_config_arn {
object.key("CodeSigningConfigArn").string(var_64.as_str());
}
if let Some(var_65) = &input.dead_letter_config {
#[allow(unused_mut)]
let mut object_66 = object.key("DeadLetterConfig").start_object();
crate::json_ser::serialize_structure_crate_model_dead_letter_config(
&mut object_66,
var_65,
)?;
object_66.finish();
}
if let Some(var_67) = &input.description {
object.key("Description").string(var_67.as_str());
}
if let Some(var_68) = &input.environment {
#[allow(unused_mut)]
let mut object_69 = object.key("Environment").start_object();
crate::json_ser::serialize_structure_crate_model_environment(&mut object_69, var_68)?;
object_69.finish();
}
if let Some(var_70) = &input.ephemeral_storage {
#[allow(unused_mut)]
let mut object_71 = object.key("EphemeralStorage").start_object();
crate::json_ser::serialize_structure_crate_model_ephemeral_storage(&mut object_71, var_70)?;
object_71.finish();
}
if let Some(var_72) = &input.file_system_configs {
let mut array_73 = object.key("FileSystemConfigs").start_array();
for item_74 in var_72 {
{
#[allow(unused_mut)]
let mut object_75 = array_73.value().start_object();
crate::json_ser::serialize_structure_crate_model_file_system_config(
&mut object_75,
item_74,
)?;
object_75.finish();
}
}
array_73.finish();
}
if let Some(var_76) = &input.function_name {
object.key("FunctionName").string(var_76.as_str());
}
if let Some(var_77) = &input.handler {
object.key("Handler").string(var_77.as_str());
}
if let Some(var_78) = &input.image_config {
#[allow(unused_mut)]
let mut object_79 = object.key("ImageConfig").start_object();
crate::json_ser::serialize_structure_crate_model_image_config(&mut object_79, var_78)?;
object_79.finish();
}
if let Some(var_80) = &input.kms_key_arn {
object.key("KMSKeyArn").string(var_80.as_str());
}
if let Some(var_81) = &input.layers {
let mut array_82 = object.key("Layers").start_array();
for item_83 in var_81 {
{
array_82.value().string(item_83.as_str());
}
}
array_82.finish();
}
if let Some(var_84) = &input.memory_size {
object.key("MemorySize").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_84).into()),
);
}
if let Some(var_85) = &input.package_type {
object.key("PackageType").string(var_85.as_str());
}
if input.publish {
object.key("Publish").boolean(input.publish);
}
if let Some(var_86) = &input.role {
object.key("Role").string(var_86.as_str());
}
if let Some(var_87) = &input.runtime {
object.key("Runtime").string(var_87.as_str());
}
if let Some(var_88) = &input.tags {
#[allow(unused_mut)]
let mut object_89 = object.key("Tags").start_object();
for (key_90, value_91) in var_88 {
{
object_89.key(key_90.as_str()).string(value_91.as_str());
}
}
object_89.finish();
}
if let Some(var_92) = &input.timeout {
object.key("Timeout").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_92).into()),
);
}
if let Some(var_93) = &input.tracing_config {
#[allow(unused_mut)]
let mut object_94 = object.key("TracingConfig").start_object();
crate::json_ser::serialize_structure_crate_model_tracing_config(&mut object_94, var_93)?;
object_94.finish();
}
if let Some(var_95) = &input.vpc_config {
#[allow(unused_mut)]
let mut object_96 = object.key("VpcConfig").start_object();
crate::json_ser::serialize_structure_crate_model_vpc_config(&mut object_96, var_95)?;
object_96.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_create_function_url_config_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateFunctionUrlConfigInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_97) = &input.auth_type {
object.key("AuthType").string(var_97.as_str());
}
if let Some(var_98) = &input.cors {
#[allow(unused_mut)]
let mut object_99 = object.key("Cors").start_object();
crate::json_ser::serialize_structure_crate_model_cors(&mut object_99, var_98)?;
object_99.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_publish_layer_version_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::PublishLayerVersionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_100) = &input.compatible_architectures {
let mut array_101 = object.key("CompatibleArchitectures").start_array();
for item_102 in var_100 {
{
array_101.value().string(item_102.as_str());
}
}
array_101.finish();
}
if let Some(var_103) = &input.compatible_runtimes {
let mut array_104 = object.key("CompatibleRuntimes").start_array();
for item_105 in var_103 {
{
array_104.value().string(item_105.as_str());
}
}
array_104.finish();
}
if let Some(var_106) = &input.content {
#[allow(unused_mut)]
let mut object_107 = object.key("Content").start_object();
crate::json_ser::serialize_structure_crate_model_layer_version_content_input(
&mut object_107,
var_106,
)?;
object_107.finish();
}
if let Some(var_108) = &input.description {
object.key("Description").string(var_108.as_str());
}
if let Some(var_109) = &input.license_info {
object.key("LicenseInfo").string(var_109.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_publish_version_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::PublishVersionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_110) = &input.code_sha256 {
object.key("CodeSha256").string(var_110.as_str());
}
if let Some(var_111) = &input.description {
object.key("Description").string(var_111.as_str());
}
if let Some(var_112) = &input.revision_id {
object.key("RevisionId").string(var_112.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_put_function_code_signing_config_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::PutFunctionCodeSigningConfigInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_113) = &input.code_signing_config_arn {
object.key("CodeSigningConfigArn").string(var_113.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_put_function_concurrency_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::PutFunctionConcurrencyInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_114) = &input.reserved_concurrent_executions {
object.key("ReservedConcurrentExecutions").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_114).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_input_put_function_event_invoke_config_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::PutFunctionEventInvokeConfigInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_115) = &input.destination_config {
#[allow(unused_mut)]
let mut object_116 = object.key("DestinationConfig").start_object();
crate::json_ser::serialize_structure_crate_model_destination_config(
&mut object_116,
var_115,
)?;
object_116.finish();
}
if let Some(var_117) = &input.maximum_event_age_in_seconds {
object.key("MaximumEventAgeInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_117).into()),
);
}
if let Some(var_118) = &input.maximum_retry_attempts {
object.key("MaximumRetryAttempts").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_118).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_input_put_provisioned_concurrency_config_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::PutProvisionedConcurrencyConfigInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_119) = &input.provisioned_concurrent_executions {
object.key("ProvisionedConcurrentExecutions").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_119).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_input_tag_resource_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::TagResourceInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_120) = &input.tags {
#[allow(unused_mut)]
let mut object_121 = object.key("Tags").start_object();
for (key_122, value_123) in var_120 {
{
object_121.key(key_122.as_str()).string(value_123.as_str());
}
}
object_121.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_update_alias_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateAliasInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_124) = &input.description {
object.key("Description").string(var_124.as_str());
}
if let Some(var_125) = &input.function_version {
object.key("FunctionVersion").string(var_125.as_str());
}
if let Some(var_126) = &input.revision_id {
object.key("RevisionId").string(var_126.as_str());
}
if let Some(var_127) = &input.routing_config {
#[allow(unused_mut)]
let mut object_128 = object.key("RoutingConfig").start_object();
crate::json_ser::serialize_structure_crate_model_alias_routing_configuration(
&mut object_128,
var_127,
)?;
object_128.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_update_code_signing_config_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateCodeSigningConfigInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_129) = &input.allowed_publishers {
#[allow(unused_mut)]
let mut object_130 = object.key("AllowedPublishers").start_object();
crate::json_ser::serialize_structure_crate_model_allowed_publishers(
&mut object_130,
var_129,
)?;
object_130.finish();
}
if let Some(var_131) = &input.code_signing_policies {
#[allow(unused_mut)]
let mut object_132 = object.key("CodeSigningPolicies").start_object();
crate::json_ser::serialize_structure_crate_model_code_signing_policies(
&mut object_132,
var_131,
)?;
object_132.finish();
}
if let Some(var_133) = &input.description {
object.key("Description").string(var_133.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_event_source_mapping_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateEventSourceMappingInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_134) = &input.batch_size {
object.key("BatchSize").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_134).into()),
);
}
if let Some(var_135) = &input.bisect_batch_on_function_error {
object.key("BisectBatchOnFunctionError").boolean(*var_135);
}
if let Some(var_136) = &input.destination_config {
#[allow(unused_mut)]
let mut object_137 = object.key("DestinationConfig").start_object();
crate::json_ser::serialize_structure_crate_model_destination_config(
&mut object_137,
var_136,
)?;
object_137.finish();
}
if let Some(var_138) = &input.enabled {
object.key("Enabled").boolean(*var_138);
}
if let Some(var_139) = &input.filter_criteria {
#[allow(unused_mut)]
let mut object_140 = object.key("FilterCriteria").start_object();
crate::json_ser::serialize_structure_crate_model_filter_criteria(&mut object_140, var_139)?;
object_140.finish();
}
if let Some(var_141) = &input.function_name {
object.key("FunctionName").string(var_141.as_str());
}
if let Some(var_142) = &input.function_response_types {
let mut array_143 = object.key("FunctionResponseTypes").start_array();
for item_144 in var_142 {
{
array_143.value().string(item_144.as_str());
}
}
array_143.finish();
}
if let Some(var_145) = &input.maximum_batching_window_in_seconds {
object.key("MaximumBatchingWindowInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_145).into()),
);
}
if let Some(var_146) = &input.maximum_record_age_in_seconds {
object.key("MaximumRecordAgeInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_146).into()),
);
}
if let Some(var_147) = &input.maximum_retry_attempts {
object.key("MaximumRetryAttempts").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_147).into()),
);
}
if let Some(var_148) = &input.parallelization_factor {
object.key("ParallelizationFactor").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_148).into()),
);
}
if let Some(var_149) = &input.source_access_configurations {
let mut array_150 = object.key("SourceAccessConfigurations").start_array();
for item_151 in var_149 {
{
#[allow(unused_mut)]
let mut object_152 = array_150.value().start_object();
crate::json_ser::serialize_structure_crate_model_source_access_configuration(
&mut object_152,
item_151,
)?;
object_152.finish();
}
}
array_150.finish();
}
if let Some(var_153) = &input.tumbling_window_in_seconds {
object.key("TumblingWindowInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_153).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_input_update_function_code_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateFunctionCodeInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_154) = &input.architectures {
let mut array_155 = object.key("Architectures").start_array();
for item_156 in var_154 {
{
array_155.value().string(item_156.as_str());
}
}
array_155.finish();
}
if input.dry_run {
object.key("DryRun").boolean(input.dry_run);
}
if let Some(var_157) = &input.image_uri {
object.key("ImageUri").string(var_157.as_str());
}
if input.publish {
object.key("Publish").boolean(input.publish);
}
if let Some(var_158) = &input.revision_id {
object.key("RevisionId").string(var_158.as_str());
}
if let Some(var_159) = &input.s3_bucket {
object.key("S3Bucket").string(var_159.as_str());
}
if let Some(var_160) = &input.s3_key {
object.key("S3Key").string(var_160.as_str());
}
if let Some(var_161) = &input.s3_object_version {
object.key("S3ObjectVersion").string(var_161.as_str());
}
if let Some(var_162) = &input.zip_file {
object
.key("ZipFile")
.string_unchecked(&aws_smithy_types::base64::encode(var_162));
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for Architecture
impl AsRef<str> for Architecture
source§impl Clone for Architecture
impl Clone for Architecture
source§fn clone(&self) -> Architecture
fn clone(&self) -> Architecture
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Architecture
impl Debug for Architecture
source§impl From<&str> for Architecture
impl From<&str> for Architecture
source§impl FromStr for Architecture
impl FromStr for Architecture
source§impl Hash for Architecture
impl Hash for Architecture
source§impl Ord for Architecture
impl Ord for Architecture
source§fn cmp(&self, other: &Architecture) -> Ordering
fn cmp(&self, other: &Architecture) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<Architecture> for Architecture
impl PartialEq<Architecture> for Architecture
source§fn eq(&self, other: &Architecture) -> bool
fn eq(&self, other: &Architecture) -> bool
source§impl PartialOrd<Architecture> for Architecture
impl PartialOrd<Architecture> for Architecture
source§fn partial_cmp(&self, other: &Architecture) -> Option<Ordering>
fn partial_cmp(&self, other: &Architecture) -> 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 Architecture
impl StructuralEq for Architecture
impl StructuralPartialEq for Architecture
Auto Trait Implementations§
impl RefUnwindSafe for Architecture
impl Send for Architecture
impl Sync for Architecture
impl Unpin for Architecture
impl UnwindSafe for Architecture
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.