package ai.vespa.hosted.plugin;

import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

/**
 * Deploys a Vespa application package to the hosted Vespa API.
 *
 * @author jonmv
 */
@Mojo(name = "delete")
public class DeleteMojo extends AbstractVespaMojo {

    @Parameter(property = "environment")
    private String environment;

    @Parameter(property = "region")
    private String region;

    @Override
    protected void doExecute() {
        getLog().info(controller.deactivate(id, zoneOf(environment, region)));
    }

}


@@ -26,16 +26,110 @@
 lugin;%0A%0A
+import com.yahoo.config.provision.Environment;%0Aimport com.yahoo.config.provision.zone.ZoneId;%0A
 import o
@@ -579,16 +579,208 @@
 ute() %7B%0A
+        if (environment != null && ! Environment.from(environment).isManuallyDeployed())%0A            throw new IllegalArgumentException(%22Manual deletion is not permitted in %22 + environment);%0A%0A
         

Add guard against production deletions