fleet/frontend/interfaces/policy.ts

106 lines
2.6 KiB
TypeScript
Raw Normal View History

2021-11-30 18:24:30 +00:00
import PropTypes from "prop-types";
import { SelectedPlatformString } from "interfaces/platform";
2021-11-30 18:24:30 +00:00
// 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,
resoluton: PropTypes.string.isRequired,
critical: PropTypes.bool,
2021-11-30 18:24:30 +00:00
response: PropTypes.string,
team_id: PropTypes.number,
updated_at: PropTypes.string.isRequired,
});
export interface IStoredPolicyResponse {
policy: IPolicy;
}
export interface IPoliciesCountResponse {
count: number;
}
2021-08-30 23:02:53 +00:00
export interface IPolicy {
id: number;
name: string;
query: string;
description: string;
author_id: number;
author_name: string;
author_email: string;
resolution: string;
platform: SelectedPlatformString;
2021-11-30 18:24:30 +00:00
team_id?: number;
created_at: string;
updated_at: string;
critical: boolean;
2021-11-30 18:24:30 +00:00
}
// Used on the manage hosts page and other places where aggregate stats are displayed
export interface IPolicyStats extends IPolicy {
2021-08-30 23:02:53 +00:00
passing_host_count: number;
failing_host_count: number;
host_count_updated_at: string;
2021-12-28 18:07:18 +00:00
webhook: string;
has_run: boolean;
next_update_ms: number;
2021-11-30 18:24:30 +00:00
}
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" | "";
2021-11-30 18:24:30 +00:00
// Used on the host details page and other places where the status of individual hosts are displayed
export interface IHostPolicy extends IPolicy {
response: PolicyStatusResponse;
}
export interface ILoadAllPoliciesResponse {
policies: IPolicyStats[];
}
2022-11-11 21:08:03 +00:00
export interface ILoadTeamPoliciesResponse {
policies: IPolicyStats[];
inherited_policies: IPolicyStats[];
}
export interface IPolicyFormData {
description?: string | number | boolean | undefined;
resolution?: string | number | boolean | undefined;
critical?: boolean;
platform?: SelectedPlatformString;
name?: string | number | boolean | undefined;
query?: string | number | boolean | undefined;
team_id?: number;
2021-12-28 18:07:18 +00:00
id?: number;
2021-08-30 23:02:53 +00:00
}
export interface IPolicyNew {
id?: number;
key?: number;
name: string;
description: string;
query: string;
resolution: string;
critical: boolean;
platform: SelectedPlatformString;
mdm_required?: boolean;
}