@@ -0,0 +1,2426 @@
+/**%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.kubernetes.api;%0A%0Aimport io.fabric8.kubernetes.api.model.ControllerDesiredState;%0Aimport io.fabric8.kubernetes.api.model.DesiredState;%0Aimport io.fabric8.kubernetes.api.model.Manifest;%0Aimport io.fabric8.kubernetes.api.model.ManifestContainer;%0Aimport io.fabric8.kubernetes.api.model.PodCurrentContainerInfo;%0Aimport io.fabric8.kubernetes.api.model.PodListSchema;%0Aimport io.fabric8.kubernetes.api.model.PodSchema;%0Aimport io.fabric8.kubernetes.api.model.ReplicationControllerListSchema;%0Aimport io.fabric8.kubernetes.api.model.ReplicationControllerSchema;%0Aimport io.fabric8.kubernetes.api.model.ServiceListSchema;%0Aimport io.fabric8.kubernetes.api.model.ServiceSchema;%0A%0Aimport java.io.File;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0A/**%0A * Applies the given JSON file to the kubernetes environment%0A */%0Apublic class Apply %7B%0A    public static void main(String... args) %7B%0A        if (args.length %3C 1) %7B%0A            System.out.println(%22Usage jsonFileToApply%22);%0A            return;%0A        %7D%0A        try %7B%0A            KubernetesClient kube = new KubernetesClient();%0A            System.out.println(%22Connecting to kubernetes on: %22 + kube.getAddress());%0A%0A            File file = new File(args%5B0%5D);%0A            System.out.println(%22Applying file: %22 + file);%0A            if (!file.exists() %7C%7C !file.isFile()) %7B%0A                System.out.println(%22File does not exist! %22 + file.getAbsolutePath());%0A                return;%0A            %7D%0A            Controller controller = new Controller(kube);%0A            controller.applyJson(file);%0A            System.out.println(%22Applied!%22);%0A        %7D catch (Exception e) %7B%0A            System.out.println(%22FAILED: %22 + e);%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

add a helper program we can use to try apply JSON to a kube environment