blob: 1d1f4938758bbdd56c6f9a4829a64e2989eb6b39 (
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
39
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
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.generatedId().isEmpty()) {
throw new IllegalArgumentException("generatedId must be set for a pooled certificate");
}
}
public String id() {
return certificate.generatedId().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
}
}
|