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

io.cloudslang.content.amazon.entities.inputs.NetworkInputs Maven / Gradle / Ivy

There is a newer version: 1.0.34
Show newest version
/*
 * (c) Copyright 2017 EntIT Software LLC, a Micro Focus company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *
 * The Apache License is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License 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 io.cloudslang.content.amazon.entities.inputs;

import static io.cloudslang.content.amazon.utils.InputsUtil.getEnforcedBooleanCondition;
import static io.cloudslang.content.amazon.utils.InputsUtil.getValidCidrNotation;

/**
 * Created by Mihai Tusa.
 * 6/7/2016.
 */
public class NetworkInputs {
    private final String cidrBlock;
    private final String deviceIndex;
    private final String networkInterfaceDescription;
    private final String networkInterfaceDeviceIndex;
    private final String networkInterfaceId;
    private final String networkInterfacePrivateIpAddress;
    private final String secondaryPrivateIpAddressCount;
    private final String networkInterfacesAssociatePublicIpAddressesString;
    private final String networkInterfaceDeleteOnTermination;
    private final String subnetIdsString;

    private final boolean amazonProvidedIpv6CidrBlock;
    private final boolean forceDetach;

    private NetworkInputs(Builder builder) {
        this.cidrBlock = builder.cidrBlock;
        this.networkInterfaceDescription = builder.networkInterfaceDescription;
        this.networkInterfacePrivateIpAddress = builder.networkInterfacePrivateIpAddress;
        this.networkInterfaceDeviceIndex = builder.networkInterfaceDeviceIndex;
        this.networkInterfaceDeleteOnTermination = builder.networkInterfaceDeleteOnTermination;
        this.networkInterfaceId = builder.networkInterfaceId;
        this.deviceIndex = builder.deviceIndex;
        this.secondaryPrivateIpAddressCount = builder.secondaryPrivateIpAddressCount;
        this.networkInterfacesAssociatePublicIpAddressesString = builder.networkInterfacesAssociatePublicIpAddressesString;
        this.subnetIdsString = builder.subnetIdsString;

        this.amazonProvidedIpv6CidrBlock = builder.amazonProvidedIpv6CidrBlock;
        this.forceDetach = builder.forceDetach;
    }

    public String getCidrBlock() {
        return cidrBlock;
    }

    public String getNetworkInterfaceDescription() {
        return networkInterfaceDescription;
    }

    public String getNetworkInterfaceId() {
        return networkInterfaceId;
    }

    public String getNetworkInterfacePrivateIpAddress() {
        return networkInterfacePrivateIpAddress;
    }

    public String getNetworkInterfaceDeviceIndex() {
        return networkInterfaceDeviceIndex;
    }

    public String getDeviceIndex() {
        return deviceIndex;
    }

    public String getSecondaryPrivateIpAddressCount() {
        return secondaryPrivateIpAddressCount;
    }

    public String getNetworkInterfacesAssociatePublicIpAddressesString() {
        return networkInterfacesAssociatePublicIpAddressesString;
    }

    public String getNetworkInterfaceDeleteOnTermination() {
        return networkInterfaceDeleteOnTermination;
    }

    public String getSubnetIdsString() {
        return subnetIdsString;
    }

    public boolean isAmazonProvidedIpv6CidrBlock() {
        return amazonProvidedIpv6CidrBlock;
    }

    public boolean isForceDetach() {
        return forceDetach;
    }

    public static class Builder {
        private String cidrBlock;
        private String deviceIndex;
        private String networkInterfacesAssociatePublicIpAddressesString;
        private String networkInterfaceDescription;
        private String networkInterfaceDeviceIndex;
        private String networkInterfaceId;
        private String secondaryPrivateIpAddressCount;
        private String networkInterfacePrivateIpAddress;
        private String networkInterfaceDeleteOnTermination;
        private String subnetIdsString;

        private boolean amazonProvidedIpv6CidrBlock;
        private boolean forceDetach;

        public NetworkInputs build() {
            return new NetworkInputs(this);
        }

        public Builder withCidrBlock(String inputValue) {
            cidrBlock = getValidCidrNotation(inputValue);
            return this;
        }

        public Builder withNetworkInterfaceDescription(String inputValue) {
            networkInterfaceDescription = inputValue;
            return this;
        }

        public Builder withDeviceIndex(String inputValue) {
            deviceIndex = inputValue;
            return this;
        }

        public Builder withNetworkInterfaceId(String inputValue) {
            networkInterfaceId = inputValue;
            return this;
        }

        public Builder withNetworkInterfacePrivateIpAddress(String inputValue) {
            networkInterfacePrivateIpAddress = inputValue;
            return this;
        }

        public Builder withNetworkInterfaceDeviceIndex(String inputValue) {
            networkInterfaceDeviceIndex = inputValue;
            return this;
        }

        public Builder withNetworkInterfaceDeleteOnTermination(String inputValue) {
            networkInterfaceDeleteOnTermination = inputValue;
            return this;
        }

        public Builder withSecondaryPrivateIpAddressCount(String inputValue) {
            secondaryPrivateIpAddressCount = inputValue;
            return this;
        }

        public Builder withNetworkInterfacesAssociatePublicIpAddressesString(String inputValue) {
            networkInterfacesAssociatePublicIpAddressesString = inputValue;
            return this;
        }

        public Builder withSubnetIdsString(String inputValue) {
            subnetIdsString = inputValue;
            return this;
        }

        public Builder withAmazonProvidedIpv6CidrBlock(String inputValue) {
            amazonProvidedIpv6CidrBlock = getEnforcedBooleanCondition(inputValue, Boolean.FALSE);
            return this;
        }

        public Builder withForceDetach(String inputValue) {
            forceDetach = getEnforcedBooleanCondition(inputValue, Boolean.FALSE);
            return this;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy