public class CreateSecurityGroupRequest extends AmazonWebServiceRequest implements java.io.Serializable, DryRunSupportedRequest<CreateSecurityGroupRequest>
CreateSecurityGroup operation
.
Creates a security group.
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
IMPORTANT: EC2-Classic: You can have up to 500 security groups. EC2-VPC: You can create up to 500 security groups per VPC.
When you create a security group, you specify a friendly name of your choice. You can have a security group for use in EC2-Classic with the same name as a security group for use in a VPC. However, you can't have two security groups for use in EC2-Classic with the same name or two security groups for use in a VPC with the same name.
You have a default security group for use in EC2-Classic and a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other.
You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress, AuthorizeSecurityGroupEgress, RevokeSecurityGroupIngress, and RevokeSecurityGroupEgress.
Constructor and Description |
---|
CreateSecurityGroupRequest()
Default constructor for a new CreateSecurityGroupRequest object.
|
CreateSecurityGroupRequest(java.lang.String groupName,
java.lang.String description)
Constructs a new CreateSecurityGroupRequest object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getDescription()
A description for the security group.
|
Request<CreateSecurityGroupRequest> |
getDryRunRequest()
This method is intended for internal use only.
|
java.lang.String |
getGroupName()
The name of the security group.
|
java.lang.String |
getVpcId()
[EC2-VPC] The ID of the VPC.
|
int |
hashCode() |
void |
setDescription(java.lang.String description)
A description for the security group.
|
void |
setGroupName(java.lang.String groupName)
The name of the security group.
|
void |
setVpcId(java.lang.String vpcId)
[EC2-VPC] The ID of the VPC.
|
java.lang.String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
CreateSecurityGroupRequest |
withDescription(java.lang.String description)
A description for the security group.
|
CreateSecurityGroupRequest |
withGroupName(java.lang.String groupName)
The name of the security group.
|
CreateSecurityGroupRequest |
withVpcId(java.lang.String vpcId)
[EC2-VPC] The ID of the VPC.
|
clone, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public CreateSecurityGroupRequest()
public CreateSecurityGroupRequest(java.lang.String groupName, java.lang.String description)
groupName
- The name of the security group. Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
description
- A description for the security group. This is
informational only. Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
public java.lang.String getGroupName()
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
public void setGroupName(java.lang.String groupName)
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
groupName
- The name of the security group. Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
public CreateSecurityGroupRequest withGroupName(java.lang.String groupName)
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
Returns a reference to this object so that method calls can be chained together.
groupName
- The name of the security group. Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
public java.lang.String getDescription()
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
public void setDescription(java.lang.String description)
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
description
- A description for the security group. This is informational only.
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
public CreateSecurityGroupRequest withDescription(java.lang.String description)
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
Returns a reference to this object so that method calls can be chained together.
description
- A description for the security group. This is informational only.
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
public java.lang.String getVpcId()
public void setVpcId(java.lang.String vpcId)
vpcId
- [EC2-VPC] The ID of the VPC. Required for EC2-VPC.public CreateSecurityGroupRequest withVpcId(java.lang.String vpcId)
Returns a reference to this object so that method calls can be chained together.
vpcId
- [EC2-VPC] The ID of the VPC. Required for EC2-VPC.public Request<CreateSecurityGroupRequest> getDryRunRequest()
getDryRunRequest
in interface DryRunSupportedRequest<CreateSecurityGroupRequest>
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.