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

com.aeontronix.anypoint.AnypointCli Maven / Gradle / Ivy

/*
 * Copyright (c) Aeontronix 2019
 */

package com.aeontronix.anypoint;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.kloudtek.ktcli.CliCommand;
import com.kloudtek.ktcli.CliHelper;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

@Command(name = "anypoint", showDefaultValues = true, notRequiredWithDefault = true, sortOptions = false,
        subcommands = {
                CHDeployApplicationCmd.class, HDeployApplicationCmd.class, GetRegistrationKeyCmd.class,
                UpdateConfigCmd.class, RequestAPIAccessCmd.class, AddServerToGroupCmd.class,
                ProvisionVPCCmd.class, UpdateReleaseManifestCmd.class})
public class AnypointCli extends CliCommand {
    @Option(description = "Anypoint username", names = {"-u", "--username"})
    @JsonProperty
    protected String username;
    @Option(description = "Anypoint password", names = {"-pw", "--password"}, defaultValueMask = "*************")
    @JsonProperty
    protected String password;
    @JsonProperty
    protected String defaultOrganization;
    @JsonProperty
    protected String defaultEnvironment;
    protected AnypointClient client;

    public AnypointCli() {
    }

    public synchronized AnypointClient getClient() {
        if (client == null) {
            client = new AnypointClient(username, password);
        }
        return client;
    }

    public String getDefaultOrganization() {
        return defaultOrganization;
    }

    public void setDefaultOrganization(String defaultOrganization) {
        this.defaultOrganization = defaultOrganization;
    }

    public String getDefaultEnvironment() {
        return defaultEnvironment;
    }

    public void setDefaultEnvironment(String defaultEnvironment) {
        this.defaultEnvironment = defaultEnvironment;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public static void main(String[] args) {
        new CliHelper(AnypointCli::new).initAndRun(args);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy