Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

VPC endpoint state value parsing is incorrect #360

Closed
jmklix opened this issue Oct 3, 2022 · 3 comments
Closed

VPC endpoint state value parsing is incorrect #360

jmklix opened this issue Oct 3, 2022 · 3 comments
Assignees
Labels
bug Something isn't working ec2 service-api This issue pertains to the AWS API

Comments

@jmklix
Copy link
Member

jmklix commented Oct 3, 2022

Transfered from awslabs/aws-sdk-rust: awslabs/aws-sdk-rust#619

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_
@jmklix jmklix added service-api This issue pertains to the AWS API ec2 labels Oct 3, 2022
@jmklix jmklix self-assigned this Oct 3, 2022
@jmklix
Copy link
Member Author

jmklix commented Oct 3, 2022

awslabs/aws-sdk-rust#619 (comment)

It looks like this same issue is happening for the Go V2 SDK, and a similar problem is happening to SSM in the Rust SDK. There seems to be a pattern among these enums.

Internal tracking ID: P66381300

@jmklix
Copy link
Member Author

jmklix commented Oct 30, 2024

Re-opening original issue and closing this one

@jmklix jmklix closed this as completed Oct 30, 2024
Copy link

This issue is now closed.

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working ec2 service-api This issue pertains to the AWS API
Projects
None yet
Development

No branches or pull requests

1 participant