aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/identity/CredentialsMaintainer.java
blob: 0e387ac2731aa07b31925ae03485eca57321922b (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.identity;

import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext;

import java.time.Duration;

/**
 * A maintainer that is responsible for providing and refreshing credentials for a container.
 *
 * @author freva
 */
public interface CredentialsMaintainer {

    /**
     * Creates/refreshes credentials for the given NodeAgentContext. Called for every NodeAgent tick.
     * @return false if already converged, i.e. was a no-op.
     */
    boolean converge(NodeAgentContext context);

    /** Remove any existing credentials. This method is called just before container data is archived. */
    void clearCredentials(NodeAgentContext context);

    /** Get time until the certificate expires. Invoked each time metrics are collected.  */
    Duration certificateLifetime(NodeAgentContext context);

    /** Name used when reporting metrics */
    String name();
}