Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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;
 
 
Container for the parameters to the 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 destination CIDR IP address ranges, or to one or more destination 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.

 
The ID of the security group.
 
     private String groupId;

    
[EC2-Classic, default VPC] The name of the destination security group. You can't specify a destination security group and a CIDR IP address range.
 
     private String sourceSecurityGroupName;

    
The ID of the destination security group. You can't specify a destination 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;

    
A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.
The ID of the security group.

Returns:
The ID of the security group.
    public String getGroupId() {
        return ;
    }
    
    
The ID of the security group.

Parameters:
groupId The ID of the security group.
    public void setGroupId(String groupId) {
        this. = groupId;
    }
    
    
The ID of the security group.

Returns a reference to this object so that method calls can be chained together.

Parameters:
groupId The ID of the security group.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = groupId;
        return this;
    }

    
[EC2-Classic, default VPC] The name of the destination security group. You can't specify a destination security group and a CIDR IP address range.

Returns:
[EC2-Classic, default VPC] The name of the destination security group. You can't specify a destination security group and a CIDR IP address range.
        return ;
    }
    
    
[EC2-Classic, default VPC] The name of the destination security group. You can't specify a destination security group and a CIDR IP address range.

Parameters:
sourceSecurityGroupName [EC2-Classic, default VPC] The name of the destination security group. You can't specify a destination security group and a CIDR IP address range.
    public void setSourceSecurityGroupName(String sourceSecurityGroupName) {
        this. = sourceSecurityGroupName;
    }
    
    
[EC2-Classic, default VPC] The name of the destination security group. You can't specify a destination security group and a CIDR IP address range.

Returns a reference to this object so that method calls can be chained together.

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

    
The ID of the destination security group. You can't specify a destination security group and a CIDR IP address range.

Returns:
The ID of the destination security group. You can't specify a destination security group and a CIDR IP address range.
        return ;
    }
    
    
The ID of the destination security group. You can't specify a destination security group and a CIDR IP address range.

Parameters:
sourceSecurityGroupOwnerId The ID of the destination security group. You can't specify a destination security group and a CIDR IP address range.
    public void setSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) {
        this. = sourceSecurityGroupOwnerId;
    }
    
    
The ID of the destination security group. You can't specify a destination security group and a CIDR IP address range.

Returns a reference to this object so that method calls can be chained together.

Parameters:
sourceSecurityGroupOwnerId The ID of the destination security group. You can't specify a destination security group and a CIDR IP address range.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AuthorizeSecurityGroupEgressRequest withSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) {
        this. = sourceSecurityGroupOwnerId;
        return this;
    }

    
The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). Use -1 to specify all.

Returns:
The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). Use -1 to specify all.
    public String getIpProtocol() {
        return ;
    }
    
    
The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). Use -1 to specify all.

Parameters:
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;
    }
    
    
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.

Parameters:
ipProtocol The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). Use -1 to specify all.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = 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.

Returns:
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 ;
    }
    
    
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.

Parameters:
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;
    }
    
    
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.

Parameters:
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 updated object so that method calls can be chained together.
        this. = 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.

Returns:
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 ;
    }
    
    
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.

Parameters:
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;
    }
    
    
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.

Parameters:
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 updated object so that method calls can be chained together.
        this. = toPort;
        return this;
    }

    
The CIDR IP address range. You can't specify this parameter when specifying a source security group.

Returns:
The CIDR IP address range. You can't specify this parameter when specifying a source security group.
    public String getCidrIp() {
        return ;
    }
    
    
The CIDR IP address range. You can't specify this parameter when specifying a source security group.

Parameters:
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;
    }
    
    
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.

Parameters:
cidrIp The CIDR IP address range. You can't specify this parameter when specifying a source security group.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = cidrIp;
        return this;
    }

    
A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.

Returns:
A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.

Parameters:
ipPermissions A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.
    public void setIpPermissions(java.util.Collection<IpPermissionipPermissions) {
        if (ipPermissions == null) {
            this. = null;
            return;
        }
        ipPermissionsCopy.addAll(ipPermissions);
        this. = ipPermissionsCopy;
    }
    
    
A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.

NOTE: This method appends the values to the existing list (if any). Use setIpPermissions(java.util.Collection) or withIpPermissions(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
ipPermissions A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (getIpPermissions() == nullsetIpPermissions(new java.util.ArrayList<IpPermission>(ipPermissions.length));
        for (IpPermission value : ipPermissions) {
            getIpPermissions().add(value);
        }
        return this;
    }
    
    
A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.

Returns a reference to this object so that method calls can be chained together.

Parameters:
ipPermissions A set of IP permissions. You can't specify a destination security group and a CIDR IP address range.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (ipPermissions == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<IpPermissionipPermissionsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<IpPermission>(ipPermissions.size());
            ipPermissionsCopy.addAll(ipPermissions);
            this. = 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
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
    
    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getGroupId() != nullsb.append("GroupId: " + getGroupId() + ",");
        if (getSourceSecurityGroupName() != nullsb.append("SourceSecurityGroupName: " + getSourceSecurityGroupName() + ",");
        if (getSourceSecurityGroupOwnerId() != nullsb.append("SourceSecurityGroupOwnerId: " + getSourceSecurityGroupOwnerId() + ",");
        if (getIpProtocol() != nullsb.append("IpProtocol: " + getIpProtocol() + ",");
        if (getFromPort() != nullsb.append("FromPort: " + getFromPort() + ",");
        if (getToPort() != nullsb.append("ToPort: " + getToPort() + ",");
        if (getCidrIp() != nullsb.append("CidrIp: " + getCidrIp() + ",");
        if (getIpPermissions() != nullsb.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 == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof AuthorizeSecurityGroupEgressRequest == falsereturn false;
        
        if (other.getGroupId() == null ^ this.getGroupId() == nullreturn false;
        if (other.getGroupId() != null && other.getGroupId().equals(this.getGroupId()) == falsereturn false
        if (other.getSourceSecurityGroupName() == null ^ this.getSourceSecurityGroupName() == nullreturn false;
        if (other.getSourceSecurityGroupName() != null && other.getSourceSecurityGroupName().equals(this.getSourceSecurityGroupName()) == falsereturn false
        if (other.getSourceSecurityGroupOwnerId() == null ^ this.getSourceSecurityGroupOwnerId() == nullreturn false;
        if (other.getSourceSecurityGroupOwnerId() != null && other.getSourceSecurityGroupOwnerId().equals(this.getSourceSecurityGroupOwnerId()) == falsereturn false
        if (other.getIpProtocol() == null ^ this.getIpProtocol() == nullreturn false;
        if (other.getIpProtocol() != null && other.getIpProtocol().equals(this.getIpProtocol()) == falsereturn false
        if (other.getFromPort() == null ^ this.getFromPort() == nullreturn false;
        if (other.getFromPort() != null && other.getFromPort().equals(this.getFromPort()) == falsereturn false
        if (other.getToPort() == null ^ this.getToPort() == nullreturn false;
        if (other.getToPort() != null && other.getToPort().equals(this.getToPort()) == falsereturn false
        if (other.getCidrIp() == null ^ this.getCidrIp() == nullreturn false;
        if (other.getCidrIp() != null && other.getCidrIp().equals(this.getCidrIp()) == falsereturn false
        if (other.getIpPermissions() == null ^ this.getIpPermissions() == nullreturn false;
        if (other.getIpPermissions() != null && other.getIpPermissions().equals(this.getIpPermissions()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (AuthorizeSecurityGroupEgressRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X