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

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

/*
 * Copyright (c) Aeontronix 2019
 */

package com.aeontronix.anypoint;

import com.aeontronix.anypoint.api.provision.ProvisioningException;
import com.aeontronix.anypoint.deploy.HDeploymentRequest;
import com.aeontronix.anypoint.runtime.DeploymentResult;
import com.aeontronix.anypoint.runtime.Server;
import com.kloudtek.util.UserDisplayableException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

import java.io.IOException;

@Command(name = "hdeploy", description = "Deploy Application to an on premise server", showDefaultValues = true)
public class HDeployApplicationCmd extends AbstractDeployApplicationCmd {
    private static final Logger logger = LoggerFactory.getLogger(HDeployApplicationCmd.class);
    /**
     * Anypoint target name (Server / Server Group / Cluster)
     */
    @Option(description = "Name of target server / server group / cluster", names = {"-t", "--target"})
    private String target;

    @Override
    protected DeploymentResult deploy(Environment environment) throws ProvisioningException, IOException, HttpException {
        Server server;
        try {
            server = environment.findServerByName(target);
        } catch (NotFoundException e) {
            throw new UserDisplayableException("Target " + target + " not found in env " + environment.getName());
        }
        HDeploymentRequest req = new HDeploymentRequest(server, appName, source, filename, appProperties, apiProvisioningConfig);
        return req.deploy();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy