Enum aws_sdk_ec2::model::SpotInstanceType
source · #[non_exhaustive]
pub enum SpotInstanceType {
OneTime,
Persistent,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against SpotInstanceType
, 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 spotinstancetype = unimplemented!();
match spotinstancetype {
SpotInstanceType::OneTime => { /* ... */ },
SpotInstanceType::Persistent => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when spotinstancetype
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant SpotInstanceType::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
SpotInstanceType::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 SpotInstanceType::NewFeature
is defined.
Specifically, when spotinstancetype
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on SpotInstanceType::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
OneTime
Persistent
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl SpotInstanceType
impl SpotInstanceType
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
5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909
pub fn serialize_structure_crate_model_spot_market_options(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::SpotMarketOptions,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1547 = writer.prefix("MaxPrice");
if let Some(var_1548) = &input.max_price {
scope_1547.string(var_1548);
}
#[allow(unused_mut)]
let mut scope_1549 = writer.prefix("SpotInstanceType");
if let Some(var_1550) = &input.spot_instance_type {
scope_1549.string(var_1550.as_str());
}
#[allow(unused_mut)]
let mut scope_1551 = writer.prefix("BlockDurationMinutes");
if let Some(var_1552) = &input.block_duration_minutes {
scope_1551.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1552).into()),
);
}
#[allow(unused_mut)]
let mut scope_1553 = writer.prefix("ValidUntil");
if let Some(var_1554) = &input.valid_until {
scope_1553.date_time(var_1554, aws_smithy_types::date_time::Format::DateTime)?;
}
#[allow(unused_mut)]
let mut scope_1555 = writer.prefix("InstanceInterruptionBehavior");
if let Some(var_1556) = &input.instance_interruption_behavior {
scope_1555.string(var_1556.as_str());
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_scheduled_instances_block_device_mapping(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::ScheduledInstancesBlockDeviceMapping,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1557 = writer.prefix("DeviceName");
if let Some(var_1558) = &input.device_name {
scope_1557.string(var_1558);
}
#[allow(unused_mut)]
let mut scope_1559 = writer.prefix("Ebs");
if let Some(var_1560) = &input.ebs {
crate::query_ser::serialize_structure_crate_model_scheduled_instances_ebs(
scope_1559, var_1560,
)?;
}
#[allow(unused_mut)]
let mut scope_1561 = writer.prefix("NoDevice");
if let Some(var_1562) = &input.no_device {
scope_1561.string(var_1562);
}
#[allow(unused_mut)]
let mut scope_1563 = writer.prefix("VirtualName");
if let Some(var_1564) = &input.virtual_name {
scope_1563.string(var_1564);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_scheduled_instances_iam_instance_profile(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::ScheduledInstancesIamInstanceProfile,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1565 = writer.prefix("Arn");
if let Some(var_1566) = &input.arn {
scope_1565.string(var_1566);
}
#[allow(unused_mut)]
let mut scope_1567 = writer.prefix("Name");
if let Some(var_1568) = &input.name {
scope_1567.string(var_1568);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_scheduled_instances_monitoring(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::ScheduledInstancesMonitoring,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1569 = writer.prefix("Enabled");
if let Some(var_1570) = &input.enabled {
scope_1569.boolean(*var_1570);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_scheduled_instances_network_interface(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::ScheduledInstancesNetworkInterface,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1571 = writer.prefix("AssociatePublicIpAddress");
if let Some(var_1572) = &input.associate_public_ip_address {
scope_1571.boolean(*var_1572);
}
#[allow(unused_mut)]
let mut scope_1573 = writer.prefix("DeleteOnTermination");
if let Some(var_1574) = &input.delete_on_termination {
scope_1573.boolean(*var_1574);
}
#[allow(unused_mut)]
let mut scope_1575 = writer.prefix("Description");
if let Some(var_1576) = &input.description {
scope_1575.string(var_1576);
}
#[allow(unused_mut)]
let mut scope_1577 = writer.prefix("DeviceIndex");
if let Some(var_1578) = &input.device_index {
scope_1577.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1578).into()),
);
}
#[allow(unused_mut)]
let mut scope_1579 = writer.prefix("Group");
if let Some(var_1580) = &input.groups {
let mut list_1582 = scope_1579.start_list(true, Some("SecurityGroupId"));
for item_1581 in var_1580 {
#[allow(unused_mut)]
let mut entry_1583 = list_1582.entry();
entry_1583.string(item_1581);
}
list_1582.finish();
}
#[allow(unused_mut)]
let mut scope_1584 = writer.prefix("Ipv6AddressCount");
if let Some(var_1585) = &input.ipv6_address_count {
scope_1584.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1585).into()),
);
}
#[allow(unused_mut)]
let mut scope_1586 = writer.prefix("Ipv6Address");
if let Some(var_1587) = &input.ipv6_addresses {
let mut list_1589 = scope_1586.start_list(true, Some("Ipv6Address"));
for item_1588 in var_1587 {
#[allow(unused_mut)]
let mut entry_1590 = list_1589.entry();
crate::query_ser::serialize_structure_crate_model_scheduled_instances_ipv6_address(
entry_1590, item_1588,
)?;
}
list_1589.finish();
}
#[allow(unused_mut)]
let mut scope_1591 = writer.prefix("NetworkInterfaceId");
if let Some(var_1592) = &input.network_interface_id {
scope_1591.string(var_1592);
}
#[allow(unused_mut)]
let mut scope_1593 = writer.prefix("PrivateIpAddress");
if let Some(var_1594) = &input.private_ip_address {
scope_1593.string(var_1594);
}
#[allow(unused_mut)]
let mut scope_1595 = writer.prefix("PrivateIpAddressConfig");
if let Some(var_1596) = &input.private_ip_address_configs {
let mut list_1598 = scope_1595.start_list(true, Some("PrivateIpAddressConfigSet"));
for item_1597 in var_1596 {
#[allow(unused_mut)]
let mut entry_1599 = list_1598.entry();
crate::query_ser::serialize_structure_crate_model_scheduled_instances_private_ip_address_config(entry_1599, item_1597)?;
}
list_1598.finish();
}
#[allow(unused_mut)]
let mut scope_1600 = writer.prefix("SecondaryPrivateIpAddressCount");
if let Some(var_1601) = &input.secondary_private_ip_address_count {
scope_1600.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1601).into()),
);
}
#[allow(unused_mut)]
let mut scope_1602 = writer.prefix("SubnetId");
if let Some(var_1603) = &input.subnet_id {
scope_1602.string(var_1603);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_scheduled_instances_placement(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::ScheduledInstancesPlacement,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1604 = writer.prefix("AvailabilityZone");
if let Some(var_1605) = &input.availability_zone {
scope_1604.string(var_1605);
}
#[allow(unused_mut)]
let mut scope_1606 = writer.prefix("GroupName");
if let Some(var_1607) = &input.group_name {
scope_1606.string(var_1607);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_fleet_spot_capacity_rebalance_request(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::FleetSpotCapacityRebalanceRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1608 = writer.prefix("ReplacementStrategy");
if let Some(var_1609) = &input.replacement_strategy {
scope_1608.string(var_1609.as_str());
}
#[allow(unused_mut)]
let mut scope_1610 = writer.prefix("TerminationDelay");
if let Some(var_1611) = &input.termination_delay {
scope_1610.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1611).into()),
);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_launch_template_ebs_block_device_request(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::LaunchTemplateEbsBlockDeviceRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1612 = writer.prefix("Encrypted");
if let Some(var_1613) = &input.encrypted {
scope_1612.boolean(*var_1613);
}
#[allow(unused_mut)]
let mut scope_1614 = writer.prefix("DeleteOnTermination");
if let Some(var_1615) = &input.delete_on_termination {
scope_1614.boolean(*var_1615);
}
#[allow(unused_mut)]
let mut scope_1616 = writer.prefix("Iops");
if let Some(var_1617) = &input.iops {
scope_1616.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1617).into()),
);
}
#[allow(unused_mut)]
let mut scope_1618 = writer.prefix("KmsKeyId");
if let Some(var_1619) = &input.kms_key_id {
scope_1618.string(var_1619);
}
#[allow(unused_mut)]
let mut scope_1620 = writer.prefix("SnapshotId");
if let Some(var_1621) = &input.snapshot_id {
scope_1620.string(var_1621);
}
#[allow(unused_mut)]
let mut scope_1622 = writer.prefix("VolumeSize");
if let Some(var_1623) = &input.volume_size {
scope_1622.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1623).into()),
);
}
#[allow(unused_mut)]
let mut scope_1624 = writer.prefix("VolumeType");
if let Some(var_1625) = &input.volume_type {
scope_1624.string(var_1625.as_str());
}
#[allow(unused_mut)]
let mut scope_1626 = writer.prefix("Throughput");
if let Some(var_1627) = &input.throughput {
scope_1626.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1627).into()),
);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_instance_ipv6_address_request(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::InstanceIpv6AddressRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1628 = writer.prefix("Ipv6Address");
if let Some(var_1629) = &input.ipv6_address {
scope_1628.string(var_1629);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_launch_template_spot_market_options_request(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::LaunchTemplateSpotMarketOptionsRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1630 = writer.prefix("MaxPrice");
if let Some(var_1631) = &input.max_price {
scope_1630.string(var_1631);
}
#[allow(unused_mut)]
let mut scope_1632 = writer.prefix("SpotInstanceType");
if let Some(var_1633) = &input.spot_instance_type {
scope_1632.string(var_1633.as_str());
}
#[allow(unused_mut)]
let mut scope_1634 = writer.prefix("BlockDurationMinutes");
if let Some(var_1635) = &input.block_duration_minutes {
scope_1634.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1635).into()),
);
}
#[allow(unused_mut)]
let mut scope_1636 = writer.prefix("ValidUntil");
if let Some(var_1637) = &input.valid_until {
scope_1636.date_time(var_1637, aws_smithy_types::date_time::Format::DateTime)?;
}
#[allow(unused_mut)]
let mut scope_1638 = writer.prefix("InstanceInterruptionBehavior");
if let Some(var_1639) = &input.instance_interruption_behavior {
scope_1638.string(var_1639.as_str());
}
Ok(())
}
20991 20992 20993 20994 20995 20996 20997 20998 20999 21000 21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 21013 21014 21015 21016 21017 21018 21019 21020 21021 21022 21023 21024 21025 21026 21027 21028 21029 21030 21031 21032 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081
pub fn serialize_operation_crate_operation_request_spot_instances(
input: &crate::input::RequestSpotInstancesInput,
) -> 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, "RequestSpotInstances", "2016-11-15");
#[allow(unused_mut)]
let mut scope_5915 = writer.prefix("AvailabilityZoneGroup");
if let Some(var_5916) = &input.availability_zone_group {
scope_5915.string(var_5916);
}
#[allow(unused_mut)]
let mut scope_5917 = writer.prefix("BlockDurationMinutes");
if let Some(var_5918) = &input.block_duration_minutes {
scope_5917.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_5918).into()),
);
}
#[allow(unused_mut)]
let mut scope_5919 = writer.prefix("ClientToken");
if let Some(var_5920) = &input.client_token {
scope_5919.string(var_5920);
}
#[allow(unused_mut)]
let mut scope_5921 = writer.prefix("DryRun");
if let Some(var_5922) = &input.dry_run {
scope_5921.boolean(*var_5922);
}
#[allow(unused_mut)]
let mut scope_5923 = writer.prefix("InstanceCount");
if let Some(var_5924) = &input.instance_count {
scope_5923.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_5924).into()),
);
}
#[allow(unused_mut)]
let mut scope_5925 = writer.prefix("LaunchGroup");
if let Some(var_5926) = &input.launch_group {
scope_5925.string(var_5926);
}
#[allow(unused_mut)]
let mut scope_5927 = writer.prefix("LaunchSpecification");
if let Some(var_5928) = &input.launch_specification {
crate::query_ser::serialize_structure_crate_model_request_spot_launch_specification(
scope_5927, var_5928,
)?;
}
#[allow(unused_mut)]
let mut scope_5929 = writer.prefix("SpotPrice");
if let Some(var_5930) = &input.spot_price {
scope_5929.string(var_5930);
}
#[allow(unused_mut)]
let mut scope_5931 = writer.prefix("Type");
if let Some(var_5932) = &input.r#type {
scope_5931.string(var_5932.as_str());
}
#[allow(unused_mut)]
let mut scope_5933 = writer.prefix("ValidFrom");
if let Some(var_5934) = &input.valid_from {
scope_5933.date_time(var_5934, aws_smithy_types::date_time::Format::DateTime)?;
}
#[allow(unused_mut)]
let mut scope_5935 = writer.prefix("ValidUntil");
if let Some(var_5936) = &input.valid_until {
scope_5935.date_time(var_5936, aws_smithy_types::date_time::Format::DateTime)?;
}
#[allow(unused_mut)]
let mut scope_5937 = writer.prefix("TagSpecification");
if let Some(var_5938) = &input.tag_specifications {
let mut list_5940 = scope_5937.start_list(true, Some("item"));
for item_5939 in var_5938 {
#[allow(unused_mut)]
let mut entry_5941 = list_5940.entry();
crate::query_ser::serialize_structure_crate_model_tag_specification(
entry_5941, item_5939,
)?;
}
list_5940.finish();
}
#[allow(unused_mut)]
let mut scope_5942 = writer.prefix("InstanceInterruptionBehavior");
if let Some(var_5943) = &input.instance_interruption_behavior {
scope_5942.string(var_5943.as_str());
}
writer.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
Trait Implementations§
source§impl AsRef<str> for SpotInstanceType
impl AsRef<str> for SpotInstanceType
source§impl Clone for SpotInstanceType
impl Clone for SpotInstanceType
source§fn clone(&self) -> SpotInstanceType
fn clone(&self) -> SpotInstanceType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SpotInstanceType
impl Debug for SpotInstanceType
source§impl From<&str> for SpotInstanceType
impl From<&str> for SpotInstanceType
source§impl FromStr for SpotInstanceType
impl FromStr for SpotInstanceType
source§impl Hash for SpotInstanceType
impl Hash for SpotInstanceType
source§impl Ord for SpotInstanceType
impl Ord for SpotInstanceType
source§fn cmp(&self, other: &SpotInstanceType) -> Ordering
fn cmp(&self, other: &SpotInstanceType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<SpotInstanceType> for SpotInstanceType
impl PartialEq<SpotInstanceType> for SpotInstanceType
source§fn eq(&self, other: &SpotInstanceType) -> bool
fn eq(&self, other: &SpotInstanceType) -> bool
source§impl PartialOrd<SpotInstanceType> for SpotInstanceType
impl PartialOrd<SpotInstanceType> for SpotInstanceType
source§fn partial_cmp(&self, other: &SpotInstanceType) -> Option<Ordering>
fn partial_cmp(&self, other: &SpotInstanceType) -> 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 SpotInstanceType
impl StructuralEq for SpotInstanceType
impl StructuralPartialEq for SpotInstanceType
Auto Trait Implementations§
impl RefUnwindSafe for SpotInstanceType
impl Send for SpotInstanceType
impl Sync for SpotInstanceType
impl Unpin for SpotInstanceType
impl UnwindSafe for SpotInstanceType
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.