Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cdk dia decorator on python project #32

Open
robertofd1995 opened this issue Nov 14, 2022 · 1 comment
Open

Use cdk dia decorator on python project #32

robertofd1995 opened this issue Nov 14, 2022 · 1 comment

Comments

@robertofd1995
Copy link

First of all thanks for your time on this project, it's awesome.

I would like to be able to uncollapse in the diagram the nestedStacks that I have, I would like to understand why this feature is not available on other languages rather than js/ts.

My project is on python, and even thought the laguage doesn't have the concept of interface, with jsii it can be used in the following way

from constructs import Construct
import jsii
from aws_cdk import (
    NestedStack,
    aws_ec2 as ec2,
    aws_iam as iam,
    IInspectable
)

@jsii.implements(IInspectable)
class NetworkStack(NestedStack):

    @jsii.member(jsii_name="inspect")
    def inspect(self, inspector: "TreeInspector") -> None:
        """
        :param inspector:
        :return:
        """
        # add here the logic of cdkDiaDecorator
       pass

I am unfamiliar with how to compile ts to other languages, but why is not possible to export also the logic of that decorator to other languages?

Kind regards

@pistazie
Copy link
Owner

Hi Reberto,

I guess it's not available because I didn't know how to do it :) but maybe you can help figure this out.

The basic thing here is that for customizing specific constructs CDK-Dia needs the data on the construct tree as attributes.CDK-DIA_CollapssingCustomizer:"FORCE_NON_COLLAPSE" (see example construct tree).

So if you can get CDK to add that attribute to the tree on synth-time your CDK-Dia will pick that up.

I guess you need then to adapt the code here to Python and replace it in the de inspect method above.

It would be even better if one could use jsii to use the already provided decorator so the Python way to customize will be the same as the TS way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants