ai.vespa.hosted.plugin.AbstractVespaDeploymentMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vespa-maven-plugin Show documentation
Show all versions of vespa-maven-plugin Show documentation
Maven Plugin for deploying a Vespa application package
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.hosted.plugin;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.zone.ZoneId;
import org.apache.maven.plugins.annotations.Parameter;
/**
* Base class for hosted Vespa plugin mojos which refer to a particular deployment.
*
* @author jonmv
*/
public abstract class AbstractVespaDeploymentMojo extends AbstractVespaMojo {
protected ZoneId zone;
@Parameter(property = "environment")
protected String environment;
@Parameter(property = "region")
protected String region;
protected ZoneId zoneOf(String environment, String region) {
if (isNullOrBlank(region))
return zone = controller.defaultZone(isNullOrBlank(environment) ? Environment.dev
: Environment.from(environment));
if (isNullOrBlank(environment))
throw new IllegalArgumentException("Environment must be specified if region is specified");
return zone = ZoneId.from(environment, region);
}
@Override
protected String name() {
return super.name() + "." + instance + " in " +
(zone != null ? zone.region() + " in " + zone.environment()
: (region == null ? "default region" : region) + " in " +
(environment == null ? "default environment (dev)" : environment));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy