Package com.marcnuri.yakc
Class KubernetesClient
- java.lang.Object
-
- com.marcnuri.yakc.KubernetesClient
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class KubernetesClient extends java.lang.Object implements java.io.CloseableThe KubernetesClient class is the main entry point to use YAKC.An instance of this class will take care of the cluster access configuration and creating the API specific Retrofit2 clients.
You can use the client as follows:
try (KubernetesClient kc = new KubernetesClient()) { kc.create(CoreV1Api.class).listPodForAllNamespaces().stream().forEach(p -> System.out.printf("%-15s %s%n", p.getMetadata().getNamespace(), p.getMetadata().getName()) ); }In order to take advantage of this class you'll need to include any of the provided API modules, or build your own.
-
-
Constructor Summary
Constructors Constructor Description KubernetesClient()KubernetesClient(Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()<T extends com.marcnuri.yakc.api.Api>
Tcreate(java.lang.Class<T> clazz)ConfigurationgetConfiguration()okhttp3.OkHttpClientgetOkHttpClient()retrofit2.RetrofitgetRetrofit()
-
-
-
Constructor Detail
-
KubernetesClient
public KubernetesClient()
-
KubernetesClient
public KubernetesClient(Configuration configuration)
-
-
Method Detail
-
create
public <T extends com.marcnuri.yakc.api.Api> T create(java.lang.Class<T> clazz)
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
getConfiguration
public Configuration getConfiguration()
-
getOkHttpClient
public okhttp3.OkHttpClient getOkHttpClient()
-
getRetrofit
public retrofit2.Retrofit getRetrofit()
-
-