aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/secrets/TenantSecretStore.java
blob: 770bbaaf695a7ef3709d7b23823faed439ebb43a (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.secrets;

import java.util.Objects;

/**
 * @author olaa
 */
public class TenantSecretStore {

    private final String name;
    private final String awsId;
    private final String role;

    public TenantSecretStore(String name, String awsId, String role) {
        this.name = name;
        this.awsId = awsId;
        this.role = role;
    }

    public String getName() {
        return name;
    }

    public String getAwsId() {
        return awsId;
    }

    public String getRole() {
        return role;
    }

    public boolean isValid() {
        return !name.isBlank() &&
                !awsId.isBlank() &&
                !role.isBlank();
    }

    @Override
    public String toString() {
        return "TenantSecretStore{" +
                "name='" + name + '\'' +
                ", awsId='" + awsId + '\'' +
                ", role='" + role + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TenantSecretStore that = (TenantSecretStore) o;
        return name.equals(that.name) &&
                awsId.equals(that.awsId) &&
                role.equals(that.role);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, awsId, role);
    }
}