Skip to content

Commit 4fc0922

Browse files
committed
feat: integrate custom detection rule operations and update secure score resource handling
1 parent 8ce1603 commit 4fc0922

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

nodes/Msgraphsecurity/Msgraphsecurity.node.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NodeConnectionTypes, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
22
import { secureScoreDescription } from './resources/secureScore';
3-
import { getManySecureScoreDescription } from './resources/secureScore/getMany';
3+
import { detectionRuleDescription } from './resources/detectionRule';
44

55
export class Msgraphsecurity implements INodeType {
66
description: INodeTypeDescription = {
@@ -32,6 +32,11 @@ export class Msgraphsecurity implements INodeType {
3232
type: 'options',
3333
noDataExpression: true,
3434
options: [
35+
{
36+
name: 'Custom Detection Rule',
37+
value: 'customDetectionRule',
38+
description: 'Operations on custom detection rules',
39+
},
3540
{
3641
name: 'Secure Score',
3742
value: 'secureScore',
@@ -41,7 +46,7 @@ export class Msgraphsecurity implements INodeType {
4146
default: 'secureScore',
4247
},
4348
...secureScoreDescription,
44-
...getManySecureScoreDescription,
49+
...detectionRuleDescription,
4550
],
4651
};
4752
}

nodes/Msgraphsecurity/resources/detectionRule/getAll.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { INodeProperties } from "n8n-workflow";
22
import { commonOdataProperties } from "../../shared/odataProperties";
33

44
const showOnlyIfResourceIsGetAllDetectionRule = {
5-
operation: ['getAll'],
6-
resource: ['detectionRule'],
7-
}
5+
resource: ['customDetectionRule'],
6+
operation: ['getAll'],
7+
};
88

99
export const getAllDetectionRuleDescription: INodeProperties[] = [
1010
{

nodes/Msgraphsecurity/resources/detectionRule/index.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { INodeProperties } from 'n8n-workflow';
22
import { getOneDetectionRuleDescription } from './getOne';
33
import { createDetectionRuleDescription } from './create';
44
import { deleteDetectionRuleDescription } from './delete';
5+
import { getAllDetectionRuleDescription } from './getAll';
56

67
const showIfDetectionRuleOperation = {
7-
operation: ['detectionRule'],
8+
resource: ['customDetectionRule'],
89
};
910

1011
export const detectionRuleDescription: INodeProperties[] = [
@@ -25,7 +26,7 @@ export const detectionRuleDescription: INodeProperties[] = [
2526
routing: {
2627
request: {
2728
method: 'GET',
28-
url: '/security/rules/detectionRules/{{ $parameter.detectionRuleId }}',
29+
url: '/rules/detectionRules/{{ $parameter.detectionRuleId }}',
2930
},
3031
},
3132
},
@@ -37,7 +38,7 @@ export const detectionRuleDescription: INodeProperties[] = [
3738
routing: {
3839
request: {
3940
method: 'GET',
40-
url: '/security/rules/detectionRules',
41+
url: '/rules/detectionRules',
4142
},
4243
},
4344
},
@@ -49,7 +50,7 @@ export const detectionRuleDescription: INodeProperties[] = [
4950
routing: {
5051
request: {
5152
method: 'POST',
52-
url: '/security/rules/detectionRules',
53+
url: '/rules/detectionRules',
5354
},
5455
},
5556
},
@@ -61,14 +62,15 @@ export const detectionRuleDescription: INodeProperties[] = [
6162
routing: {
6263
request: {
6364
method: 'DELETE',
64-
url: '/security/rules/detectionRules/{{ $parameter.detectionRuleId }}',
65+
url: '/rules/detectionRules/{{ $parameter.detectionRuleId }}',
6566
},
6667
},
6768
},
6869
],
6970
default: 'getAll',
70-
...getOneDetectionRuleDescription,
71-
...createDetectionRuleDescription,
72-
...deleteDetectionRuleDescription,
7371
},
72+
...getOneDetectionRuleDescription,
73+
...createDetectionRuleDescription,
74+
...deleteDetectionRuleDescription,
75+
...getAllDetectionRuleDescription,
7476
];

nodes/Msgraphsecurity/resources/secureScore/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { INodeProperties } from 'n8n-workflow';
2+
import { getManySecureScoreDescription } from './getMany';
23

34
const showOnlyIfOperationIsSecureScore = {
45
resource: ['secureScore'],
@@ -41,4 +42,5 @@ export const secureScoreDescription: INodeProperties[] = [
4142
],
4243
default: 'get',
4344
},
45+
...getManySecureScoreDescription,
4446
];

0 commit comments

Comments
 (0)