All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cfdsl.ec2.property.SecurityGroupIngressRule Maven / Gradle / Ivy

The newest version!
package cfdsl.ec2.property;

import cfdsl.ec2.SecurityGroup;
import cfdsl.fn.Derefable;
import cfdsl.fn.StringLike;

public final class SecurityGroupIngressRule extends Rule {
    private SecurityGroupIngressRule(Builder b) {
        super(b);
    }

    public static Builder of(int fromPort, int toPort, Protocol protocol) {
        return new Builder(fromPort, toPort, protocol);
    }

    public static final class Builder extends Rule.Builder {
        public Builder(int fromPort, int toPort, Protocol protocol) {
            super(fromPort, toPort, protocol);
        }

        public Builder cidrIp(String cidrIp) {
            addProperty("CidrIp", cidrIp);
            return this;
        }

        public Builder cidrIp(StringLike cidrIp) {
            addProperty("CidrIp", cidrIp);
            return this;
        }

        public Builder cidrIp(Derefable cidrIp) {
            return cidrIp(cidrIp.ref());
        }

        public Builder sourceSecurityGroupId(SecurityGroup source) {
            addProperty("SourceSecurityGroupId", source);
            return this;
        }

        public Builder sourceSecurityGroup(SecurityGroup source) {
            addProperty("SourceSecurityGroupName", source);
            return this;
        }

        public Builder sourceSecurityGroupOwnerId(StringLike sourceSecurityGroupOwnerId) {
            addProperty("SourceSecurityGroupOwnerId", sourceSecurityGroupOwnerId);
            return this;
        }

        @Override
        public SecurityGroupIngressRule build() {
            return new SecurityGroupIngressRule(this);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy