cfdsl.ec2.NetworkAclEntry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cfdsl Show documentation
Show all versions of cfdsl Show documentation
Java DSL for Amazon CloudFormation templates
The newest version!
package cfdsl.ec2;
import cfdsl.ec2.property.Icmp;
import cfdsl.ec2.property.PortRange;
import cfdsl.fn.StringLike;
import cfdsl.resource.Resource;
import cfdsl.resource.ResourceBuilder;
/**
* AWS::EC2::NetworkAclEntry
* resource type.
*/
public final class NetworkAclEntry extends Resource {
private NetworkAclEntry(Builder b) {
super("AWS::EC2::NetworkAclEntry", b);
}
public static final class Builder extends ResourceBuilder {
// TODO bl: turn these lengthy constructors into a multi-stage builder.
private Builder(
String logicalName,
int ruleNumber,
NetworkAcl acl,
RuleAction ruleAction,
boolean egress,
PortRange portRange,
int protocol) {
super(logicalName);
addProperty("RuleNumber", ruleNumber);
addProperty("NetworkAclId", acl);
addProperty("Egress", egress);
addProperty("PortRange", portRange);
addProperty("Protocol", protocol);
addProperty("RuleAction", ruleAction);
}
Builder(
String logicalName,
int ruleNumber,
NetworkAcl acl,
RuleAction ruleAction,
String cidrBlock,
boolean egress,
PortRange portRange,
int protocol) {
this(logicalName, ruleNumber, acl, ruleAction, egress, portRange, protocol);
addProperty("CidrBlock", cidrBlock);
}
Builder(
String logicalName,
int ruleNumber,
NetworkAcl acl,
RuleAction ruleAction,
StringLike cidrBlock,
boolean egress,
PortRange portRange,
int protocol) {
this(logicalName, ruleNumber, acl, ruleAction, egress, portRange, protocol);
addProperty("CidrBlock", cidrBlock);
}
public Builder icmp(Icmp icmp) {
addProperty("Icmp", icmp);
return this;
}
@Override
public NetworkAclEntry build() {
return new NetworkAclEntry(this);
}
}
enum RuleAction {
ALLOW("allow"),
DENY("deny");
private final String name;
RuleAction(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}
}