@@ -0,0 +1,2806 @@
+/*%0A * Copyright 2005-2014 Red Hat, Inc.%0A *%0A * Red Hat licenses this file to you under the Apache License, version%0A * 2.0 (the %22License%22); you may not use this file except in compliance%0A * with the License.  You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or%0A * implied.  See the License for the specific language governing%0A * permissions and limitations under the License.%0A */%0Apackage io.fabric8.maven;%0A%0Aimport io.fabric8.kubernetes.client.KubernetesClient;%0Aimport io.fabric8.openshift.client.OpenShiftClient;%0Aimport org.apache.maven.plugin.MojoExecutionException;%0Aimport org.apache.maven.plugin.MojoFailureException;%0Aimport org.apache.maven.plugins.annotations.Mojo;%0Aimport org.apache.maven.plugins.annotations.Parameter;%0Aimport org.apache.maven.plugins.annotations.ResolutionScope;%0A%0A/**%0A * Cleans up namespace resources.%0A * The default behavior is to clean app specific resources, replication controllers, pods, services, routes etc.%0A * The command also supports deep cleaning. When enabled deep cleaning will delete everything including secrets, service accounts etc.%0A */%0A@Mojo(name = %22clean%22, requiresDependencyResolution = ResolutionScope.RUNTIME)%0Apublic class CleanMojo extends ApplyMojo %7B%0A%0A    @Parameter(property = %22fabric8.deep.clean%22, defaultValue = %22false%22)%0A    private Boolean deep;%0A%0A    @Override%0A    public void execute() throws MojoExecutionException, MojoFailureException %7B%0A        KubernetesClient client = getKubernetes().inNamespace(getNamespace());%0A%0A        client.services().delete();%0A        client.replicationControllers().delete();%0A        client.pods().delete();%0A%0A        client.endpoints().delete();%0A        client.events().delete();%0A%0A        if (deep) %7B%0A            client.secrets().delete();%0A            client.serviceAccounts().delete();%0A            client.securityContextConstraints().delete();%0A        %7D%0A%0A        if (client.isAdaptable(OpenShiftClient.class)) %7B%0A            OpenShiftClient openShiftClient = client.adapt(OpenShiftClient.class);%0A%0A            openShiftClient.routes().delete();%0A            openShiftClient.builds().delete();%0A            openShiftClient.imageStreams().delete();%0A            openShiftClient.buildConfigs().delete();%0A            openShiftClient.deploymentConfigs().delete();%0A            openShiftClient.templates().delete();%0A%0A            if (deep) %7B%0A                openShiftClient.users().delete();%0A                openShiftClient.groups().delete();%0A                openShiftClient.policies().delete();%0A                openShiftClient.policyBindings().delete();%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Introduce clean mojo for cleaning up namespaces.