Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
168 changes: 168 additions & 0 deletions apps/web/src/api-clients/_common/constants/api-doc-constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,101 @@
*/

export const API_DOC = {
'alert-manager': {
alert: [
'create',
'delete',
'get',
'history',
'list',
'update',
],
'escalation-policy': [
'create',
'delete',
'get',
'list',
'update',
],
event: [
'create',
],
'event-rule': [
'change-order',
'create',
'delete',
'get',
'list',
'update',
],
note: [
'create',
'delete',
'get',
'list',
'update',
],
'notification-protocol': [
'create',
'delete',
'disable',
'enable',
'get',
'list',
'update-plugin',
'update',
'verify-plugin',
],
service: [
'change-members',
'create',
'delete',
'get',
'list',
'update',
],
'service-channel': [
'create-forward-channel',
'create',
'delete',
'disable',
'enable',
'get',
'list',
'update',
],
'user-channel': [
'create',
'delete',
'disable',
'enable',
'get',
'list',
'update',
],
'user-group-channel': [
'create',
'delete',
'disable',
'enable',
'get',
'list',
'update',
],
webhook: [
'create',
'delete',
'disable',
'enable',
'get',
'list-errors',
'list',
'update-message-format',
'update-plugin',
'update',
'verify-plugin',
],
},
config: {
'domain-config': [
'create',
Expand Down Expand Up @@ -397,6 +492,79 @@ export const API_DOC = {
'analyze',
],
},
monitoring: {
alert: [
'assign-user',
'create',
'delete',
'get',
'list',
'update-state',
'update',
],
'data-source': [
'list',
],
'escalation-policy': [
'create',
'delete',
'get',
'list',
'set-default',
'update',
],
event: [
'list',
],
'event-rule': [
'change-order',
'create',
'delete',
'get',
'list',
'update',
],
log: [
'list',
],
note: [
'create',
'delete',
'get',
'list',
'update',
],
'project-alert-config': [
'create',
'delete',
'get',
'list',
'update',
],
webhook: [
'create',
'delete',
'disable',
'enable',
'get',
'list',
'update-plugin',
'update',
'verify-plugin',
],
},
notification: {
protocol: [
'create',
'delete',
'disable',
'enable',
'get',
'list',
'update-plugin',
'update',
],
},
opsflow: {
comment: [
'create',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { AlertCreateParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/create';
import type { AlertDeleteParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/delete';
import type { AlertGetParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/get';
import type { AlertHistoryParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/history';
import type { AlertListParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/list';
import type { AlertUpdateParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/update';
import type { AlertHistoryModel, AlertModel } from '@/api-clients/alert-manager/alert/schema/model';

export const useAlertApi = () => {
const actions = {
create: SpaceConnector.clientV2.alertManager.alert.create<AlertCreateParameters, AlertModel>,
delete: SpaceConnector.clientV2.alertManager.alert.delete<AlertDeleteParameters>,
get: SpaceConnector.clientV2.alertManager.alert.get<AlertGetParameters, AlertModel>,
history: SpaceConnector.clientV2.alertManager.alert.history<AlertHistoryParameters, ListResponse<AlertHistoryModel>>,
list: SpaceConnector.clientV2.alertManager.alert.list<AlertListParameters, ListResponse<AlertModel>>,
update: SpaceConnector.clientV2.alertManager.alert.update<AlertUpdateParameters, AlertModel>,
};

return {
alertAPI: actions,
};
};

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AlertResourcesType, AlertSeverityType, AlertUrgencyType } from '@/schema/alert-manager/alert/type';
import type { AlertResourcesType, AlertSeverityType, AlertUrgencyType } from '@/api-clients/alert-manager/alert/schema/type';

export interface AlertCreateParameters {
title: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
AlertSeverityType,
AlertStatusType, AlertTriggeredType,
AlertUrgencyType,
} from '@/schema/alert-manager/alert/type';
} from '@/api-clients/alert-manager/alert/schema/type';

export interface AlertListParameters {
query?: Query;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AlertUrgencyType, AlertStatusType } from '@/schema/alert-manager/alert/type';
import type { AlertUrgencyType, AlertStatusType } from '@/api-clients/alert-manager/alert/schema/type';

export interface AlertUpdateParameters {
alert_id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
AlertUrgencyType,
AlertHistoryActionType,
AlertHistoryNotificationInfoType,
} from '@/schema/alert-manager/alert/type';
} from '@/api-clients/alert-manager/alert/schema/type';

export interface AlertModel {
alert_id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
ALERT_SEVERITY, ALERT_STATUS, ALERT_TRIGGERED_TYPE, ALERT_URGENCY,
ALERT_HISTORY_ACTION,
ALERT_HISTORY_NOTIFICATION_STATE,
} from '@/schema/alert-manager/alert/constants';
} from '@/api-clients/alert-manager/alert/schema/constants';

export type AlertStatusType = typeof ALERT_STATUS[keyof typeof ALERT_STATUS];
export type AlertUrgencyType = typeof ALERT_URGENCY[keyof typeof ALERT_URGENCY];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { EscalationPolicyCreateParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/create';
import type { EscalationPolicyDeleteParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/delete';
import type { EscalationPolicyGetParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/get';
import type { EscalationPolicyListParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/list';
import type { EscalationPolicyUpdateParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/update';
import type { EscalationPolicyModel } from '@/api-clients/alert-manager/escalation-policy/schema/model';

export const useEscalationPolicyApi = () => {
const actions = {
create: SpaceConnector.clientV2.alertManager.escalationPolicy.create<EscalationPolicyCreateParameters, EscalationPolicyModel>,
delete: SpaceConnector.clientV2.alertManager.escalationPolicy.delete<EscalationPolicyDeleteParameters>,
get: SpaceConnector.clientV2.alertManager.escalationPolicy.get<EscalationPolicyGetParameters, EscalationPolicyModel>,
list: SpaceConnector.clientV2.alertManager.escalationPolicy.list<EscalationPolicyListParameters, ListResponse<EscalationPolicyModel>>,
update: SpaceConnector.clientV2.alertManager.escalationPolicy.update<EscalationPolicyUpdateParameters, EscalationPolicyModel>,
};

return {
escalationPolicyAPI: actions,
};
};

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
EscalationPolicyFinishConditionType,
EscalationPolicyRepeatType,
EscalationPolicyRulesType,
} from '@/schema/alert-manager/escalation-policy/type';
} from '@/api-clients/alert-manager/escalation-policy/schema/type';

export interface EscalationPolicyCreateParameters {
name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';

import type { EscalationPolicyFinishConditionType } from '@/schema/alert-manager/escalation-policy/type';
import type { EscalationPolicyFinishConditionType } from '@/api-clients/alert-manager/escalation-policy/schema/type';

export interface EscalationPolicyListParameters {
query?: Query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
EscalationPolicyFinishConditionType,
EscalationPolicyRepeatType,
EscalationPolicyRulesType,
} from '@/schema/alert-manager/escalation-policy/type';
} from '@/api-clients/alert-manager/escalation-policy/schema/type';

export interface EscalationPolicyUpdateParameters {
escalation_policy_id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
EscalationPolicyFinishConditionType,
EscalationPolicyRepeatType,
EscalationPolicyRulesType,
} from '@/schema/alert-manager/escalation-policy/type';
} from '@/api-clients/alert-manager/escalation-policy/schema/type';

export interface EscalationPolicyModel {
escalation_policy_id: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
ESCALATION_POLICY_FINISH_CONDITION,
ESCALATION_POLICY_STATE,
} from '@/schema/alert-manager/escalation-policy/constants';
} from '@/api-clients/alert-manager/escalation-policy/schema/constants';

export type EscalationPolicyStateType = typeof ESCALATION_POLICY_STATE[keyof typeof ESCALATION_POLICY_STATE];
export type EscalationPolicyFinishConditionType = typeof ESCALATION_POLICY_FINISH_CONDITION[keyof typeof ESCALATION_POLICY_FINISH_CONDITION];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { EventRuleChangeOrderParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/change-order';
import type { EventRuleCreateParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/create';
import type { EventRuleDeleteParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/delete';
import type { EventRuleGetParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/get';
import type { EventRuleListParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/list';
import type { EventRuleUpdateParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/update';
import type { EventRuleModel } from '@/api-clients/alert-manager/event-rule/schema/model';

export const useEventRuleApi = () => {
const actions = {
changeOrder: SpaceConnector.clientV2.alertManager.eventRule.changeOrder<EventRuleChangeOrderParameters, EventRuleModel>,
create: SpaceConnector.clientV2.alertManager.eventRule.create<EventRuleCreateParameters, EventRuleModel>,
delete: SpaceConnector.clientV2.alertManager.eventRule.delete<EventRuleDeleteParameters>,
get: SpaceConnector.clientV2.alertManager.eventRule.get<EventRuleGetParameters, EventRuleModel>,
list: SpaceConnector.clientV2.alertManager.eventRule.list<EventRuleListParameters, ListResponse<EventRuleModel>>,
update: SpaceConnector.clientV2.alertManager.eventRule.update<EventRuleUpdateParameters, EventRuleModel>,
};

return {
eventRuleAPI: actions,
};
};

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
EventRuleConditionsPolicyType,
EventRuleConditionsType, EventRuleOptions,
EventRuleScopeType,
} from '@/schema/alert-manager/event-rule/type';
} from '@/api-clients/alert-manager/event-rule/schema/type';

export interface EventRuleCreateParameters {
name?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
EventRuleActionsType,
EventRuleConditionsPolicyType,
EventRuleConditionsType, EventRuleOptions,
} from '@/schema/alert-manager/event-rule/type';
} from '@/api-clients/alert-manager/event-rule/schema/type';

export interface EventRuleUpdateParameters {
event_rule_id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
EventRuleConditionsType,
EventRuleOptions,
EventRuleScopeType,
} from '@/schema/alert-manager/event-rule/type';
} from '@/api-clients/alert-manager/event-rule/schema/type';

export interface EventRuleModel {
event_rule_id: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AlertStatusType } from '@/schema/alert-manager/alert/type';
import type { EVENT_RULE_CONDITIONS_POLICY, EVENT_RULE_URGENCY, EVENT_RULE_SCOPE } from '@/schema/alert-manager/event-rule/constant';
import type { AlertStatusType } from '@/api-clients/alert-manager/alert/schema/type';
import type { EVENT_RULE_CONDITIONS_POLICY, EVENT_RULE_URGENCY, EVENT_RULE_SCOPE } from '@/api-clients/alert-manager/event-rule/schema/constants';

export type EventRuleConditionsPolicyType = typeof EVENT_RULE_CONDITIONS_POLICY[keyof typeof EVENT_RULE_CONDITIONS_POLICY];
export type EventRuleUrgencyType = typeof EVENT_RULE_URGENCY[keyof typeof EVENT_RULE_URGENCY];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import type { EventCreateParameters } from '@/api-clients/alert-manager/event/schema/api-verbs/create';
import type { EventModel } from '@/api-clients/alert-manager/event/schema/model';

export const useEventApi = () => {
const actions = {
create: SpaceConnector.clientV2.alertManager.event.create<EventCreateParameters, EventModel>,
};

return {
eventAPI: actions,
};
};

Loading
Loading