2021-04-14 16:52:15 +00:00
|
|
|
import PropTypes from "prop-types";
|
2021-08-16 14:30:19 +00:00
|
|
|
import enrollSecretInterface, { IEnrollSecret } from "./enroll_secret";
|
2022-06-13 23:21:24 +00:00
|
|
|
import { IIntegrations } from "./integration";
|
|
|
|
|
import { IWebhookFailingPolicies } from "./webhook";
|
2021-04-09 10:44:57 +00:00
|
|
|
|
|
|
|
|
export default PropTypes.shape({
|
2021-08-16 14:30:19 +00:00
|
|
|
id: PropTypes.number.isRequired,
|
|
|
|
|
created_at: PropTypes.string,
|
|
|
|
|
name: PropTypes.string.isRequired,
|
2021-05-12 13:06:39 +00:00
|
|
|
description: PropTypes.string,
|
2021-06-10 14:00:03 +00:00
|
|
|
agent_options: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
2021-08-16 14:30:19 +00:00
|
|
|
role: PropTypes.string, // role value is included when the team is in the context of a user
|
|
|
|
|
user_count: PropTypes.number,
|
|
|
|
|
host_count: PropTypes.number,
|
|
|
|
|
secrets: PropTypes.arrayOf(enrollSecretInterface),
|
2021-04-09 10:44:57 +00:00
|
|
|
});
|
|
|
|
|
|
2021-04-29 13:47:33 +00:00
|
|
|
/**
|
2022-07-19 19:28:06 +00:00
|
|
|
* The id, name, description, and host count for a team entity
|
2021-04-29 13:47:33 +00:00
|
|
|
*/
|
2022-01-18 15:17:44 +00:00
|
|
|
export interface ITeamSummary {
|
2021-03-24 13:18:56 +00:00
|
|
|
id: number;
|
2022-01-18 15:17:44 +00:00
|
|
|
name: string;
|
|
|
|
|
description?: string;
|
2022-03-16 15:01:35 +00:00
|
|
|
host_count?: number;
|
2022-01-18 15:17:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-06-13 23:21:24 +00:00
|
|
|
* The shape of a team entity excluding integrations and webhook settings
|
2022-01-18 15:17:44 +00:00
|
|
|
*/
|
|
|
|
|
export interface ITeam extends ITeamSummary {
|
2021-12-16 18:09:10 +00:00
|
|
|
uuid?: string;
|
2021-09-10 19:06:37 +00:00
|
|
|
display_text?: string;
|
|
|
|
|
count?: number;
|
2021-08-16 14:30:19 +00:00
|
|
|
created_at?: string;
|
2022-04-11 21:46:35 +00:00
|
|
|
agent_options?: {
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
};
|
2022-03-16 15:01:35 +00:00
|
|
|
user_count?: number;
|
|
|
|
|
host_count?: number;
|
2021-08-16 14:30:19 +00:00
|
|
|
secrets?: IEnrollSecret[];
|
|
|
|
|
role?: string; // role value is included when the team is in the context of a user
|
2021-03-24 13:18:56 +00:00
|
|
|
}
|
2021-04-29 13:47:33 +00:00
|
|
|
|
2022-06-13 23:21:24 +00:00
|
|
|
/**
|
|
|
|
|
* The integrations and webhook settings of a team
|
|
|
|
|
*/
|
|
|
|
|
export interface ITeamAutomationsConfig {
|
|
|
|
|
webhook_settings: {
|
|
|
|
|
failing_policies_webhook: IWebhookFailingPolicies;
|
|
|
|
|
};
|
|
|
|
|
integrations: IIntegrations;
|
2022-04-11 21:46:35 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-13 23:21:24 +00:00
|
|
|
/**
|
|
|
|
|
* The shape of a team entity including integrations and webhook settings
|
|
|
|
|
*/
|
|
|
|
|
export type ITeamConfig = ITeam & ITeamAutomationsConfig;
|
|
|
|
|
|
2021-04-29 13:47:33 +00:00
|
|
|
/**
|
|
|
|
|
* The shape of a new member to add to a team
|
|
|
|
|
*/
|
|
|
|
|
interface INewMember {
|
|
|
|
|
id: number;
|
|
|
|
|
role: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The shape of the body expected from the API when adding new members to teams
|
|
|
|
|
*/
|
|
|
|
|
export interface INewMembersBody {
|
|
|
|
|
users: INewMember[];
|
|
|
|
|
}
|
|
|
|
|
export interface IRemoveMembersBody {
|
2022-01-13 23:11:45 +00:00
|
|
|
users: { id?: number }[];
|
2021-04-29 13:47:33 +00:00
|
|
|
}
|
2021-11-15 21:16:06 +00:00
|
|
|
interface INewTeamSecret {
|
|
|
|
|
team_id: number;
|
|
|
|
|
secret: string;
|
|
|
|
|
created_at?: string;
|
|
|
|
|
}
|
|
|
|
|
export interface INewTeamSecretBody {
|
|
|
|
|
secrets: INewTeamSecret[];
|
|
|
|
|
}
|
|
|
|
|
export interface IRemoveTeamSecretBody {
|
|
|
|
|
secrets: { secret: string }[];
|
|
|
|
|
}
|