/* * Copyright 2010-2018 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.AuthorizeSecurityGroupIngressRequestMarshaller; /** * Container for the parameters to the {@link com.amazonaws.services.ec2.AmazonEC2#authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressRequest) 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. *
* * @see com.amazonaws.services.ec2.AmazonEC2#authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressRequest) */ public class AuthorizeSecurityGroupIngressRequest extends AmazonWebServiceRequest implements Serializable, DryRunSupportedRequesttcp
, 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.
*/
private com.amazonaws.internal.ListWithAutoConstructFlag* Returns a reference to this object so that method calls can be chained together. * * @param groupName [EC2-Classic, default VPC] The name of the security group. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupIngressRequest withGroupName(String groupName) { this.groupName = groupName; return this; } /** * The ID of the security group. Required for a nondefault VPC. * * @return The ID of the security group. Required for a nondefault VPC. */ public String getGroupId() { return groupId; } /** * The ID of the security group. Required for a nondefault VPC. * * @param groupId The ID of the security group. Required for a nondefault VPC. */ public void setGroupId(String groupId) { this.groupId = 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. * * @param groupId The ID of the security group. Required for a nondefault VPC. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupIngressRequest withGroupId(String groupId) { this.groupId = groupId; return this; } /** * [EC2-Classic, default VPC] The name of the source security group. You * can't specify this parameter in combination with the following * parameters: the CIDR IP address range, the start of the port range, * the IP protocol, and the end of the port range. Creates rules that * grant full ICMP, UDP, and TCP access. To create a rule with a specific * IP protocol and port range, use a set of IP permissions instead. For * EC2-VPC, the source security group must be in the same VPC. * * @return [EC2-Classic, default VPC] The name of the source security group. You * can't specify this parameter in combination with the following * parameters: the CIDR IP address range, the start of the port range, * the IP protocol, and the end of the port range. Creates rules that * grant full ICMP, UDP, and TCP access. To create a rule with a specific * IP protocol and port range, use a set of IP permissions instead. For * EC2-VPC, the source security group must be in the same VPC. */ public String getSourceSecurityGroupName() { return sourceSecurityGroupName; } /** * [EC2-Classic, default VPC] The name of the source security group. You * can't specify this parameter in combination with the following * parameters: the CIDR IP address range, the start of the port range, * the IP protocol, and the end of the port range. Creates rules that * grant full ICMP, UDP, and TCP access. To create a rule with a specific * IP protocol and port range, use a set of IP permissions instead. For * EC2-VPC, the source security group must be in the same VPC. * * @param sourceSecurityGroupName [EC2-Classic, default VPC] The name of the source security group. You * can't specify this parameter in combination with the following * parameters: the CIDR IP address range, the start of the port range, * the IP protocol, and the end of the port range. Creates rules that * grant full ICMP, UDP, and TCP access. To create a rule with a specific * IP protocol and port range, use a set of IP permissions instead. For * EC2-VPC, the source security group must be in the same VPC. */ public void setSourceSecurityGroupName(String sourceSecurityGroupName) { this.sourceSecurityGroupName = sourceSecurityGroupName; } /** * [EC2-Classic, default VPC] The name of the source security group. You * can't specify this parameter in combination with the following * parameters: the CIDR IP address range, the start of the port range, * the IP protocol, and the end of the port range. Creates rules that * grant full ICMP, UDP, and TCP access. To create a rule with a specific * IP protocol and port range, use a set of IP permissions instead. For * EC2-VPC, the source security group must be in the same VPC. *
* 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 this parameter in combination with the following * parameters: the CIDR IP address range, the start of the port range, * the IP protocol, and the end of the port range. Creates rules that * grant full ICMP, UDP, and TCP access. To create a rule with a specific * IP protocol and port range, use a set of IP permissions instead. For * EC2-VPC, the source security group must be in the same VPC. * * @return A reference to this updated object so that method calls can be chained * together. */ public AuthorizeSecurityGroupIngressRequest withSourceSecurityGroupName(String sourceSecurityGroupName) { this.sourceSecurityGroupName = sourceSecurityGroupName; return this; } /** * [EC2-Classic] The AWS account number for the source security group, if * the source security group is in a different account. You can't specify * this parameter in combination with the following parameters: the CIDR * IP address range, the IP protocol, the start of the port range, and * the end of the port range. Creates rules that grant full ICMP, UDP, * and TCP access. To create a rule with a specific IP protocol and port * range, use a set of IP permissions instead. * * @return [EC2-Classic] The AWS account number for the source security group, if * the source security group is in a different account. You can't specify * this parameter in combination with the following parameters: the CIDR * IP address range, the IP protocol, the start of the port range, and * the end of the port range. Creates rules that grant full ICMP, UDP, * and TCP access. To create a rule with a specific IP protocol and port * range, use a set of IP permissions instead. */ public String getSourceSecurityGroupOwnerId() { return sourceSecurityGroupOwnerId; } /** * [EC2-Classic] The AWS account number for the source security group, if * the source security group is in a different account. You can't specify * this parameter in combination with the following parameters: the CIDR * IP address range, the IP protocol, the start of the port range, and * the end of the port range. Creates rules that grant full ICMP, UDP, * and TCP access. To create a rule with a specific IP protocol and port * range, use a set of IP permissions instead. * * @param sourceSecurityGroupOwnerId [EC2-Classic] The AWS account number for the source security group, if * the source security group is in a different account. You can't specify * this parameter in combination with the following parameters: the CIDR * IP address range, the IP protocol, the start of the port range, and * the end of the port range. Creates rules that grant full ICMP, UDP, * and TCP access. To create a rule with a specific IP protocol and port * range, use a set of IP permissions instead. */ public void setSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) { this.sourceSecurityGroupOwnerId = sourceSecurityGroupOwnerId; } /** * [EC2-Classic] The AWS account number for the source security group, if * the source security group is in a different account. You can't specify * this parameter in combination with the following parameters: the CIDR * IP address range, the IP protocol, the start of the port range, and * the end of the port range. Creates rules that grant full ICMP, UDP, * and TCP access. To create a rule with a specific IP protocol and port * range, use a set of IP permissions instead. *
* Returns a reference to this object so that method calls can be chained together.
*
* @param sourceSecurityGroupOwnerId [EC2-Classic] The AWS account number for the source security group, if
* the source security group is in a different account. You can't specify
* this parameter in combination with the following parameters: the CIDR
* IP address range, the IP protocol, the start of the port range, and
* the end of the port range. Creates rules that grant full ICMP, UDP,
* and TCP access. To create a rule with a specific IP protocol and port
* range, use a set of IP permissions instead.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public AuthorizeSecurityGroupIngressRequest withSourceSecurityGroupOwnerId(String sourceSecurityGroupOwnerId) {
this.sourceSecurityGroupOwnerId = sourceSecurityGroupOwnerId;
return this;
}
/**
* The IP protocol name (tcp
, udp
,
* icmp
) or number (see Protocol
* Numbers). (VPC only) Use -1
to specify all.
*
* @return The IP protocol name (tcp
, udp
,
* icmp
) or number (see Protocol
* Numbers). (VPC only) Use -1
to specify all.
*/
public String getIpProtocol() {
return ipProtocol;
}
/**
* The IP protocol name (tcp
, udp
,
* icmp
) or number (see Protocol
* Numbers). (VPC only) Use -1
to specify all.
*
* @param 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 = 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.
*
* @param ipProtocol The IP protocol name (tcp
, udp
,
* icmp
) or number (see Protocol
* Numbers). (VPC only) Use -1
to specify all.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public AuthorizeSecurityGroupIngressRequest 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 AuthorizeSecurityGroupIngressRequest 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 AuthorizeSecurityGroupIngressRequest 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 AuthorizeSecurityGroupIngressRequest withCidrIp(String cidrIp) {
this.cidrIp = cidrIp;
return this;
}
/**
* A set of IP permissions. Can be used to specify multiple rules in a
* single command.
*
* @return A set of IP permissions. Can be used to specify multiple rules in a
* single command.
*/
public java.util.List
* Returns a reference to this object so that method calls can be chained together.
*
* @param ipPermissions A set of IP permissions. Can be used to specify multiple rules in a
* single command.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public AuthorizeSecurityGroupIngressRequest withIpPermissions(IpPermission... ipPermissions) {
if (getIpPermissions() == null) setIpPermissions(new java.util.ArrayList
* Returns a reference to this object so that method calls can be chained together.
*
* @param ipPermissions A set of IP permissions. Can be used to specify multiple rules in a
* single command.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public AuthorizeSecurityGroupIngressRequest withIpPermissions(java.util.Collection