blob: 3a8580b7eb53737128f616334c7895252abe82e3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package com.yahoo.vespa.hosted.controller.certificate;
import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificate;
/**
* An unassigned certificate, which exists in a pre-provisioned pool of certificates. Once assigned to an application,
* the certificate is removed from the pool.
*
* @param certificate Details of the certificate
* @param state Current state of this
*
* @author andreer
*/
public record UnassignedCertificate(EndpointCertificate certificate, UnassignedCertificate.State state) {
public UnassignedCertificate {
if (certificate.randomizedId().isEmpty()) {
throw new IllegalArgumentException("randomizedId must be set for a pooled certificate");
}
}
public String id() {
return certificate.randomizedId().get();
}
public UnassignedCertificate withState(State state) {
return new UnassignedCertificate(certificate, state);
}
public enum State {
/** The certificate is ready for assignment */
ready,
/** The certificate is requested and is being provisioned */
requested
}
}
|