aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/identifiers/ClusterId.java
blob: 7cec4068c2e7a171acae50433eeb6cd4be02492d (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
// 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.api.identifiers;

import com.yahoo.config.provision.ClusterSpec;

import java.util.Objects;

/**
 * DeploymentId x ClusterSpec.Id = ClusterId
 *
 * @author ogronnesby
 */
public class ClusterId {
    private final DeploymentId deploymentId;
    private final ClusterSpec.Id clusterId;

    public ClusterId(DeploymentId deploymentId, ClusterSpec.Id clusterId) {
        this.deploymentId = deploymentId;
        this.clusterId = clusterId;
    }

    public DeploymentId deploymentId() {
        return deploymentId;
    }

    public ClusterSpec.Id clusterId() {
        return clusterId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ClusterId clusterId1 = (ClusterId) o;
        return Objects.equals(deploymentId, clusterId1.deploymentId) && Objects.equals(clusterId, clusterId1.clusterId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(deploymentId, clusterId);
    }

    @Override
    public String toString() {
        return "ClusterId{" +
                "deploymentId=" + deploymentId +
                ", clusterId=" + clusterId +
                '}';
    }
}