/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getFromPort() != null) sb.append("FromPort: ").append(getFromPort()).append(","); if (getIpProtocol() != null) sb.append("IpProtocol: ").append(getIpProtocol()).append(","); if (getIpv6Ranges() != null) sb.append("Ipv6Ranges: ").append(getIpv6Ranges()).append(","); if (getPrefixListIds() != null) sb.append("PrefixListIds: ").append(getPrefixListIds()).append(","); if (getToPort() != null) sb.append("ToPort: ").append(getToPort()).append(","); if (getUserIdGroupPairs() != null) sb.append("UserIdGroupPairs: ").append(getUserIdGroupPairs()).append(","); if (getIpv4Ranges() != null) sb.append("Ipv4Ranges: ").append(getIpv4Ranges()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFromPort() == null) ? 0 : getFromPort().hashCode()); hashCode = prime * hashCode + ((getIpProtocol() == null) ? 0 : getIpProtocol().hashCode()); hashCode = prime * hashCode + ((getIpv6Ranges() == null) ? 0 : getIpv6Ranges().hashCode()); hashCode = prime * hashCode + ((getPrefixListIds() == null) ? 0 : getPrefixListIds().hashCode()); hashCode = prime * hashCode + ((getToPort() == null) ? 0 : getToPort().hashCode()); hashCode = prime * hashCode + ((getUserIdGroupPairs() == null) ? 0 : getUserIdGroupPairs().hashCode()); hashCode = prime * hashCode + ((getIpv4Ranges() == null) ? 0 : getIpv4Ranges().hashCode()); return hashCode; }
return false; IpPermission other = (IpPermission) obj; if (other.getFromPort() == null ^ this.getFromPort() == null) return false; if (other.getFromPort() != null && other.getFromPort().equals(this.getFromPort()) == false) return false; if (other.getIpProtocol() == null ^ this.getIpProtocol() == null)
protected static IpRule toIpRule( IpPermission permission ) { BasicIpRule rule = new BasicIpRule(); rule.setFromPort( permission.getFromPort() ); rule.setToPort( permission.getToPort() ); rule.setIpProtocol( permission.getIpProtocol() ); rule.setIpRanges( permission.getIpRanges() ); return rule; }
for (SecurityGroup group : result.getSecurityGroups()) for (IpPermission perm : group.getIpPermissions()) if (perm.getFromPort() == from && perm.getToPort() == to) ipPermissions.addAll(perm.getIpRanges()); for (SecurityGroup group : result.getSecurityGroups()) for (IpPermission perm : group.getIpPermissions()) if (perm.getFromPort() == from && perm.getToPort() == to) ipPermissions.addAll(perm.getIpRanges());
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getIpProtocol() == null) ? 0 : getIpProtocol().hashCode()); hashCode = prime * hashCode + ((getFromPort() == null) ? 0 : getFromPort().hashCode()); hashCode = prime * hashCode + ((getToPort() == null) ? 0 : getToPort().hashCode()); hashCode = prime * hashCode + ((getUserIdGroupPairs() == null) ? 0 : getUserIdGroupPairs().hashCode()); hashCode = prime * hashCode + ((getIpRanges() == null) ? 0 : getIpRanges().hashCode()); hashCode = prime * hashCode + ((getPrefixListIds() == null) ? 0 : getPrefixListIds().hashCode()); return hashCode; }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getIpProtocol() != null) sb.append("IpProtocol: " + getIpProtocol() + ","); if (getFromPort() != null) sb.append("FromPort: " + getFromPort() + ","); if (getToPort() != null) sb.append("ToPort: " + getToPort() + ","); if (getUserIdGroupPairs() != null) sb.append("UserIdGroupPairs: " + getUserIdGroupPairs() + ","); if (getIpRanges() != null) sb.append("IpRanges: " + getIpRanges() + ","); if (getPrefixListIds() != null) sb.append("PrefixListIds: " + getPrefixListIds() ); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof IpPermission == false) return false; IpPermission other = (IpPermission)obj; if (other.getIpProtocol() == null ^ this.getIpProtocol() == null) return false; if (other.getIpProtocol() != null && other.getIpProtocol().equals(this.getIpProtocol()) == false) return false; if (other.getFromPort() == null ^ this.getFromPort() == null) return false; if (other.getFromPort() != null && other.getFromPort().equals(this.getFromPort()) == false) return false; if (other.getToPort() == null ^ this.getToPort() == null) return false; if (other.getToPort() != null && other.getToPort().equals(this.getToPort()) == false) return false; if (other.getUserIdGroupPairs() == null ^ this.getUserIdGroupPairs() == null) return false; if (other.getUserIdGroupPairs() != null && other.getUserIdGroupPairs().equals(this.getUserIdGroupPairs()) == false) return false; if (other.getIpRanges() == null ^ this.getIpRanges() == null) return false; if (other.getIpRanges() != null && other.getIpRanges().equals(this.getIpRanges()) == false) return false; if (other.getPrefixListIds() == null ^ this.getPrefixListIds() == null) return false; if (other.getPrefixListIds() != null && other.getPrefixListIds().equals(this.getPrefixListIds()) == false) return false; return true; }
if (updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(updateSecurityGroupRuleDescriptionsEgressRequestIpPermissionsListValue.getFromPort()));
if (updateSecurityGroupRuleDescriptionsIngressRequestIpPermissionsListValue.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(updateSecurityGroupRuleDescriptionsIngressRequestIpPermissionsListValue.getFromPort()));
if (authorizeSecurityGroupEgressRequestIpPermissionsListValue.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(authorizeSecurityGroupEgressRequestIpPermissionsListValue.getFromPort()));
if (revokeSecurityGroupEgressRequestIpPermissionsListValue.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(revokeSecurityGroupEgressRequestIpPermissionsListValue.getFromPort()));
if (revokeSecurityGroupIngressRequestIpPermissionsListValue.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(revokeSecurityGroupIngressRequestIpPermissionsListValue.getFromPort()));
if (authorizeSecurityGroupIngressRequestIpPermissionsListValue.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(authorizeSecurityGroupIngressRequestIpPermissionsListValue.getFromPort()));
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFromPort() == null) ? 0 : getFromPort().hashCode()); hashCode = prime * hashCode + ((getIpProtocol() == null) ? 0 : getIpProtocol().hashCode()); hashCode = prime * hashCode + ((getIpv6Ranges() == null) ? 0 : getIpv6Ranges().hashCode()); hashCode = prime * hashCode + ((getPrefixListIds() == null) ? 0 : getPrefixListIds().hashCode()); hashCode = prime * hashCode + ((getToPort() == null) ? 0 : getToPort().hashCode()); hashCode = prime * hashCode + ((getUserIdGroupPairs() == null) ? 0 : getUserIdGroupPairs().hashCode()); hashCode = prime * hashCode + ((getIpv4Ranges() == null) ? 0 : getIpv4Ranges().hashCode()); return hashCode; }
protected Permission getPermission(IpPermission perm) { checkArgument(CollectionUtils.isEmpty(perm.getUserIdGroupPairs()), "User id / group pairs are not supported"); String protocolName = perm.getIpProtocol(); Integer fromPort = perm.getFromPort(); Integer toPort = perm.getToPort(); List<String> ipRanges = perm.getIpRanges(); Assert.noNulls(fromPort, toPort, ipRanges); Assert.noBlanks(protocolName); Assert.isTrue(fromPort.equals(toPort), "port ranges are not supported"); Protocol protocol = Protocol.valueOf(protocolName.toUpperCase()); return Permission.builder(fromPort).withCidrNotations(ipRanges).withProtocol(protocol).build(); }
request.addParameter("IpPermissions." + ipPermissionsListIndex + ".IpProtocol", StringUtils.fromString(ipPermissionMember.getIpProtocol())); if (ipPermissionMember.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(ipPermissionMember.getFromPort()));
request.addParameter("IpPermissions." + ipPermissionsListIndex + ".IpProtocol", StringUtils.fromString(ipPermissionMember.getIpProtocol())); if (ipPermissionMember.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(ipPermissionMember.getFromPort()));
request.addParameter("IpPermissions." + ipPermissionsListIndex + ".IpProtocol", StringUtils.fromString(ipPermissionMember.getIpProtocol())); if (ipPermissionMember.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(ipPermissionMember.getFromPort()));
request.addParameter("IpPermissions." + ipPermissionsListIndex + ".IpProtocol", StringUtils.fromString(ipPermissionMember.getIpProtocol())); if (ipPermissionMember.getFromPort() != null) { request.addParameter("IpPermissions." + ipPermissionsListIndex + ".FromPort", StringUtils.fromInteger(ipPermissionMember.getFromPort()));