mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
Implements patch policies #31914 - https://github.com/fleetdm/fleet/pull/40816 - https://github.com/fleetdm/fleet/pull/41248 - https://github.com/fleetdm/fleet/pull/41276 - https://github.com/fleetdm/fleet/pull/40948 - https://github.com/fleetdm/fleet/pull/40837 - https://github.com/fleetdm/fleet/pull/40956 - https://github.com/fleetdm/fleet/pull/41168 - https://github.com/fleetdm/fleet/pull/41171 - https://github.com/fleetdm/fleet/pull/40691 - https://github.com/fleetdm/fleet/pull/41524 - https://github.com/fleetdm/fleet/pull/41674 --------- Co-authored-by: Jonathan Katz <44128041+jkatz01@users.noreply.github.com> Co-authored-by: jkatz01 <yehonatankatz@gmail.com> Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Co-authored-by: Jahziel Villasana-Espinoza <jahziel@fleetdm.com>
140 lines
3.9 KiB
TypeScript
140 lines
3.9 KiB
TypeScript
import PropTypes from "prop-types";
|
|
import { CommaSeparatedPlatformString } from "interfaces/platform";
|
|
import { IScript } from "./script";
|
|
import { ILabelPolicy } from "./label";
|
|
|
|
// Legacy PropTypes used on host interface
|
|
export default PropTypes.shape({
|
|
author_email: PropTypes.string.isRequired,
|
|
author_id: PropTypes.number.isRequired,
|
|
author_name: PropTypes.string.isRequired,
|
|
created_at: PropTypes.string.isRequired,
|
|
description: PropTypes.string.isRequired,
|
|
id: PropTypes.number.isRequired,
|
|
name: PropTypes.string.isRequired,
|
|
query: PropTypes.string.isRequired,
|
|
resolution: PropTypes.string.isRequired,
|
|
critical: PropTypes.bool,
|
|
response: PropTypes.string,
|
|
team_id: PropTypes.number,
|
|
updated_at: PropTypes.string.isRequired,
|
|
});
|
|
|
|
export interface IStoredPolicyResponse {
|
|
policy: IPolicy;
|
|
}
|
|
|
|
export interface IPoliciesCountResponse {
|
|
count: number;
|
|
inherited_policy_count?: number;
|
|
}
|
|
|
|
export interface IPolicy {
|
|
id: number;
|
|
name: string;
|
|
query: string;
|
|
description: string;
|
|
author_id: number;
|
|
author_name: string;
|
|
author_email: string;
|
|
resolution: string;
|
|
platform: CommaSeparatedPlatformString;
|
|
team_id: number | null;
|
|
created_at: string;
|
|
updated_at: string;
|
|
// A critical policy cannot be "resolved later" if Okta conditional access is enabled for it
|
|
critical: boolean;
|
|
calendar_events_enabled: boolean;
|
|
conditional_access_enabled: boolean;
|
|
type: string;
|
|
install_software?: IPolicySoftwareToInstall;
|
|
run_script?: Pick<IScript, "id" | "name">;
|
|
patch_software?: IPolicySoftwareToInstall;
|
|
labels_include_any?: ILabelPolicy[];
|
|
labels_exclude_any?: ILabelPolicy[];
|
|
}
|
|
export interface IPolicySoftwareToInstall {
|
|
name: string;
|
|
display_name?: string;
|
|
software_title_id: number;
|
|
}
|
|
|
|
// Used on the manage hosts page and other places where aggregate stats are displayed
|
|
export interface IPolicyStats extends IPolicy {
|
|
passing_host_count: number;
|
|
failing_host_count: number;
|
|
host_count_updated_at: string;
|
|
webhook: string;
|
|
has_run: boolean;
|
|
next_update_ms: number;
|
|
}
|
|
|
|
export interface IPolicyWebhookPreviewPayload {
|
|
id: number;
|
|
name: string;
|
|
query: string;
|
|
description: string;
|
|
author_id: number;
|
|
author_name: string;
|
|
author_email: string;
|
|
resolution: string;
|
|
passing_host_count: number;
|
|
failing_host_count: number;
|
|
critical?: boolean;
|
|
}
|
|
|
|
export type PolicyStatusResponse = "pass" | "fail" | "";
|
|
|
|
// Used on the host details page and other places where the status of individual hosts are displayed
|
|
export interface IHostPolicy extends IPolicy {
|
|
response: PolicyStatusResponse;
|
|
}
|
|
|
|
// Policies API can return {}
|
|
export interface ILoadAllPoliciesResponse {
|
|
policies?: IPolicyStats[];
|
|
}
|
|
|
|
// Team policies API can return {}
|
|
export interface ILoadTeamPoliciesResponse {
|
|
policies?: IPolicyStats[];
|
|
}
|
|
|
|
export interface ILoadTeamPolicyResponse {
|
|
policy: IPolicyStats;
|
|
}
|
|
|
|
export interface IPolicyFormData {
|
|
description?: string | number | boolean | undefined;
|
|
resolution?: string | number | boolean | undefined;
|
|
// A critical policy cannot be "resolved later" if Okta conditional access is enabled for it
|
|
critical?: boolean;
|
|
platform?: CommaSeparatedPlatformString;
|
|
name?: string | number | boolean | undefined;
|
|
query?: string | number | boolean | undefined;
|
|
team_id?: number | null;
|
|
id?: number;
|
|
calendar_events_enabled?: boolean;
|
|
conditional_access_enabled?: boolean;
|
|
software_title_id?: number | null;
|
|
// null for PATCH to unset - note asymmetry with GET/LIST - see IPolicy.run_script
|
|
script_id?: number | null;
|
|
labels_include_any?: string[];
|
|
labels_exclude_any?: string[];
|
|
/** Required for creating patch policy */
|
|
type?: "dynamic" | "patch";
|
|
/** Required for creating patch policy */
|
|
patch_software_title_id?: number;
|
|
}
|
|
|
|
export interface IPolicyNew {
|
|
id?: number;
|
|
key?: number;
|
|
name: string;
|
|
description: string;
|
|
query: string;
|
|
resolution: string;
|
|
critical: boolean;
|
|
platform: CommaSeparatedPlatformString;
|
|
mdm_required?: boolean;
|
|
}
|