All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.ec2.model.AuthorizeSecurityGroupEgressRequest Maven / Gradle / Ivy

Go to download

The Amazon Web Services SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).

The newest version!
/*
 * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 * 
 *  http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.amazonaws.services.ec2.model;

import java.io.Serializable;

import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.AuthorizeSecurityGroupEgressRequestMarshaller;

/**
 * Container for the parameters to the {@link com.amazonaws.services.ec2.AmazonEC2#authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressRequest) AuthorizeSecurityGroupEgress operation}.
 * 

* Adds one or more egress rules to a security group for use with a VPC. * Specifically, this action permits instances to send traffic to one or * more CIDR IP address ranges, or to one or more security groups for the * same VPC. *

*

* IMPORTANT: You can have up to 50 rules per security group * (covering both ingress and egress rules). *

*

* A security group is for use with instances either in the EC2-Classic * platform or in a specific VPC. This action doesn't apply to security * groups for use in EC2-Classic. For more information, see * Security Groups for Your VPC * in the Amazon Virtual Private Cloud User Guide . *

*

* Each rule consists of the protocol (for example, TCP), plus either a * CIDR range or a source group. For the TCP and UDP protocols, you must * also specify the destination port or port range. For the ICMP * protocol, you must also specify the ICMP type and code. You can use -1 * for the type or code to mean all types or all codes. *

*

* Rule changes are propagated to affected instances as quickly as * possible. However, a small delay might occur. *

* * @see com.amazonaws.services.ec2.AmazonEC2#authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressRequest) */ public class AuthorizeSecurityGroupEgressRequest extends AmazonWebServiceRequest implements Serializable, DryRunSupportedRequest { /** * The ID of the security group. */ private String groupId; /** * [EC2-Classic, default VPC] The name of the source security group. You * can't specify a source security group and a CIDR IP address range. */ private String sourceSecurityGroupName; /** * The ID of the source security group. You can't specify a source * security group and a CIDR IP address range. */ private String sourceSecurityGroupOwnerId; /** * The IP protocol name (tcp, udp, * icmp) or number (see Protocol * Numbers). Use -1 to specify all. */ private String ipProtocol; /** * The start of port range for the TCP and UDP protocols, or an ICMP type * number. For the ICMP type number, use -1 to specify all * ICMP types. */ private Integer fromPort; /** * The end of port range for the TCP and UDP protocols, or an ICMP code * number. For the ICMP code number, use -1 to specify all * ICMP codes for the ICMP type. */ private Integer toPort; /** * The CIDR IP address range. You can't specify this parameter when * specifying a source security group. */ private String cidrIp; /** *

*/ private com.amazonaws.internal.ListWithAutoConstructFlag ipPermissions; /** * The ID of the security group. * * @return The ID of the security group. */ public String getGroupId() { return groupId; } /** * The ID of the security group. * * @param groupId The ID of the security group. */ public void setGroupId(String groupId) { this.groupId = groupId; } /** * The ID of the security group. *

* Returns a reference to this object so that method calls can be chained together. * * @param groupId The ID of the security group. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withGroupId(String groupId) { this.groupId = groupId; return this; } /** * [EC2-Classic, default VPC] The name of the source security group. You * can't specify a source security group and a CIDR IP address range. * * @return [EC2-Classic, default VPC] The name of the source security group. You * can't specify a source security group and a CIDR IP address range. */ public String getSourceSecurityGroupName() { return sourceSecurityGroupName; } /** * [EC2-Classic, default VPC] The name of the source security group. You * can't specify a source security group and a CIDR IP address range. * * @param sourceSecurityGroupName [EC2-Classic, default VPC] The name of the source security group. You * can't specify a source security group and a CIDR IP address range. */ public void setSourceSecurityGroupName(String sourceSecurityGroupName) { this.sourceSecurityGroupName = sourceSecurityGroupName; } /** * [EC2-Classic, default VPC] The name of the source security group. You * can't specify a source security group and a CIDR IP address range. *

* Returns a reference to this object so that method calls can be chained together. * * @param sourceSecurityGroupName [EC2-Classic, default VPC] The name of the source security group. You * can't specify a source security group and a CIDR IP address range. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withSourceSecurityGroupName(String sourceSecurityGroupName) { this.sourceSecurityGroupName = sourceSecurityGroupName; return this; } /** * The ID of the source security group. You can't specify a source * security group and a CIDR IP address range. * * @return The ID of the source security group. You can't specify a source * security group and a CIDR IP address range. */ public String getSourceSecurityGroupOwnerId() { return sourceSecurityGroupOwnerId; } /** * The ID of the source security group. You can't specify a source * security group and a CIDR IP address range. * * @param sourceSecurityGroupOwnerId The ID of the source security group. You can't specify a source * security group and a CIDR IP address range. */ public void setSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) { this.sourceSecurityGroupOwnerId = sourceSecurityGroupOwnerId; } /** * The ID of the source security group. You can't specify a source * security group and a CIDR IP address range. *

* Returns a reference to this object so that method calls can be chained together. * * @param sourceSecurityGroupOwnerId The ID of the source security group. You can't specify a source * security group and a CIDR IP address range. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) { this.sourceSecurityGroupOwnerId = sourceSecurityGroupOwnerId; return this; } /** * The IP protocol name (tcp, udp, * icmp) or number (see Protocol * Numbers). Use -1 to specify all. * * @return The IP protocol name (tcp, udp, * icmp) or number (see Protocol * Numbers). Use -1 to specify all. */ public String getIpProtocol() { return ipProtocol; } /** * The IP protocol name (tcp, udp, * icmp) or number (see Protocol * Numbers). Use -1 to specify all. * * @param ipProtocol The IP protocol name (tcp, udp, * icmp) or number (see Protocol * Numbers). Use -1 to specify all. */ public void setIpProtocol(String ipProtocol) { this.ipProtocol = ipProtocol; } /** * The IP protocol name (tcp, udp, * icmp) or number (see Protocol * Numbers). Use -1 to specify all. *

* Returns a reference to this object so that method calls can be chained together. * * @param ipProtocol The IP protocol name (tcp, udp, * icmp) or number (see Protocol * Numbers). Use -1 to specify all. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withIpProtocol(String ipProtocol) { this.ipProtocol = ipProtocol; return this; } /** * The start of port range for the TCP and UDP protocols, or an ICMP type * number. For the ICMP type number, use -1 to specify all * ICMP types. * * @return The start of port range for the TCP and UDP protocols, or an ICMP type * number. For the ICMP type number, use -1 to specify all * ICMP types. */ public Integer getFromPort() { return fromPort; } /** * The start of port range for the TCP and UDP protocols, or an ICMP type * number. For the ICMP type number, use -1 to specify all * ICMP types. * * @param fromPort The start of port range for the TCP and UDP protocols, or an ICMP type * number. For the ICMP type number, use -1 to specify all * ICMP types. */ public void setFromPort(Integer fromPort) { this.fromPort = fromPort; } /** * The start of port range for the TCP and UDP protocols, or an ICMP type * number. For the ICMP type number, use -1 to specify all * ICMP types. *

* Returns a reference to this object so that method calls can be chained together. * * @param fromPort The start of port range for the TCP and UDP protocols, or an ICMP type * number. For the ICMP type number, use -1 to specify all * ICMP types. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withFromPort(Integer fromPort) { this.fromPort = fromPort; return this; } /** * The end of port range for the TCP and UDP protocols, or an ICMP code * number. For the ICMP code number, use -1 to specify all * ICMP codes for the ICMP type. * * @return The end of port range for the TCP and UDP protocols, or an ICMP code * number. For the ICMP code number, use -1 to specify all * ICMP codes for the ICMP type. */ public Integer getToPort() { return toPort; } /** * The end of port range for the TCP and UDP protocols, or an ICMP code * number. For the ICMP code number, use -1 to specify all * ICMP codes for the ICMP type. * * @param toPort The end of port range for the TCP and UDP protocols, or an ICMP code * number. For the ICMP code number, use -1 to specify all * ICMP codes for the ICMP type. */ public void setToPort(Integer toPort) { this.toPort = toPort; } /** * The end of port range for the TCP and UDP protocols, or an ICMP code * number. For the ICMP code number, use -1 to specify all * ICMP codes for the ICMP type. *

* Returns a reference to this object so that method calls can be chained together. * * @param toPort The end of port range for the TCP and UDP protocols, or an ICMP code * number. For the ICMP code number, use -1 to specify all * ICMP codes for the ICMP type. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withToPort(Integer toPort) { this.toPort = toPort; return this; } /** * The CIDR IP address range. You can't specify this parameter when * specifying a source security group. * * @return The CIDR IP address range. You can't specify this parameter when * specifying a source security group. */ public String getCidrIp() { return cidrIp; } /** * The CIDR IP address range. You can't specify this parameter when * specifying a source security group. * * @param cidrIp The CIDR IP address range. You can't specify this parameter when * specifying a source security group. */ public void setCidrIp(String cidrIp) { this.cidrIp = cidrIp; } /** * The CIDR IP address range. You can't specify this parameter when * specifying a source security group. *

* Returns a reference to this object so that method calls can be chained together. * * @param cidrIp The CIDR IP address range. You can't specify this parameter when * specifying a source security group. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withCidrIp(String cidrIp) { this.cidrIp = cidrIp; return this; } /** *

* * @return

*/ public java.util.List getIpPermissions() { if (ipPermissions == null) { ipPermissions = new com.amazonaws.internal.ListWithAutoConstructFlag(); ipPermissions.setAutoConstruct(true); } return ipPermissions; } /** *

* * @param ipPermissions

*/ public void setIpPermissions(java.util.Collection ipPermissions) { if (ipPermissions == null) { this.ipPermissions = null; return; } com.amazonaws.internal.ListWithAutoConstructFlag ipPermissionsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag(ipPermissions.size()); ipPermissionsCopy.addAll(ipPermissions); this.ipPermissions = ipPermissionsCopy; } /** *

*

* Returns a reference to this object so that method calls can be chained together. * * @param ipPermissions

* * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withIpPermissions(IpPermission... ipPermissions) { if (getIpPermissions() == null) setIpPermissions(new java.util.ArrayList(ipPermissions.length)); for (IpPermission value : ipPermissions) { getIpPermissions().add(value); } return this; } /** *

*

* Returns a reference to this object so that method calls can be chained together. * * @param ipPermissions

* * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupEgressRequest withIpPermissions(java.util.Collection ipPermissions) { if (ipPermissions == null) { this.ipPermissions = null; } else { com.amazonaws.internal.ListWithAutoConstructFlag ipPermissionsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag(ipPermissions.size()); ipPermissionsCopy.addAll(ipPermissions); this.ipPermissions = ipPermissionsCopy; } return this; } /** * This method is intended for internal use only. * Returns the marshaled request configured with additional parameters to * enable operation dry-run. */ @Override public Request getDryRunRequest() { Request request = new AuthorizeSecurityGroupEgressRequestMarshaller().marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; } /** * 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 (getGroupId() != null) sb.append("GroupId: " + getGroupId() + ","); if (getSourceSecurityGroupName() != null) sb.append("SourceSecurityGroupName: " + getSourceSecurityGroupName() + ","); if (getSourceSecurityGroupOwnerId() != null) sb.append("SourceSecurityGroupOwnerId: " + getSourceSecurityGroupOwnerId() + ","); if (getIpProtocol() != null) sb.append("IpProtocol: " + getIpProtocol() + ","); if (getFromPort() != null) sb.append("FromPort: " + getFromPort() + ","); if (getToPort() != null) sb.append("ToPort: " + getToPort() + ","); if (getCidrIp() != null) sb.append("CidrIp: " + getCidrIp() + ","); if (getIpPermissions() != null) sb.append("IpPermissions: " + getIpPermissions() ); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getGroupId() == null) ? 0 : getGroupId().hashCode()); hashCode = prime * hashCode + ((getSourceSecurityGroupName() == null) ? 0 : getSourceSecurityGroupName().hashCode()); hashCode = prime * hashCode + ((getSourceSecurityGroupOwnerId() == null) ? 0 : getSourceSecurityGroupOwnerId().hashCode()); 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 + ((getCidrIp() == null) ? 0 : getCidrIp().hashCode()); hashCode = prime * hashCode + ((getIpPermissions() == null) ? 0 : getIpPermissions().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AuthorizeSecurityGroupEgressRequest == false) return false; AuthorizeSecurityGroupEgressRequest other = (AuthorizeSecurityGroupEgressRequest)obj; if (other.getGroupId() == null ^ this.getGroupId() == null) return false; if (other.getGroupId() != null && other.getGroupId().equals(this.getGroupId()) == false) return false; if (other.getSourceSecurityGroupName() == null ^ this.getSourceSecurityGroupName() == null) return false; if (other.getSourceSecurityGroupName() != null && other.getSourceSecurityGroupName().equals(this.getSourceSecurityGroupName()) == false) return false; if (other.getSourceSecurityGroupOwnerId() == null ^ this.getSourceSecurityGroupOwnerId() == null) return false; if (other.getSourceSecurityGroupOwnerId() != null && other.getSourceSecurityGroupOwnerId().equals(this.getSourceSecurityGroupOwnerId()) == false) return false; 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.getCidrIp() == null ^ this.getCidrIp() == null) return false; if (other.getCidrIp() != null && other.getCidrIp().equals(this.getCidrIp()) == false) return false; if (other.getIpPermissions() == null ^ this.getIpPermissions() == null) return false; if (other.getIpPermissions() != null && other.getIpPermissions().equals(this.getIpPermissions()) == false) return false; return true; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy