#[non_exhaustive]
pub enum CapacityReservationInstancePlatform {
Show 18 variants
LinuxWithSqlServerEnterprise,
LinuxWithSqlServerStandard,
LinuxWithSqlServerWeb,
LinuxUnix,
RhelWithHa,
RhelWithHaAndSqlServerEnterprise,
RhelWithHaAndSqlServerStandard,
RhelWithSqlServerEnterprise,
RhelWithSqlServerStandard,
RhelWithSqlServerWeb,
RedHatEnterpriseLinux,
SuseLinux,
Windows,
WindowsWithSqlServer,
WindowsWithSqlServerEnterprise,
WindowsWithSqlServerStandard,
WindowsWithSqlServerWeb,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against CapacityReservationInstancePlatform
, 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 capacityreservationinstanceplatform = unimplemented!();
match capacityreservationinstanceplatform {
CapacityReservationInstancePlatform::LinuxWithSqlServerEnterprise => { /* ... */ },
CapacityReservationInstancePlatform::LinuxWithSqlServerStandard => { /* ... */ },
CapacityReservationInstancePlatform::LinuxWithSqlServerWeb => { /* ... */ },
CapacityReservationInstancePlatform::LinuxUnix => { /* ... */ },
CapacityReservationInstancePlatform::RhelWithHa => { /* ... */ },
CapacityReservationInstancePlatform::RhelWithHaAndSqlServerEnterprise => { /* ... */ },
CapacityReservationInstancePlatform::RhelWithHaAndSqlServerStandard => { /* ... */ },
CapacityReservationInstancePlatform::RhelWithSqlServerEnterprise => { /* ... */ },
CapacityReservationInstancePlatform::RhelWithSqlServerStandard => { /* ... */ },
CapacityReservationInstancePlatform::RhelWithSqlServerWeb => { /* ... */ },
CapacityReservationInstancePlatform::RedHatEnterpriseLinux => { /* ... */ },
CapacityReservationInstancePlatform::SuseLinux => { /* ... */ },
CapacityReservationInstancePlatform::Windows => { /* ... */ },
CapacityReservationInstancePlatform::WindowsWithSqlServer => { /* ... */ },
CapacityReservationInstancePlatform::WindowsWithSqlServerEnterprise => { /* ... */ },
CapacityReservationInstancePlatform::WindowsWithSqlServerStandard => { /* ... */ },
CapacityReservationInstancePlatform::WindowsWithSqlServerWeb => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when capacityreservationinstanceplatform
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant CapacityReservationInstancePlatform::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
CapacityReservationInstancePlatform::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 CapacityReservationInstancePlatform::NewFeature
is defined.
Specifically, when capacityreservationinstanceplatform
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on CapacityReservationInstancePlatform::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
LinuxWithSqlServerEnterprise
LinuxWithSqlServerStandard
LinuxWithSqlServerWeb
LinuxUnix
RhelWithHa
RhelWithHaAndSqlServerEnterprise
RhelWithHaAndSqlServerStandard
RhelWithSqlServerEnterprise
RhelWithSqlServerStandard
RhelWithSqlServerWeb
RedHatEnterpriseLinux
SuseLinux
Windows
WindowsWithSqlServer
WindowsWithSqlServerEnterprise
WindowsWithSqlServerStandard
WindowsWithSqlServerWeb
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl CapacityReservationInstancePlatform
impl CapacityReservationInstancePlatform
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
195 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
pub fn serialize_structure_crate_model_reservation_fleet_instance_specification(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::ReservationFleetInstanceSpecification,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_59 = writer.prefix("InstanceType");
if let Some(var_60) = &input.instance_type {
scope_59.string(var_60.as_str());
}
#[allow(unused_mut)]
let mut scope_61 = writer.prefix("InstancePlatform");
if let Some(var_62) = &input.instance_platform {
scope_61.string(var_62.as_str());
}
#[allow(unused_mut)]
let mut scope_63 = writer.prefix("Weight");
if let Some(var_64) = &input.weight {
scope_63.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::Float((*var_64).into()),
);
}
#[allow(unused_mut)]
let mut scope_65 = writer.prefix("AvailabilityZone");
if let Some(var_66) = &input.availability_zone {
scope_65.string(var_66);
}
#[allow(unused_mut)]
let mut scope_67 = writer.prefix("AvailabilityZoneId");
if let Some(var_68) = &input.availability_zone_id {
scope_67.string(var_68);
}
#[allow(unused_mut)]
let mut scope_69 = writer.prefix("EbsOptimized");
if let Some(var_70) = &input.ebs_optimized {
scope_69.boolean(*var_70);
}
#[allow(unused_mut)]
let mut scope_71 = writer.prefix("Priority");
if let Some(var_72) = &input.priority {
scope_71.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_72).into()),
);
}
Ok(())
}
1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884
pub fn serialize_operation_crate_operation_create_capacity_reservation(
input: &crate::input::CreateCapacityReservationInput,
) -> 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, "CreateCapacityReservation", "2016-11-15");
#[allow(unused_mut)]
let mut scope_483 = writer.prefix("ClientToken");
if let Some(var_484) = &input.client_token {
scope_483.string(var_484);
}
#[allow(unused_mut)]
let mut scope_485 = writer.prefix("InstanceType");
if let Some(var_486) = &input.instance_type {
scope_485.string(var_486);
}
#[allow(unused_mut)]
let mut scope_487 = writer.prefix("InstancePlatform");
if let Some(var_488) = &input.instance_platform {
scope_487.string(var_488.as_str());
}
#[allow(unused_mut)]
let mut scope_489 = writer.prefix("AvailabilityZone");
if let Some(var_490) = &input.availability_zone {
scope_489.string(var_490);
}
#[allow(unused_mut)]
let mut scope_491 = writer.prefix("AvailabilityZoneId");
if let Some(var_492) = &input.availability_zone_id {
scope_491.string(var_492);
}
#[allow(unused_mut)]
let mut scope_493 = writer.prefix("Tenancy");
if let Some(var_494) = &input.tenancy {
scope_493.string(var_494.as_str());
}
#[allow(unused_mut)]
let mut scope_495 = writer.prefix("InstanceCount");
if let Some(var_496) = &input.instance_count {
scope_495.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_496).into()),
);
}
#[allow(unused_mut)]
let mut scope_497 = writer.prefix("EbsOptimized");
if let Some(var_498) = &input.ebs_optimized {
scope_497.boolean(*var_498);
}
#[allow(unused_mut)]
let mut scope_499 = writer.prefix("EphemeralStorage");
if let Some(var_500) = &input.ephemeral_storage {
scope_499.boolean(*var_500);
}
#[allow(unused_mut)]
let mut scope_501 = writer.prefix("EndDate");
if let Some(var_502) = &input.end_date {
scope_501.date_time(var_502, aws_smithy_types::date_time::Format::DateTime)?;
}
#[allow(unused_mut)]
let mut scope_503 = writer.prefix("EndDateType");
if let Some(var_504) = &input.end_date_type {
scope_503.string(var_504.as_str());
}
#[allow(unused_mut)]
let mut scope_505 = writer.prefix("InstanceMatchCriteria");
if let Some(var_506) = &input.instance_match_criteria {
scope_505.string(var_506.as_str());
}
#[allow(unused_mut)]
let mut scope_507 = writer.prefix("TagSpecifications");
if let Some(var_508) = &input.tag_specifications {
let mut list_510 = scope_507.start_list(true, Some("item"));
for item_509 in var_508 {
#[allow(unused_mut)]
let mut entry_511 = list_510.entry();
crate::query_ser::serialize_structure_crate_model_tag_specification(
entry_511, item_509,
)?;
}
list_510.finish();
}
#[allow(unused_mut)]
let mut scope_512 = writer.prefix("DryRun");
if let Some(var_513) = &input.dry_run {
scope_512.boolean(*var_513);
}
#[allow(unused_mut)]
let mut scope_514 = writer.prefix("OutpostArn");
if let Some(var_515) = &input.outpost_arn {
scope_514.string(var_515);
}
#[allow(unused_mut)]
let mut scope_516 = writer.prefix("PlacementGroupArn");
if let Some(var_517) = &input.placement_group_arn {
scope_516.string(var_517);
}
writer.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
Trait Implementations§
source§impl Clone for CapacityReservationInstancePlatform
impl Clone for CapacityReservationInstancePlatform
source§fn clone(&self) -> CapacityReservationInstancePlatform
fn clone(&self) -> CapacityReservationInstancePlatform
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl From<&str> for CapacityReservationInstancePlatform
impl From<&str> for CapacityReservationInstancePlatform
source§impl Ord for CapacityReservationInstancePlatform
impl Ord for CapacityReservationInstancePlatform
source§fn cmp(&self, other: &CapacityReservationInstancePlatform) -> Ordering
fn cmp(&self, other: &CapacityReservationInstancePlatform) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<CapacityReservationInstancePlatform> for CapacityReservationInstancePlatform
impl PartialEq<CapacityReservationInstancePlatform> for CapacityReservationInstancePlatform
source§fn eq(&self, other: &CapacityReservationInstancePlatform) -> bool
fn eq(&self, other: &CapacityReservationInstancePlatform) -> bool
source§impl PartialOrd<CapacityReservationInstancePlatform> for CapacityReservationInstancePlatform
impl PartialOrd<CapacityReservationInstancePlatform> for CapacityReservationInstancePlatform
source§fn partial_cmp(
&self,
other: &CapacityReservationInstancePlatform
) -> Option<Ordering>
fn partial_cmp(
&self,
other: &CapacityReservationInstancePlatform
) -> 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 CapacityReservationInstancePlatform
impl StructuralEq for CapacityReservationInstancePlatform
impl StructuralPartialEq for CapacityReservationInstancePlatform
Auto Trait Implementations§
impl RefUnwindSafe for CapacityReservationInstancePlatform
impl Send for CapacityReservationInstancePlatform
impl Sync for CapacityReservationInstancePlatform
impl Unpin for CapacityReservationInstancePlatform
impl UnwindSafe for CapacityReservationInstancePlatform
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.