com.amazonaws.services.ec2.model.UserIdGroupPair Java Examples
The following examples show how to use
com.amazonaws.services.ec2.model.UserIdGroupPair.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityGroupsTableProviderTest.java From aws-athena-query-federation with Apache License 2.0 | 6 votes |
private SecurityGroup makeSecurityGroup(String id) { return new SecurityGroup() .withGroupId(id) .withGroupName("name") .withDescription("description") .withIpPermissions(new IpPermission() .withIpProtocol("protocol") .withFromPort(100) .withToPort(100) .withIpv4Ranges(new IpRange().withCidrIp("cidr").withDescription("description")) .withIpv6Ranges(new Ipv6Range().withCidrIpv6("cidr").withDescription("description")) .withPrefixListIds(new PrefixListId().withPrefixListId("prefix").withDescription("description")) .withUserIdGroupPairs(new UserIdGroupPair().withGroupId("group_id").withUserId("user_id")) ); }
Example #2
Source File: CommonTestUtils.java From pacbot with Apache License 2.0 | 6 votes |
public static SecurityGroup getSecurityGroup(String groupId){ UserIdGroupPair groupPair = new UserIdGroupPair(); groupPair.setGroupId("123"); List<UserIdGroupPair> userIdGroupPairs = new ArrayList<UserIdGroupPair>(); userIdGroupPairs.add(groupPair); IpPermission ipPermission = new IpPermission(); ipPermission.setFromPort(80); ipPermission.setUserIdGroupPairs(userIdGroupPairs); List<IpPermission> ipPermissions = new ArrayList<IpPermission>(); ipPermissions.add(ipPermission); SecurityGroup securityGroup = new SecurityGroup(); securityGroup.setGroupId(groupId); securityGroup.setIpPermissions(ipPermissions); return securityGroup; }
Example #3
Source File: SecurityGroupsCheckerImplTest.java From fullstop with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Before public void setUp() throws Exception { final ClientProvider mockClientProvider = mock(ClientProvider.class); final AmazonEC2Client mockEC2 = mock(AmazonEC2Client.class); mockPredicate = (Predicate<IpPermission>) mock(Predicate.class); when(mockClientProvider.getClient(any(), any(), any())).thenReturn(mockEC2); securityGroupsChecker = new SecurityGroupsCheckerImpl(mockClientProvider, mockPredicate); final DescribeSecurityGroupsResult securityGroups = new DescribeSecurityGroupsResult() .withSecurityGroups(new SecurityGroup() .withGroupId("sg-12345678") .withGroupName("my-sec-group") .withIpPermissions(new IpPermission() .withIpProtocol("tcp") .withIpv4Ranges(new IpRange().withCidrIp("0.0.0.0/0")) .withFromPort(0) .withToPort(65535) .withIpv6Ranges(new Ipv6Range().withCidrIpv6("::/0")) .withUserIdGroupPairs(new UserIdGroupPair() .withUserId("111222333444") .withGroupId("sg-11223344")))); when(mockEC2.describeSecurityGroups(any())).thenReturn(securityGroups); }
Example #4
Source File: PredicatesTest.java From fullstop with Apache License 2.0 | 5 votes |
@Test public void testAllTrafficFromSecurityGroups() throws Exception { assertThat(pred).rejects( new IpPermission() .withIpProtocol("-1") .withUserIdGroupPairs( new UserIdGroupPair().withUserId("111222333444").withGroupId("sg-11223344"))); }
Example #5
Source File: UserIdGroupPairConverter.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
@Override protected UserIdGroupPair convertObject(String[] from) { UserIdGroupPair to = new UserIdGroupPair(); to.setUserId(from[0]); to.setGroupName(from[1]); return to; }