aws-ec2: ec2.AmazonLinux2Kernel is not an enum in Python
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 71
Description
### Describe the bug
In Python, AmazonLinux2Kernel is not an enumeration (not an enum.Enum) in CDK -
```python
ec2.AmazonLinux2Kernel.KERNEL_5_10 == ec2.AmazonLinux2Kernel.KERNEL_5_10
False
```
vs
```python
ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023 == ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023
True
```
We can see that the class of this is not an enumeration, like other enumerations in the aws-ec2 code:
```python
class AmazonLinux2Kernel(
metaclass=jsii.JSIIMeta,
jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2Kernel",
):
'''Amazon Linux 2 kernel versions.
:exampleMetadata: infused
# ...
# vs
@jsii.enum(jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxGeneration")
class AmazonLinuxGeneration(enum.Enum):
'''What generation of Amazon Linux to use.
# ...
```
This inconsistency means it is difficult to compare certain objects in python.
### Expected Behavior
I expected an enumeration to be an enumeration - the comparison above should have passed.
### Current Behavior
The enumeration was not an enumeration, and the comparison above failed.
### Reproduction Steps
The code above should suffice.
### Possible Solution
Make these enumerations, enumerations.
### Additional Information/Context
_No response_
### CDK CLI Version
2.84.0
### Framework Version
_No response_
### Node.js Version
18.16.0
### OS
MacOS
### Language
Python
### Language Version
3.9.6
### Other information
_No response_
Contributor guide
Research direction
Start by locating the AmazonLinux2Kernel and AmazonLinuxGeneration definitions in aws-ec2 and comparing how their Python types are generated through jsii. Reproduce the equality check from the issue and trace the generated Python class; done means AmazonLinux2Kernel behaves as an enum and the comparison passes without regressing the existing AmazonLinuxGeneration behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100