sameSecurityGroupAndSubnet()

in source/backend/discovery/src/discovery/eni-links.js [53:119]


    sameSecurityGroupAndSubnet(config, accountId, awsRegion, type) {
        const subnet = config.subnetId;
       
        const both = config.groups.map(element => {
            return {
                both: {
                    parameter: "linked",
                    subFunction: [
                        {
                            has: [
                                {
                                    resourceId: element.groupId
                                }
                            ]
                        }
                    ]
                }
            }
        });

        both.push({
            both: {
                parameter: "linked",
                subFunction: [
                    {
                        has: [
                            {
                                subnetId: subnet
                            }
                        ]
                    }
                ]
            }
        })

        return {
            command: "runGremlin",
            data: [
                {
                    has: [
                        {
                            accountId: accountId
                        },
                        {
                            awsRegion: awsRegion
                        },
                        {
                            resourceType: type
                        }
                    ]
                },
                {
                    as: {
                        parameter: "a"
                    }
                },
                {
                    and: both
                },
                {
                    select: {
                        parameter: "a"
                    }
                }
            ]
        };
    }