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 AuthorizeSecurityGroupIngress operation.

Adds one or more ingress rules to a security group.

IMPORTANT: EC2-Classic: You can have up to 100 rules per group. EC2-VPC: You can have up to 50 rules per group (covering both ingress and egress rules).

Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.

[EC2-Classic] This action gives one or more CIDR IP address ranges permission to access a security group in your account, or gives one or more security groups (called the source groups ) permission to access a security group for your account. A source group can be for your own AWS account, or another.

[EC2-VPC] This action gives one or more CIDR IP address ranges permission to access a security group in your VPC, or gives one or more other security groups (called the source groups ) permission to access a security group for your VPC. The security groups must all be for the same VPC.

 
[EC2-Classic, default VPC] The name of the security group.
 
     private String groupName;

    
The ID of the security group. Required for a nondefault VPC.
 
     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). (VPC only) 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. Can be used to specify multiple rules in a single command.
Default constructor for a new AuthorizeSecurityGroupIngressRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
    public AuthorizeSecurityGroupIngressRequest() {}
    
    
Constructs a new AuthorizeSecurityGroupIngressRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
groupName [EC2-Classic, default VPC] The name of the security group.
ipPermissions A set of IP permissions. Can be used to specify multiple rules in a single command.
    public AuthorizeSecurityGroupIngressRequest(String groupNamejava.util.List<IpPermissionipPermissions) {
        setGroupName(groupName);
        setIpPermissions(ipPermissions);
    }

    
[EC2-Classic, default VPC] The name of the security group.

Returns:
[EC2-Classic, default VPC] The name of the security group.
    public String getGroupName() {
        return ;
    }
    
    
[EC2-Classic, default VPC] The name of the security group.

Parameters:
groupName [EC2-Classic, default VPC] The name of the security group.
    public void setGroupName(String groupName) {
        this. = groupName;
    }
    
    
[EC2-Classic, default VPC] The name of the security group.

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

Parameters:
groupName [EC2-Classic, default VPC] The name of the security group.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = groupName;
        return this;
    }

    
The ID of the security group. Required for a nondefault VPC.

Returns:
The ID of the security group. Required for a nondefault VPC.
    public String getGroupId() {
        return ;
    }
    
    
The ID of the security group. Required for a nondefault VPC.

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

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

Parameters:
groupId The ID of the security group. Required for a nondefault VPC.
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 source security group. You can't specify a source security group and a CIDR IP address range.

Returns:
[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.

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

Parameters:
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 updated object so that method calls can be chained together.
    public AuthorizeSecurityGroupIngressRequest withSourceSecurityGroupName(String sourceSecurityGroupName) {
        this. = sourceSecurityGroupName;
        return this;
    }

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

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

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

Parameters:
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 updated object so that method calls can be chained together.
    public AuthorizeSecurityGroupIngressRequest withSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) {
        this. = sourceSecurityGroupOwnerId;
        return this;
    }

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

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

Parameters:
ipProtocol The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). (VPC only) Use -1 to specify all.
    public void setIpProtocol(String ipProtocol) {
        this. = ipProtocol;
    }
    
    
The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). (VPC only) 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). (VPC only) 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. Can be used to specify multiple rules in a single command.

Returns:
A set of IP permissions. Can be used to specify multiple rules in a single command.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A set of IP permissions. Can be used to specify multiple rules in a single command.

Parameters:
ipPermissions A set of IP permissions. Can be used to specify multiple rules in a single command.
    public void setIpPermissions(java.util.Collection<IpPermissionipPermissions) {
        if (ipPermissions == null) {
            this. = null;
            return;
        }
        ipPermissionsCopy.addAll(ipPermissions);
        this. = ipPermissionsCopy;
    }
    
    
A set of IP permissions. Can be used to specify multiple rules in a single command.

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. Can be used to specify multiple rules in a single command.
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. Can be used to specify multiple rules in a single command.

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

Parameters:
ipPermissions A set of IP permissions. Can be used to specify multiple rules in a single command.
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 (getGroupName() != nullsb.append("GroupName: " + getGroupName() + ",");
        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 + ((getGroupName() == null) ? 0 : getGroupName().hashCode()); 
        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 AuthorizeSecurityGroupIngressRequest == falsereturn false;
        
        if (other.getGroupName() == null ^ this.getGroupName() == nullreturn false;
        if (other.getGroupName() != null && other.getGroupName().equals(this.getGroupName()) == 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 (AuthorizeSecurityGroupIngressRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X