Enum aws_sdk_ec2::model::PermissionGroup
source · #[non_exhaustive]
pub enum PermissionGroup {
All,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against PermissionGroup
, 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 permissiongroup = unimplemented!();
match permissiongroup {
PermissionGroup::All => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when permissiongroup
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant PermissionGroup::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
PermissionGroup::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 PermissionGroup::NewFeature
is defined.
Specifically, when permissiongroup
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on PermissionGroup::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
All
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl PermissionGroup
impl PermissionGroup
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
5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182
pub fn serialize_structure_crate_model_load_permission_request(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::LoadPermissionRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1409 = writer.prefix("Group");
if let Some(var_1410) = &input.group {
scope_1409.string(var_1410.as_str());
}
#[allow(unused_mut)]
let mut scope_1411 = writer.prefix("UserId");
if let Some(var_1412) = &input.user_id {
scope_1411.string(var_1412);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_launch_permission(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::LaunchPermission,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1413 = writer.prefix("Group");
if let Some(var_1414) = &input.group {
scope_1413.string(var_1414.as_str());
}
#[allow(unused_mut)]
let mut scope_1415 = writer.prefix("UserId");
if let Some(var_1416) = &input.user_id {
scope_1415.string(var_1416);
}
#[allow(unused_mut)]
let mut scope_1417 = writer.prefix("OrganizationArn");
if let Some(var_1418) = &input.organization_arn {
scope_1417.string(var_1418);
}
#[allow(unused_mut)]
let mut scope_1419 = writer.prefix("OrganizationalUnitArn");
if let Some(var_1420) = &input.organizational_unit_arn {
scope_1419.string(var_1420);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_ebs_instance_block_device_specification(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::EbsInstanceBlockDeviceSpecification,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1421 = writer.prefix("DeleteOnTermination");
if let Some(var_1422) = &input.delete_on_termination {
scope_1421.boolean(*var_1422);
}
#[allow(unused_mut)]
let mut scope_1423 = writer.prefix("VolumeId");
if let Some(var_1424) = &input.volume_id {
scope_1423.string(var_1424);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_capacity_reservation_target(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::CapacityReservationTarget,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1425 = writer.prefix("CapacityReservationId");
if let Some(var_1426) = &input.capacity_reservation_id {
scope_1425.string(var_1426);
}
#[allow(unused_mut)]
let mut scope_1427 = writer.prefix("CapacityReservationResourceGroupArn");
if let Some(var_1428) = &input.capacity_reservation_resource_group_arn {
scope_1427.string(var_1428);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_security_group_rule_request(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::SecurityGroupRuleRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1429 = writer.prefix("IpProtocol");
if let Some(var_1430) = &input.ip_protocol {
scope_1429.string(var_1430);
}
#[allow(unused_mut)]
let mut scope_1431 = writer.prefix("FromPort");
if let Some(var_1432) = &input.from_port {
scope_1431.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1432).into()),
);
}
#[allow(unused_mut)]
let mut scope_1433 = writer.prefix("ToPort");
if let Some(var_1434) = &input.to_port {
scope_1433.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_1434).into()),
);
}
#[allow(unused_mut)]
let mut scope_1435 = writer.prefix("CidrIpv4");
if let Some(var_1436) = &input.cidr_ipv4 {
scope_1435.string(var_1436);
}
#[allow(unused_mut)]
let mut scope_1437 = writer.prefix("CidrIpv6");
if let Some(var_1438) = &input.cidr_ipv6 {
scope_1437.string(var_1438);
}
#[allow(unused_mut)]
let mut scope_1439 = writer.prefix("PrefixListId");
if let Some(var_1440) = &input.prefix_list_id {
scope_1439.string(var_1440);
}
#[allow(unused_mut)]
let mut scope_1441 = writer.prefix("ReferencedGroupId");
if let Some(var_1442) = &input.referenced_group_id {
scope_1441.string(var_1442);
}
#[allow(unused_mut)]
let mut scope_1443 = writer.prefix("Description");
if let Some(var_1444) = &input.description {
scope_1443.string(var_1444);
}
Ok(())
}
#[allow(unused_mut)]
pub fn serialize_structure_crate_model_create_volume_permission(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::CreateVolumePermission,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_1445 = writer.prefix("Group");
if let Some(var_1446) = &input.group {
scope_1445.string(var_1446.as_str());
}
#[allow(unused_mut)]
let mut scope_1447 = writer.prefix("UserId");
if let Some(var_1448) = &input.user_id {
scope_1447.string(var_1448);
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for PermissionGroup
impl AsRef<str> for PermissionGroup
source§impl Clone for PermissionGroup
impl Clone for PermissionGroup
source§fn clone(&self) -> PermissionGroup
fn clone(&self) -> PermissionGroup
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PermissionGroup
impl Debug for PermissionGroup
source§impl From<&str> for PermissionGroup
impl From<&str> for PermissionGroup
source§impl FromStr for PermissionGroup
impl FromStr for PermissionGroup
source§impl Hash for PermissionGroup
impl Hash for PermissionGroup
source§impl Ord for PermissionGroup
impl Ord for PermissionGroup
source§fn cmp(&self, other: &PermissionGroup) -> Ordering
fn cmp(&self, other: &PermissionGroup) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<PermissionGroup> for PermissionGroup
impl PartialEq<PermissionGroup> for PermissionGroup
source§fn eq(&self, other: &PermissionGroup) -> bool
fn eq(&self, other: &PermissionGroup) -> bool
source§impl PartialOrd<PermissionGroup> for PermissionGroup
impl PartialOrd<PermissionGroup> for PermissionGroup
source§fn partial_cmp(&self, other: &PermissionGroup) -> Option<Ordering>
fn partial_cmp(&self, other: &PermissionGroup) -> 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 PermissionGroup
impl StructuralEq for PermissionGroup
impl StructuralPartialEq for PermissionGroup
Auto Trait Implementations§
impl RefUnwindSafe for PermissionGroup
impl Send for PermissionGroup
impl Sync for PermissionGroup
impl Unpin for PermissionGroup
impl UnwindSafe for PermissionGroup
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.