Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/dev-sjones-euca-10300' into main…
Browse files Browse the repository at this point in the history
…t-4.1
  • Loading branch information
sjones4 committed Feb 3, 2015
2 parents 26dd80b + 8d156e9 commit 0d36c82
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -518,14 +518,18 @@ public NetworkInterface get( ) {
try {
final Subnet subnet = subnets.lookupByName( accountFullName, subnetId, Functions.<Subnet>identity() );
final Vpc vpc = subnet.getVpc( );
final Set<NetworkGroup> groups = request.getGroupSet( )==null ?
final Set<NetworkGroup> groups = request.getGroupSet( )==null || request.getGroupSet( ).groupIds( ).isEmpty( ) ?
Sets.newHashSet( securityGroups.lookupDefault( vpc.getDisplayName( ), Functions.<NetworkGroup>identity( ) ) ) :
Sets.newHashSet( Iterables.transform(
request.getGroupSet( ).groupIds( ),
RestrictedTypes.resolver( NetworkGroup.class ) ) );
if ( groups.size( ) > VpcConfiguration.getSecurityGroupsPerNetworkInterface( ) ) {
throw new ClientComputeException( "SecurityGroupsPerInterfaceLimitExceeded", "Security group limit exceeded" );
}
if ( !Collections.singleton( vpc.getDisplayName( ) ).equals(
Sets.newHashSet( Iterables.transform( groups, NetworkGroups.vpcId( ) ) ) ) ) {
throw Exceptions.toUndeclared( new ClientComputeException( "InvalidParameterValue", "Invalid security groups (inconsistent VPC)" ) );
}
final String identifier = Identifier.eni.generate();
if ( privateIp != null ) {
final Cidr cidr = Cidr.parse( subnet.getCidr( ) );
Expand Down

0 comments on commit 0d36c82

Please sign in to comment.