Enum aws_sdk_appstream::model::FleetAttribute
source · #[non_exhaustive]
pub enum FleetAttribute {
DomainJoinInfo,
IamRoleArn,
SessionScriptS3Location,
UsbDeviceFilterStrings,
VpcConfiguration,
VpcConfigurationSecurityGroupIds,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against FleetAttribute
, 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 fleetattribute = unimplemented!();
match fleetattribute {
FleetAttribute::DomainJoinInfo => { /* ... */ },
FleetAttribute::IamRoleArn => { /* ... */ },
FleetAttribute::SessionScriptS3Location => { /* ... */ },
FleetAttribute::UsbDeviceFilterStrings => { /* ... */ },
FleetAttribute::VpcConfiguration => { /* ... */ },
FleetAttribute::VpcConfigurationSecurityGroupIds => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when fleetattribute
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant FleetAttribute::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
FleetAttribute::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 FleetAttribute::NewFeature
is defined.
Specifically, when fleetattribute
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on FleetAttribute::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.
The fleet attribute.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DomainJoinInfo
IamRoleArn
SessionScriptS3Location
UsbDeviceFilterStrings
VpcConfiguration
VpcConfigurationSecurityGroupIds
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl FleetAttribute
impl FleetAttribute
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
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537
pub fn serialize_structure_crate_input_update_fleet_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateFleetInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_305) = &input.image_name {
object.key("ImageName").string(var_305.as_str());
}
if let Some(var_306) = &input.image_arn {
object.key("ImageArn").string(var_306.as_str());
}
if let Some(var_307) = &input.name {
object.key("Name").string(var_307.as_str());
}
if let Some(var_308) = &input.instance_type {
object.key("InstanceType").string(var_308.as_str());
}
if let Some(var_309) = &input.compute_capacity {
#[allow(unused_mut)]
let mut object_310 = object.key("ComputeCapacity").start_object();
crate::json_ser::serialize_structure_crate_model_compute_capacity(
&mut object_310,
var_309,
)?;
object_310.finish();
}
if let Some(var_311) = &input.vpc_config {
#[allow(unused_mut)]
let mut object_312 = object.key("VpcConfig").start_object();
crate::json_ser::serialize_structure_crate_model_vpc_config(&mut object_312, var_311)?;
object_312.finish();
}
if let Some(var_313) = &input.max_user_duration_in_seconds {
object.key("MaxUserDurationInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_313).into()),
);
}
if let Some(var_314) = &input.disconnect_timeout_in_seconds {
object.key("DisconnectTimeoutInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_314).into()),
);
}
if input.delete_vpc_config {
object
.key("DeleteVpcConfig")
.boolean(input.delete_vpc_config);
}
if let Some(var_315) = &input.description {
object.key("Description").string(var_315.as_str());
}
if let Some(var_316) = &input.display_name {
object.key("DisplayName").string(var_316.as_str());
}
if let Some(var_317) = &input.enable_default_internet_access {
object.key("EnableDefaultInternetAccess").boolean(*var_317);
}
if let Some(var_318) = &input.domain_join_info {
#[allow(unused_mut)]
let mut object_319 = object.key("DomainJoinInfo").start_object();
crate::json_ser::serialize_structure_crate_model_domain_join_info(
&mut object_319,
var_318,
)?;
object_319.finish();
}
if let Some(var_320) = &input.idle_disconnect_timeout_in_seconds {
object.key("IdleDisconnectTimeoutInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_320).into()),
);
}
if let Some(var_321) = &input.attributes_to_delete {
let mut array_322 = object.key("AttributesToDelete").start_array();
for item_323 in var_321 {
{
array_322.value().string(item_323.as_str());
}
}
array_322.finish();
}
if let Some(var_324) = &input.iam_role_arn {
object.key("IamRoleArn").string(var_324.as_str());
}
if let Some(var_325) = &input.stream_view {
object.key("StreamView").string(var_325.as_str());
}
if let Some(var_326) = &input.platform {
object.key("Platform").string(var_326.as_str());
}
if let Some(var_327) = &input.max_concurrent_sessions {
object.key("MaxConcurrentSessions").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_327).into()),
);
}
if let Some(var_328) = &input.usb_device_filter_strings {
let mut array_329 = object.key("UsbDeviceFilterStrings").start_array();
for item_330 in var_328 {
{
array_329.value().string(item_330.as_str());
}
}
array_329.finish();
}
if let Some(var_331) = &input.session_script_s3_location {
#[allow(unused_mut)]
let mut object_332 = object.key("SessionScriptS3Location").start_object();
crate::json_ser::serialize_structure_crate_model_s3_location(&mut object_332, var_331)?;
object_332.finish();
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for FleetAttribute
impl AsRef<str> for FleetAttribute
source§impl Clone for FleetAttribute
impl Clone for FleetAttribute
source§fn clone(&self) -> FleetAttribute
fn clone(&self) -> FleetAttribute
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FleetAttribute
impl Debug for FleetAttribute
source§impl From<&str> for FleetAttribute
impl From<&str> for FleetAttribute
source§impl FromStr for FleetAttribute
impl FromStr for FleetAttribute
source§impl Hash for FleetAttribute
impl Hash for FleetAttribute
source§impl Ord for FleetAttribute
impl Ord for FleetAttribute
source§fn cmp(&self, other: &FleetAttribute) -> Ordering
fn cmp(&self, other: &FleetAttribute) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<FleetAttribute> for FleetAttribute
impl PartialEq<FleetAttribute> for FleetAttribute
source§fn eq(&self, other: &FleetAttribute) -> bool
fn eq(&self, other: &FleetAttribute) -> bool
source§impl PartialOrd<FleetAttribute> for FleetAttribute
impl PartialOrd<FleetAttribute> for FleetAttribute
source§fn partial_cmp(&self, other: &FleetAttribute) -> Option<Ordering>
fn partial_cmp(&self, other: &FleetAttribute) -> 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 FleetAttribute
impl StructuralEq for FleetAttribute
impl StructuralPartialEq for FleetAttribute
Auto Trait Implementations§
impl RefUnwindSafe for FleetAttribute
impl Send for FleetAttribute
impl Sync for FleetAttribute
impl Unpin for FleetAttribute
impl UnwindSafe for FleetAttribute
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.