Open
Description
Describe the bug
VPC endpoint state values when parsed from their text representation are incorrect. The reason is that code expect them to be in PascalCase
, while in fact they are camelCase
. As a result all the values are getting classified as State::Unknown("xxx")
.
For example
pendingAcceptance
is expected to be PendingAcceptance
available
is expected to be Available
etc
Expected Behavior
When running reproduction code below I expect the next output
Some(
PendingAcceptance,
),
Some(
Available
)
Current Behavior
Instead every possible VPC endpoint state in describe_vpc_endpoints()
is showed as State::Unknown("text")
Some(
Unknown(
"pendingAcceptance",
),
)
Some(
Unknown(
"available",
),
)
Reproduction Steps
If you have at least one VPC endpoint
use aws_sdk_ec2 as ec2;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let shared_config = aws_config::load_from_env().await;
ec2::Client::new(&shared_config)
.describe_vpc_endpoints()
.send()
.await?
.vpc_endpoints
.unwrap_or_default()
.into_iter()
.for_each(|ep| println!("{:#?}", ep.state()));
Ok(())
}
Possible Solution
diff --git a/sdk/ec2/src/model.rs b/sdk/ec2/src/model.rs
index 916c9ee62..30ba20e6a 100644
--- a/sdk/ec2/src/model.rs
+++ b/sdk/ec2/src/model.rs
@@ -68004,14 +68004,14 @@ pub enum State {
impl std::convert::From<&str> for State {
fn from(s: &str) -> Self {
match s {
- "Available" => State::Available,
- "Deleted" => State::Deleted,
- "Deleting" => State::Deleting,
- "Expired" => State::Expired,
- "Failed" => State::Failed,
- "Pending" => State::Pending,
- "PendingAcceptance" => State::PendingAcceptance,
- "Rejected" => State::Rejected,
+ "available" => State::Available,
+ "deleted" => State::Deleted,
+ "deleting" => State::Deleting,
+ "expired" => State::Expired,
+ "failed" => State::Failed,
+ "pending" => State::Pending,
+ "pendingAcceptance" => State::PendingAcceptance,
+ "rejected" => State::Rejected,
other => State::Unknown(other.to_owned()),
}
}
@@ -68027,28 +68027,28 @@ impl State {
/// Returns the `&str` value of the enum member.
pub fn as_str(&self) -> &str {
match self {
- State::Available => "Available",
- State::Deleted => "Deleted",
- State::Deleting => "Deleting",
- State::Expired => "Expired",
- State::Failed => "Failed",
- State::Pending => "Pending",
- State::PendingAcceptance => "PendingAcceptance",
- State::Rejected => "Rejected",
+ State::Available => "available",
+ State::Deleted => "deleted",
+ State::Deleting => "deleting",
+ State::Expired => "expired",
+ State::Failed => "failed",
+ State::Pending => "pending",
+ State::PendingAcceptance => "pendingAcceptance",
+ State::Rejected => "rejected",
State::Unknown(s) => s.as_ref(),
}
}
/// Returns all the `&str` values of the enum members.
pub fn values() -> &'static [&'static str] {
&[
- "Available",
- "Deleted",
- "Deleting",
- "Expired",
- "Failed",
- "Pending",
- "PendingAcceptance",
- "Rejected",
+ "available",
+ "deleted",
+ "deleting",
+ "expired",
+ "failed",
+ "pending",
+ "pendingAcceptance",
+ "rejected",
]
}
}
Additional Information/Context
No response
Version
├── aws-config v0.48.0
│ ├── aws-http v0.48.0
│ │ ├── aws-smithy-http v0.48.0
│ │ │ ├── aws-smithy-types v0.48.0
│ │ ├── aws-smithy-types v0.48.0 (*)
│ │ ├── aws-types v0.48.0
│ │ │ ├── aws-smithy-async v0.48.0
│ │ │ ├── aws-smithy-client v0.48.0
│ │ │ │ ├── aws-smithy-async v0.48.0 (*)
│ │ │ │ ├── aws-smithy-http v0.48.0 (*)
│ │ │ │ ├── aws-smithy-http-tower v0.48.0
│ │ │ │ │ ├── aws-smithy-http v0.48.0 (*)
│ │ │ │ ├── aws-smithy-types v0.48.0 (*)
│ │ │ ├── aws-smithy-http v0.48.0 (*)
│ │ │ ├── aws-smithy-types v0.48.0 (*)
│ ├── aws-sdk-sso v0.18.0
│ │ ├── aws-endpoint v0.48.0
│ │ │ ├── aws-smithy-http v0.48.0 (*)
│ │ │ ├── aws-smithy-types v0.48.0 (*)
│ │ │ ├── aws-types v0.48.0 (*)
│ │ ├── aws-http v0.48.0 (*)
│ │ ├── aws-sig-auth v0.48.0
│ │ │ ├── aws-sigv4 v0.48.0
│ │ │ │ ├── aws-smithy-http v0.48.0 (*)
│ │ │ ├── aws-smithy-http v0.48.0 (*)
│ │ │ ├── aws-types v0.48.0 (*)
│ │ ├── aws-smithy-async v0.48.0 (*)
│ │ ├── aws-smithy-client v0.48.0 (*)
│ │ ├── aws-smithy-http v0.48.0 (*)
│ │ ├── aws-smithy-http-tower v0.48.0 (*)
│ │ ├── aws-smithy-json v0.48.0
│ │ │ └── aws-smithy-types v0.48.0 (*)
│ │ ├── aws-smithy-types v0.48.0 (*)
│ │ ├── aws-types v0.48.0 (*)
│ ├── aws-sdk-sts v0.18.0
│ │ ├── aws-endpoint v0.48.0 (*)
│ │ ├── aws-http v0.48.0 (*)
│ │ ├── aws-sig-auth v0.48.0 (*)
│ │ ├── aws-smithy-async v0.48.0 (*)
│ │ ├── aws-smithy-client v0.48.0 (*)
│ │ ├── aws-smithy-http v0.48.0 (*)
│ │ ├── aws-smithy-http-tower v0.48.0 (*)
│ │ ├── aws-smithy-query v0.48.0
│ │ │ ├── aws-smithy-types v0.48.0 (*)
│ │ ├── aws-smithy-types v0.48.0 (*)
│ │ ├── aws-smithy-xml v0.48.0
│ │ ├── aws-types v0.48.0 (*)
│ ├── aws-smithy-async v0.48.0 (*)
│ ├── aws-smithy-client v0.48.0 (*)
│ ├── aws-smithy-http v0.48.0 (*)
│ ├── aws-smithy-http-tower v0.48.0 (*)
│ ├── aws-smithy-json v0.48.0 (*)
│ ├── aws-smithy-types v0.48.0 (*)
│ ├── aws-types v0.48.0 (*)
├── aws-sdk-ec2 v0.18.0
│ ├── aws-endpoint v0.48.0 (*)
│ ├── aws-http v0.48.0 (*)
│ ├── aws-sig-auth v0.48.0 (*)
│ ├── aws-smithy-async v0.48.0 (*)
│ ├── aws-smithy-client v0.48.0 (*)
│ ├── aws-smithy-http v0.48.0 (*)
│ ├── aws-smithy-http-tower v0.48.0 (*)
│ ├── aws-smithy-query v0.48.0 (*)
│ ├── aws-smithy-types v0.48.0 (*)
│ ├── aws-smithy-xml v0.48.0 (*)
│ ├── aws-types v0.48.0 (*)
├── aws-types v0.48.0 (*)
### Environment details (OS name and version, etc.)
macOS Monterey
### Logs
_No response_