Search in sources :

Example 1 with CertificateBuilder

use of io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder in project kubernetes-client by fabric8io.

the class V1CertificateCrudTest method shouldListAndGetCertificate.

@Test
void shouldListAndGetCertificate() {
    Certificate certificate2 = new CertificateBuilder().withNewMetadata().withName("cert2").endMetadata().build();
    client.v1().certificates().inNamespace("ns2").create(certificate2);
    CertificateList certificateList = client.v1().certificates().inNamespace("ns2").list();
    assertNotNull(certificateList);
    assertEquals(1, certificateList.getItems().size());
}
Also used : CertificateBuilder(io.fabric8.certmanager.api.model.v1.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1.Certificate) Test(org.junit.jupiter.api.Test)

Example 2 with CertificateBuilder

use of io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder in project kubernetes-client by fabric8io.

the class V1alpha2CertificateCrudTest method shouldDeleteACertificate.

@Test
void shouldDeleteACertificate() {
    Certificate certificate3 = new CertificateBuilder().withNewMetadata().withName("cert3").endMetadata().build();
    client.v1alpha2().certificates().inNamespace("ns3").create(certificate3);
    Boolean deleted = client.v1alpha2().certificates().inNamespace("ns3").withName("cert3").delete();
    assertTrue(deleted);
}
Also used : CertificateBuilder(io.fabric8.certmanager.api.model.v1alpha2.CertificateBuilder) Certificate(io.fabric8.certmanager.api.model.v1alpha2.Certificate) Test(org.junit.jupiter.api.Test)

Example 3 with CertificateBuilder

use of io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder in project kubernetes-client by fabric8io.

the class V1beta1CertificateCrudTest method shouldDeleteACertificate.

@Test
void shouldDeleteACertificate() {
    Certificate certificate3 = new CertificateBuilder().withNewMetadata().withName("cert3").endMetadata().build();
    client.v1beta1().certificates().inNamespace("ns3").create(certificate3);
    Boolean deleted = client.v1beta1().certificates().inNamespace("ns3").withName("cert3").delete();
    assertTrue(deleted);
}
Also used : CertificateBuilder(io.fabric8.certmanager.api.model.v1beta1.CertificateBuilder) Certificate(io.fabric8.certmanager.api.model.v1beta1.Certificate) Test(org.junit.jupiter.api.Test)

Example 4 with CertificateBuilder

use of io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder 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 5 with CertificateBuilder

use of io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder 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)

Aggregations

Test (org.junit.jupiter.api.Test)8 DefaultCertManagerClient (io.fabric8.certmanager.client.DefaultCertManagerClient)4 NamespacedCertManagerClient (io.fabric8.certmanager.client.NamespacedCertManagerClient)4 Certificate (io.fabric8.certmanager.api.model.v1.Certificate)3 CertificateBuilder (io.fabric8.certmanager.api.model.v1.CertificateBuilder)3 Certificate (io.fabric8.certmanager.api.model.v1alpha2.Certificate)3 CertificateBuilder (io.fabric8.certmanager.api.model.v1alpha2.CertificateBuilder)3 Certificate (io.fabric8.certmanager.api.model.v1alpha3.Certificate)3 CertificateBuilder (io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder)3 Certificate (io.fabric8.certmanager.api.model.v1beta1.Certificate)3 CertificateBuilder (io.fabric8.certmanager.api.model.v1beta1.CertificateBuilder)3 CertificateList (io.fabric8.certmanager.api.model.v1.CertificateList)2 CertificateList (io.fabric8.certmanager.api.model.v1alpha2.CertificateList)2 CertificateList (io.fabric8.certmanager.api.model.v1alpha3.CertificateList)2 CertificateList (io.fabric8.certmanager.api.model.v1beta1.CertificateList)2