以下代码在代码“cfnsecuritygroupingres sgi=(cfnsecuritygroupingres)obj”行生成“software.amazon.jsii.jsiobject cannot be cast to software.amazon.awscdk.services.ec2.cfnsecuritygroupingres”错误
CfnSecurityGroup cfnSecurityGroup = (CfnSecurityGroup) resource_SecurityGroup.getCfnresource();
if (cfnSecurityGroup.getSecurityGroupIngress() != null) {
List<CfnSecurityGroupIngress> cfnSecurityGroupIngress = (List<CfnSecurityGroupIngress>) cfnSecurityGroup.getSecurityGroupIngress();
ListIterator<CfnSecurityGroupIngress> it = cfnSecurityGroupIngress.listIterator();
while (it.hasNext()) {
Object obj = it.next();
LOG.debug("obj: " + obj.toString());
CfnSecurityGroupIngress sgi = (CfnSecurityGroupIngress)obj;
LOG.debug("getFromPort" + sgi.getFromPort());
}
如何访问securitygroupingress属性?
注意,我已经确定cfnsecuritygroup.ingresproperty是cfnsecuritygroupingres.lisiterator()中存在的接口类型。不过,我不知道该怎么办。
Maven
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>cdk-cloudformation-include</artifactId>
<version>1.79.0</version>
</dependency>
敬孔戴
1条答案
按热度按时间bbuxkriu1#
我注意到访问参数的一种方法是
返回json字符串