@@ -0,0 +1,3269 @@
+/**%0A * Copyright (C) 2015 Red Hat, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * 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 implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage io.fabric8.kubernetes.examples;%0A%0Aimport io.fabric8.kubernetes.api.model.Secret;%0Aimport io.fabric8.kubernetes.api.model.SecretBuilder;%0Aimport io.fabric8.kubernetes.client.ConfigBuilder;%0Aimport io.fabric8.kubernetes.client.DefaultKubernetesClient;%0Aimport io.fabric8.kubernetes.client.KubernetesClient;%0Aimport io.fabric8.kubernetes.client.KubernetesClientException;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.UUID;%0A%0A/**%0A *  This is an example of secret.%0A */%0Apublic class SecretExamples %7B%0A  private static final Logger logger = LoggerFactory.getLogger(SecretExamples.class);%0A%0A  public static void main(String%5B%5D args) %7B%0A    final ConfigBuilder configBuilder = new ConfigBuilder();%0A    if (args.length %3E 0) %7B%0A      configBuilder.withMasterUrl(args%5B0%5D);%0A      logger.info(%22Using master with URL: %7B%7D%22, args%5B0%5D);%0A    %7D%0A    try (KubernetesClient client = new DefaultKubernetesClient(configBuilder.build())) %7B%0A      final String secretName = UUID.randomUUID().toString();%0A      final String namespace = %22default%22;%0A      logger.info(%22List of existent Secret:%22);%0A      client.secrets().inNamespace(namespace).list().getItems()%0A        .forEach(sc -%3E logger.info(%22 - %7B%7D%22, sc.getMetadata().getName()));%0A%0A      logger.info(%22Creating new Secret%22);%0A      Map%3CString, String%3E data = new HashMap%3C%3E();%0A      data.put(%22tls.crt%22, %22YWFh%22);%0A      data.put(%22tls.key%22, %22YmJi%22);%0A      final Secret secret = new SecretBuilder()%0A        .withNewMetadata().withName(secretName).endMetadata()%0A        .withType(%22kubernetes.io/tls%22)%0A        .withImmutable(false)%0A        .addToData(data)%0A        .build();%0A      Secret secretCreated = client.secrets().inNamespace(namespace).create(secret);%0A      logger.info(%22Newly created Secret details:%5Cn%7B%7D%22, secretCreated);%0A%0A      logger.info(%22Updated list of existent Secret:%22);%0A      client.secrets().inNamespace(namespace).list().getItems()%0A        .forEach(sc -%3E logger.info(%22 - %7B%7D%22, sc.getMetadata().getName()));%0A%0A      logger.info(%22Updating %7B%7D Secret to add new label%22, secretName);%0A      final Secret updatedSecret = client.secrets().inNamespace(namespace).withName(secretName).edit(s -%3E%0A        new SecretBuilder(s).editMetadata().addToLabels(%22testLabel%22, %22testLabelValue%22).endMetadata().build()%0A      );%0A      logger.info(%22Updated Secret details:%5Cn%7B%7D%22, updatedSecret);%0A%0A      //delete Secret%0A      boolean isDeleteSuccessful = client.secrets().inNamespace(namespace).delete(secret);%0A      logger.info(%22Secret resource successfully deleted: %7B%7D%22, isDeleteSuccessful);%0A    %7D catch (KubernetesClientException e) %7B%0A      logger.error(e.getMessage(), e);%0A    %7D%0A  %7D%0A%7D%0A

add kubernetes-client example for secret