Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.yahoo.vespa.hosted.controller.api.integration.vcmr.VespaChangeRequest Maven / Gradle / Ivy
// 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.integration.vcmr;
import com.yahoo.config.provision.zone.ZoneId;
import java.util.List;
import java.util.Objects;
/**
* @author olaa
*/
public class VespaChangeRequest extends ChangeRequest {
private final Status status;
private final ZoneId zoneId;
// TODO: Create applicationActionPlan
private final List hostActionPlan;
public VespaChangeRequest(String id, ChangeRequestSource changeRequestSource, List impactedSwitches, List impactedHosts, Approval approval, Impact impact, Status status, List hostActionPlan, ZoneId zoneId) {
super(id, changeRequestSource, impactedSwitches, impactedHosts, approval, impact);
this.status = status;
this.hostActionPlan = hostActionPlan;
this.zoneId = zoneId;
}
public VespaChangeRequest(ChangeRequest changeRequest, ZoneId zoneId) {
this(changeRequest.getId(), changeRequest.getChangeRequestSource(), changeRequest.getImpactedSwitches(),
changeRequest.getImpactedHosts(), changeRequest.getApproval(), changeRequest.getImpact(), Status.PENDING_ASSESSMENT, List.of(), zoneId);
}
public Status getStatus() {
return status;
}
public List getHostActionPlan() {
return hostActionPlan;
}
public ZoneId getZoneId() {
return zoneId;
}
public VespaChangeRequest withStatus(Status status) {
return new VespaChangeRequest(getId(), getChangeRequestSource(), getImpactedSwitches(), getImpactedHosts(), getApproval(), getImpact(), status, hostActionPlan, zoneId);
}
public VespaChangeRequest withSource(ChangeRequestSource source) {
return new VespaChangeRequest(getId(), source, getImpactedSwitches(), getImpactedHosts(), getApproval(), getImpact(), status, hostActionPlan, zoneId);
}
public VespaChangeRequest withImpact(Impact impact) {
return new VespaChangeRequest(getId(), getChangeRequestSource(), getImpactedSwitches(), getImpactedHosts(), getApproval(), impact, status, hostActionPlan, zoneId);
}
public VespaChangeRequest withApproval(Approval approval) {
return new VespaChangeRequest(getId(), getChangeRequestSource(), getImpactedSwitches(), getImpactedHosts(), approval, getImpact(), status, hostActionPlan, zoneId);
}
public VespaChangeRequest withActionPlan(List hostActionPlan) {
return new VespaChangeRequest(getId(), getChangeRequestSource(), getImpactedSwitches(), getImpactedHosts(), getApproval(), getImpact(), status, hostActionPlan, zoneId);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
VespaChangeRequest that = (VespaChangeRequest) o;
return status == that.status &&
Objects.equals(hostActionPlan, that.hostActionPlan) &&
Objects.equals(zoneId, that.zoneId);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), status, hostActionPlan, zoneId);
}
@Override
public String toString() {
return "VespaChangeRequest{" +
"id='" + getId() + '\'' +
", changeRequestSource=" + getChangeRequestSource() +
", impactedSwitches=" + getImpactedSwitches() +
", impactedHosts=" + getImpactedHosts() +
", approval=" + getApproval() +
", impact=" + getImpact() +
", status=" + status +
", zoneId=" + zoneId +
", hostActionPlan=" + hostActionPlan +
'}';
}
public enum Status {
COMPLETED,
READY,
IN_PROGRESS,
PENDING_ACTION,
PENDING_ASSESSMENT,
REQUIRES_OPERATOR_ACTION,
OUT_OF_SYNC,
NOOP
}
}