create_corp_rule
Define and implement corporation-level rules for Fastly NGWAF by specifying conditions, actions, and scope to enhance web application security and manage traffic effectively.
Instructions
Create a corporation-level rule
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | Yes | Rule actions | |
| conditions | Yes | Rule conditions | |
| corpName | No | Corporation name (uses context default if not provided) | |
| corpScope | No | Rule scope | |
| enabled | No | Whether rule is enabled | |
| groupOperator | Yes | Condition group operator | |
| reason | No | Description of the rule | |
| signal | No | Signal ID for exclusion rules | |
| siteNames | No | Site names for specific scope | |
| type | Yes | Rule type |
Implementation Reference
- server.js:959-973 (handler)Handler logic in the main request handler switch statement that processes arguments, resolves context, builds the rule payload, and calls the client method to create the corp rule.case 'create_corp_rule': const { corpName: corpForCorpRule } = resolveContext(typedArgs); const corpRuleData = { type: typedArgs.type, enabled: typedArgs.enabled, groupOperator: typedArgs.groupOperator, conditions: typedArgs.conditions, actions: typedArgs.actions, reason: typedArgs.reason, signal: typedArgs.signal, corpScope: typedArgs.corpScope, siteNames: typedArgs.siteNames, }; result = await client.createCorpRule(corpForCorpRule, corpRuleData); break;
- server.js:565-580 (schema)Input schema defining parameters and validation for the create_corp_rule tool.inputSchema: { type: 'object', properties: { corpName: { type: 'string', description: 'Corporation name (uses context default if not provided)' }, type: { type: 'string', enum: ['request', 'signal'], description: 'Rule type' }, enabled: { type: 'boolean', description: 'Whether rule is enabled' }, groupOperator: { type: 'string', enum: ['all', 'any'], description: 'Condition group operator' }, conditions: { type: 'array', description: 'Rule conditions' }, actions: { type: 'array', description: 'Rule actions' }, reason: { type: 'string', description: 'Description of the rule' }, signal: { type: 'string', description: 'Signal ID for exclusion rules' }, corpScope: { type: 'string', enum: ['global', 'specificSites'], description: 'Rule scope' }, siteNames: { type: 'array', items: { type: 'string' }, description: 'Site names for specific scope' }, }, required: ['type', 'groupOperator', 'conditions', 'actions'], },
- server.js:562-581 (registration)Tool definition object added to the tools list, which is returned by ListToolsRequestHandler, effectively registering the tool.{ name: 'create_corp_rule', description: 'Create a corporation-level rule', inputSchema: { type: 'object', properties: { corpName: { type: 'string', description: 'Corporation name (uses context default if not provided)' }, type: { type: 'string', enum: ['request', 'signal'], description: 'Rule type' }, enabled: { type: 'boolean', description: 'Whether rule is enabled' }, groupOperator: { type: 'string', enum: ['all', 'any'], description: 'Condition group operator' }, conditions: { type: 'array', description: 'Rule conditions' }, actions: { type: 'array', description: 'Rule actions' }, reason: { type: 'string', description: 'Description of the rule' }, signal: { type: 'string', description: 'Signal ID for exclusion rules' }, corpScope: { type: 'string', enum: ['global', 'specificSites'], description: 'Rule scope' }, siteNames: { type: 'array', items: { type: 'string' }, description: 'Site names for specific scope' }, }, required: ['type', 'groupOperator', 'conditions', 'actions'], }, },
- server.js:118-121 (helper)Helper method in FastlyNGWAFClient class that performs the actual API POST request to create a corporation rule.async createCorpRule(corpName, ruleData) { const response = await this.api.post(`/corps/${corpName}/rules`, ruleData); return response.data; }