public MockSecurityGroup authorizeSecurityGroupIngress ( final String groupId , final String ipProtocol , final Integer fromPort , final Integer toPort , final String cidrIp ) { if ( groupId == null ) { return null ; } MockSecurityGroup ret = allMockSecurityGroup . get ( groupId ) ; if ( ret != null ) { MockIpPermissionType mockIpPermissionType = new MockIpPermissionType ( ) ; mockIpPermissionType . setIpProtocol ( ipProtocol ) ; mockIpPermissionType . setFromPort ( fromPort ) ; mockIpPermissionType . setToPort ( toPort ) ; List < String > ipRanges = new ArrayList < String > ( ) ; ipRanges . add ( cidrIp ) ; mockIpPermissionType . setIpRanges ( ipRanges ) ; List < MockIpPermissionType > mockIpPermissionTypes = ret . getIpPermissions ( ) ; mockIpPermissionTypes . add ( mockIpPermissionType ) ; ret . setIpPermissions ( mockIpPermissionTypes ) ; allMockSecurityGroup . put ( ret . getGroupId ( ) , ret ) ; } return ret ; }
Authorize the mock SecurityGroup to Ingress IpProtocol .