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

com.github.alexdlaird.ngrok.protocol.TunnelHeader Maven / Gradle / Ivy

package com.github.alexdlaird.ngrok.protocol;

import java.util.List;
import java.util.Map;

/**
 * An object that represents header configuration for a {@link com.github.alexdlaird.ngrok.protocol.CreateTunnel}.
 */
public class TunnelHeader {
    private final List add;

    private final List remove;

    private TunnelHeader(final TunnelHeader.Builder builder) {
        this.add = builder.add;
        this.remove = builder.remove;
    }

    /**
     * Get the list of headers to add.
     */
    public List getAdd() {
        return add;
    }

    /**
     * Get the list of headers to remove.
     */
    public List getRemove() {
        return remove;
    }

    public static class Builder {
        private List add;
        private List remove;

        public Builder() {
        }

        public Builder(Map tunnelDefinitions) {
            if (tunnelDefinitions.containsKey("add")) {
                this.add = (List) tunnelDefinitions.get("add");
            }
            if (tunnelDefinitions.containsKey("remove")) {
                this.remove = (List) tunnelDefinitions.get("remove");
            }
        }

        /**
         * The list of headers to add.
         */
        public TunnelHeader.Builder withAdd(final List add) {
            this.add = add;
            return this;
        }

        /**
         * The list of headers to remove.
         */
        public TunnelHeader.Builder withRemove(final List remove) {
            this.remove = remove;
            return this;
        }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy