List of usage examples for com.amazonaws.services.ec2.model UserIdGroupPair setUserId
public void setUserId(String userId)
The ID of an AWS account.
From source file:com.norbl.cbp.ppe.SecurityGroupFactory.java
License:Open Source License
private IpPermission createIPPermissionGroup(String protocol, int fromPort, int toPort, String group) { IpPermission ipp = new IpPermission(); ipp.setIpProtocol(protocol);/*ww w .j a v a 2s.co m*/ ipp.setFromPort(fromPort); ipp.setToPort(toPort); List<UserIdGroupPair> gps = new ArrayList<UserIdGroupPair>(); UserIdGroupPair gp = new UserIdGroupPair(); gp.setGroupName(group); gp.setUserId(params.getAWSUserID()); gps.add(gp); ipp.setUserIdGroupPairs(gps); return (ipp); }
From source file:jp.primecloud.auto.aws.typica.converter.UserIdGroupPairConverter.java
License:Open Source License
@Override protected UserIdGroupPair convertObject(String[] from) { UserIdGroupPair to = new UserIdGroupPair(); to.setUserId(from[0]); to.setGroupName(from[1]);/* w w w . jav a2 s . c o m*/ return to; }
From source file:org.openinfinity.cloud.service.administrator.EC2Wrapper.java
License:Apache License
public void authorizeGroup(String securityGroupName, String sourceGroupName, String sourceGroupOwner, Integer fromPort, Integer toPort, String protocol) { try {/* w ww. j a va 2 s. c om*/ AuthorizeSecurityGroupIngressRequest request = new AuthorizeSecurityGroupIngressRequest(); // if(this.cloudType == InstanceService.CLOUD_TYPE_EUCALYPTUS) { /* request.setFromPort(fromPort); request.setToPort(toPort); request.setSourceSecurityGroupName(sourceGroupName); request.setSourceSecurityGroupOwnerId(sourceGroupOwner); request.setIpProtocol(protocol); */ // } else { UserIdGroupPair pair = new UserIdGroupPair(); pair.setGroupName(sourceGroupName); pair.setUserId(sourceGroupOwner); List<UserIdGroupPair> idList = new ArrayList<UserIdGroupPair>(); idList.add(pair); IpPermission perm = new IpPermission(); perm.setUserIdGroupPairs(idList); perm.setFromPort(fromPort); perm.setToPort(toPort); perm.setIpProtocol(protocol); List<IpPermission> permList = new ArrayList<IpPermission>(); permList.add(perm); request.setIpPermissions(permList); // } request.setGroupName(securityGroupName); ec2.authorizeSecurityGroupIngress(request); } catch (Exception e) { String message = e.getMessage(); LOG.error("Could not set authorized IP:s to security group: " + message); ExceptionUtil.throwSystemException(message, e); } }
From source file:org.openinfinity.cloud.service.administrator.EC2Wrapper.java
License:Apache License
public void revokeGroup(String securityGroupName, String sourceGroupName, String sourceGroupOwner, Integer fromPort, Integer toPort, String protocol) { try {//w w w . j ava 2 s . c o m RevokeSecurityGroupIngressRequest request = new RevokeSecurityGroupIngressRequest(); UserIdGroupPair pair = new UserIdGroupPair(); pair.setGroupName(sourceGroupName); pair.setUserId(sourceGroupOwner); List<UserIdGroupPair> idList = new ArrayList<UserIdGroupPair>(); idList.add(pair); IpPermission perm = new IpPermission(); perm.setUserIdGroupPairs(idList); perm.setFromPort(fromPort); perm.setToPort(toPort); perm.setIpProtocol(protocol); List<IpPermission> permList = new ArrayList<IpPermission>(); permList.add(perm); request.setIpPermissions(permList); request.setGroupName(securityGroupName); ec2.revokeSecurityGroupIngress(request); } catch (Exception e) { String message = e.getMessage(); LOG.error("Could not set authorized IP:s to security group: " + message); ExceptionUtil.throwSystemException(message, e); } }