Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.morpheusdata.model.system.*;
import com.morpheusdata.model.system.System;
import com.morpheusdata.response.ServiceResponse;
import com.morpheusdata.model.DriftState;
import com.morpheusdata.model.CheckLevel;

import java.util.Collection;

Expand Down Expand Up @@ -100,4 +102,24 @@ public interface SystemProvider extends PluginProvider {
* @return
*/
default ServiceResponse addSystemComponent(System system, SystemRequest systemRequest, SystemComponentType componentType) { return ServiceResponse.success(); }

public interface SystemConfigurationDriftCheckFacet extends ConfigurationDriftCheckFacet<System> {
/**
* Perform a configuration drift check on the target device. This is useful for ensuring that the
* configuration of the device matches the expected configuration stored in Morpheus.
*
* @param computeServer the target device to check for configuration drift
* @param checkLevel the level of the drift check to perform (e.g., all, update)
* @return a ServiceResponse indicating the success or failure of the configuration drift check
*/
ServiceResponse<DriftState> runConfigurationDriftCheck(CheckLevel checkLevel, System... system);

/**
* Retrieve details about the configuration that is required by a System plugin to crosscheck data against a whole system.
*
* @param computeServer the target device to check
* @return a ServiceResponse containing details about the configuration drift
*/
ServiceResponse<DriftState> getConfigurationDriftDetails(DriftState driftState, System... system);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ public class CheckLevel {
protected String code; // unique code if needed
protected String refType; // associated type of object this drift check is for
protected Long refId; // associated id of the object this drift check is for
protected CheckLevelEnum checkLevel; // level of the drift check (e.g., all, update)
protected List<String> driftRules = new ArrayList<>(); // Mandatory when checkLevel = TARGETED & ignored for other levels
protected List<String> excludeDriftRules = new ArrayList<>(); // use this if some rules need to excluded from execution when checkLevel=ALL or UPDATE
protected CheckLevelEnum checkLevel; // level of the drift check (e.g., system, update)
protected List<String> driftRules = new ArrayList<>();
protected List<String> excludeDriftRules = new ArrayList<>(); // use this if some rules need to excluded from execution when checkLevel=SYSTEM or UPDATE

/**
* Enum for levels sent during input.
* ALL = All system config
* TARGETED = specific rules given in driftRules field.
*/
public enum CheckLevelEnum { ALL, TARGETED, UPDATE }
public enum CheckLevelEnum { SYSTEM, UPDATE }

// Getters and setters
public String getCode() { return code; }
Expand All @@ -39,4 +39,4 @@ public enum CheckLevelEnum { ALL, TARGETED, UPDATE }

public List<String> getExcludeDriftRules() { return excludeDriftRules; }
public void setExcludeDriftRules(List<String> excludeDriftRules) { this.excludeDriftRules = excludeDriftRules; }
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.morpheusdata.model;

import java.time.Instant;
import java.util.List;
import java.util.ArrayList;
import java.util.List;

/**
* Represents the state of a drift check, including its status,
Expand All @@ -28,11 +28,8 @@ public enum DriftSummary { NO_DRIFT, DRIFT_DETECTED, ERROR }
/** Enum for drift check status. */
public enum DriftCheckStatus { PENDING, IN_PROGRESS, FAILED, COMPLETED }

/** Enum for rule severity. */
public enum Severity { MAJOR, WARNING, INFO }

/** Enum for rule status. */
public enum RuleStatus { PASSED, FAILED, SKIPPED }
public enum RuleStatus { PASSED, FAILED, SKIPPED, WARNING }

/**
* Drift rule result structure.
Expand All @@ -42,7 +39,6 @@ public static class DriftRuleResult {
protected String ruleName; // name
protected String ruleDescription; // additional details about the rule
protected String ruleType; // DHCI vs non-DHCI etc.
protected Severity severity; // major / warning / info
protected RuleStatus status; // passed / failed / skipped
protected String resultDescription; // failure details with embedded resource info
protected List<String> affectedObjects = new ArrayList<>(); // list of affected objects/resources
Expand All @@ -61,9 +57,6 @@ public static class DriftRuleResult {
public String getRuleType() { return ruleType; }
public void setRuleType(String ruleType) { this.ruleType = ruleType; }

public Severity getSeverity() { return severity; }
public void setSeverity(Severity severity) { this.severity = severity; }

public RuleStatus getStatus() { return status; }
public void setStatus(RuleStatus status) { this.status = status; }

Expand Down