Search in sources :

Example 1 with DefaultCertManagerClient

use of io.fabric8.certmanager.client.DefaultCertManagerClient in project kubernetes-client by fabric8io.

the class CertificateCreate method main.

public static void main(String[] args) {
    try (NamespacedCertManagerClient certManagerClient = new DefaultCertManagerClient()) {
        String namespace = "default";
        Certificate certificate = new CertificateBuilder().build();
        // Create Certificate
        certManagerClient.v1beta1().certificates().inNamespace(namespace).create(certificate);
        System.out.println("Created: " + certificate.getMetadata().getName());
        // List Certificate
        CertificateList certificateList = certManagerClient.v1beta1().certificates().inNamespace(namespace).list();
        System.out.println("There are " + certificateList.getItems().size() + " TaskRun objects in " + namespace);
    }
}
Also used : NamespacedCertManagerClient(io.fabric8.certmanager.client.NamespacedCertManagerClient) DefaultCertManagerClient(io.fabric8.certmanager.client.DefaultCertManagerClient) CertificateBuilder(io.fabric8.certmanager.api.model.v1beta1.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1beta1.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1beta1.Certificate)

Example 2 with DefaultCertManagerClient

use of io.fabric8.certmanager.client.DefaultCertManagerClient in project kubernetes-client by fabric8io.

the class CertificateCreate method main.

public static void main(String[] args) {
    try (NamespacedCertManagerClient certManagerClient = new DefaultCertManagerClient()) {
        String namespace = "default";
        Certificate certificate = new CertificateBuilder().build();
        // Create Certificate
        certManagerClient.v1().certificates().inNamespace(namespace).create(certificate);
        System.out.println("Created: " + certificate.getMetadata().getName());
        // List Certificate
        CertificateList certificateList = certManagerClient.v1().certificates().inNamespace(namespace).list();
        System.out.println("There are " + certificateList.getItems().size() + " TaskRun objects in " + namespace);
    }
}
Also used : NamespacedCertManagerClient(io.fabric8.certmanager.client.NamespacedCertManagerClient) DefaultCertManagerClient(io.fabric8.certmanager.client.DefaultCertManagerClient) CertificateBuilder(io.fabric8.certmanager.api.model.v1.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1.Certificate)

Example 3 with DefaultCertManagerClient

use of io.fabric8.certmanager.client.DefaultCertManagerClient in project kubernetes-client by fabric8io.

the class CertificateCreate method main.

public static void main(String[] args) {
    try (NamespacedCertManagerClient certManagerClient = new DefaultCertManagerClient()) {
        String namespace = "default";
        Certificate certificate = new CertificateBuilder().build();
        // Create Certificate
        certManagerClient.v1alpha2().certificates().inNamespace(namespace).create(certificate);
        System.out.println("Created: " + certificate.getMetadata().getName());
        // List Certificate
        CertificateList certificateList = certManagerClient.v1alpha2().certificates().inNamespace(namespace).list();
        System.out.println("There are " + certificateList.getItems().size() + " TaskRun objects in " + namespace);
    }
}
Also used : NamespacedCertManagerClient(io.fabric8.certmanager.client.NamespacedCertManagerClient) DefaultCertManagerClient(io.fabric8.certmanager.client.DefaultCertManagerClient) CertificateBuilder(io.fabric8.certmanager.api.model.v1alpha2.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1alpha2.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1alpha2.Certificate)

Example 4 with DefaultCertManagerClient

use of io.fabric8.certmanager.client.DefaultCertManagerClient in project kubernetes-client by fabric8io.

the class CertificateCreate method main.

public static void main(String[] args) {
    try (NamespacedCertManagerClient certManagerClient = new DefaultCertManagerClient()) {
        String namespace = "default";
        Certificate certificate = new CertificateBuilder().build();
        // Create Certificate
        certManagerClient.v1alpha3().certificates().inNamespace(namespace).create(certificate);
        System.out.println("Created: " + certificate.getMetadata().getName());
        // List Certificate
        CertificateList certificateList = certManagerClient.v1alpha3().certificates().inNamespace(namespace).list();
        System.out.println("There are " + certificateList.getItems().size() + " TaskRun objects in " + namespace);
    }
}
Also used : NamespacedCertManagerClient(io.fabric8.certmanager.client.NamespacedCertManagerClient) DefaultCertManagerClient(io.fabric8.certmanager.client.DefaultCertManagerClient) CertificateBuilder(io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1alpha3.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1alpha3.Certificate)

Example 5 with DefaultCertManagerClient

use of io.fabric8.certmanager.client.DefaultCertManagerClient in project kubernetes-client by fabric8io.

the class ClientFactory method newClient.

public static CertManagerClient newClient(String[] args) {
    ConfigBuilder config = new ConfigBuilder();
    for (int i = 0; i < args.length - 1; i++) {
        String key = args[i];
        String value = args[i + 1];
        if (key.equals("--api-server")) {
            config = config.withMasterUrl(value);
        }
        if (key.equals("--token")) {
            config = config.withOauthToken(value);
        }
        if (key.equals("--username")) {
            config = config.withUsername(value);
        }
        if (key.equals("--password")) {
            config = config.withPassword(value);
        }
        if (key.equals("--namespace")) {
            config = config.withNamespace(value);
        }
    }
    return new DefaultCertManagerClient(config.build());
}
Also used : DefaultCertManagerClient(io.fabric8.certmanager.client.DefaultCertManagerClient) ConfigBuilder(io.fabric8.kubernetes.client.ConfigBuilder)

Aggregations

DefaultCertManagerClient (io.fabric8.certmanager.client.DefaultCertManagerClient)5 NamespacedCertManagerClient (io.fabric8.certmanager.client.NamespacedCertManagerClient)4 Certificate (io.fabric8.certmanager.api.model.v1.Certificate)1 CertificateBuilder (io.fabric8.certmanager.api.model.v1.CertificateBuilder)1 CertificateList (io.fabric8.certmanager.api.model.v1.CertificateList)1 Certificate (io.fabric8.certmanager.api.model.v1alpha2.Certificate)1 CertificateBuilder (io.fabric8.certmanager.api.model.v1alpha2.CertificateBuilder)1 CertificateList (io.fabric8.certmanager.api.model.v1alpha2.CertificateList)1 Certificate (io.fabric8.certmanager.api.model.v1alpha3.Certificate)1 CertificateBuilder (io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder)1 CertificateList (io.fabric8.certmanager.api.model.v1alpha3.CertificateList)1 Certificate (io.fabric8.certmanager.api.model.v1beta1.Certificate)1 CertificateBuilder (io.fabric8.certmanager.api.model.v1beta1.CertificateBuilder)1 CertificateList (io.fabric8.certmanager.api.model.v1beta1.CertificateList)1 ConfigBuilder (io.fabric8.kubernetes.client.ConfigBuilder)1