Skip to content

Interface IPsetProperty is unusable in Python #2929

@skinny85

Description

@skinny85

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)
  • Go

General Information

  • JSII Version: 1.31.0
  • Platform: Darwin 186590cdb71d.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Mon Mar 8 22:11:48 PST 2021; root:xnu-4903.278.65~1/RELEASE_X86_64 x86_64

What is the problem?

The following interface:

export namespace CfnRuleGroup {
    /**
     * @stability external
     * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-networkfirewall-rulegroup-ipset.html
     */
    export interface IPSetProperty {
        /**
         * `CfnRuleGroup.IPSetProperty.Definition`
         * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-networkfirewall-rulegroup-ipset.html#cfn-networkfirewall-rulegroup-ipset-definition
         */
        readonly definition?: string[];
    }
}

gets translated into the following Python:

    @jsii.interface(
        jsii_type="@aws-cdk/aws-networkfirewall.CfnRuleGroup.IPSetProperty"
    )
    class IPSetProperty(typing_extensions.Protocol):
        '''
        :link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-networkfirewall-rulegroup-ipset.html
        '''

        @builtins.staticmethod
        def __jsii_proxy_class__() -> typing.Type["_IPSetPropertyProxy"]:
            return _IPSetPropertyProxy

        @builtins.property # type: ignore[misc]
        @jsii.member(jsii_name="definition")
        def definition(self) -> typing.Optional[typing.List[builtins.str]]:
            '''``CfnRuleGroup.IPSetProperty.Definition``.

            :link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-networkfirewall-rulegroup-ipset.html#cfn-networkfirewall-rulegroup-ipset-definition
            '''
            ...

which makes it unusable for CDK Python users.

Verbose Log

$ npx cdk synth 
Traceback (most recent call last):
  File "app.py", line 79, in <module>
    MyStack(app, "hello-cdk-1", env={'region': 'us-west-2', 'account': '828671620168'})
  File "/Users/adamruka/workplace/cdk/python-cdk/test-python-app/.env/lib/python3.7/site-packages/jsii/_runtime.py", line 83, in __call__
    inst = super().__call__(*args, **kwargs)
  File "app.py", line 68, in __init__
    "192.168.0.0/24"
  File "/Users/adamruka/workplace/cdk/python-cdk/test-python-app/.env/lib/python3.7/site-packages/typing_extensions.py", line 1406, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
Subprocess exited with error 1

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.language/pythonRelated to Python bindingsneeds-triageThis issue or PR still needs to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions