Skip to content

Commit

Permalink
[UXE-5244] feat: update url waf allowed rules (#1806)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloSF0 authored Oct 11, 2024
1 parent 67d3252 commit e5b1aa8
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { makeWafRulesAllowedBaseUrl } from './make-waf-rules-allowed-base-url'

export const createWafRulesAllowedService = async ({ payload, id }) => {
let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeWafRulesAllowedBaseUrl()}/${id}/allowed_rules`,
url: `${makeWafRulesAllowedBaseUrl()}/${id}/exceptions`,
method: 'POST',
body: adapt(payload)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const createWafRulesAllowedTuningService = async ({ attackEvents, wafId,
}

const httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/allowed_rules`,
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/exceptions`,
method: 'POST',
body: payload
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as Errors from '@/services/axios/errors'

export const deleteWafRulesAllowedService = async ({ wafId, allowedId }) => {
let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/allowed_rules/${allowedId}`,
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/exceptions/${allowedId}`,
method: 'DELETE'
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { makeWafRulesAllowedBaseUrl } from './make-waf-rules-allowed-base-url'

export const editWafRulesAllowedService = async ({ payload, wafId, allowedId }) => {
let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/allowed_rules/${allowedId}`,
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/exceptions/${allowedId}`,
method: 'PUT',
body: adapt(payload)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeWafRulesAllowedBaseUrl } from './make-waf-rules-allowed-base-url'
import { optionsRuleIds } from './ruleIdOptions'
export const listWafRulesAllowedService = async ({ wafId }) => {
let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/allowed_rules?page=1&page_size=200`,
url: `${makeWafRulesAllowedBaseUrl()}/${wafId}/exceptions?page=1&page_size=200`,
method: 'GET'
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeWafRulesAllowedBaseUrl } from './make-waf-rules-allowed-base-url'

export const loadWafRulesAllowedService = async ({ id, allowedId }) => {
let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeWafRulesAllowedBaseUrl()}/${id}/allowed_rules/${allowedId.id}`,
url: `${makeWafRulesAllowedBaseUrl()}/${id}/exceptions/${allowedId.id}`,
method: 'GET'
})
httpResponse = adapt(httpResponse)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const makeWafRulesAllowedBaseUrl = () => {
return 'v4/edge/wafs'
return 'v4/edge_firewall/wafs'
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('WafRulesServices', () => {
await sut({ payload: fixtures.wafRulesMock, id: 10 })

expect(requestSpy).toHaveBeenCalledWith({
url: 'v4/edge/wafs/10/allowed_rules',
url: 'v4/edge_firewall/wafs/10/exceptions',
method: 'POST',
body: {
match_zones: fixtures.wafRulesMock.matchZones,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('WafRulesServices', () => {
await sut({ attackEvents: bodyRequest, wafId: 10, description: fixtures.description })

expect(requestSpy).toHaveBeenCalledWith({
url: 'v4/edge/wafs/10/allowed_rules',
url: 'v4/edge_firewall/wafs/10/exceptions',
method: 'POST',
body: {
rule_id: fixtures.wafRulesMock[0].ruleId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('WafRulesServices', () => {
await sut({ wafId: wafRuleIdMock, allowedId: 10 })

expect(requestSpy).toHaveBeenCalledWith({
url: `v4/edge/wafs/765678/allowed_rules/10`,
url: `v4/edge_firewall/wafs/765678/exceptions/10`,
method: 'DELETE'
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('WafRulesServices', () => {
await sut({ payload: fixtures.wafRulesMock, wafId: 4040, allowedId: 10 })

expect(requestSpy).toHaveBeenCalledWith({
url: 'v4/edge/wafs/4040/allowed_rules/10',
url: 'v4/edge_firewall/wafs/4040/exceptions/10',
method: 'PUT',
body: {
match_zones: fixtures.wafRulesMock.matchZones,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('WafRulesServices', () => {
await sut({ wafId: 4040 })

expect(requestSpy).toHaveBeenCalledWith({
url: 'v4/edge/wafs/4040/allowed_rules?page=1&page_size=200',
url: 'v4/edge_firewall/wafs/4040/exceptions?page=1&page_size=200',
method: 'GET'
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('WafRulesService', () => {
await sut({ id: 4044, allowedId: { id: 10 } })

expect(requestSpy).toHaveBeenCalledWith({
url: 'v4/edge/wafs/4044/allowed_rules/10',
url: 'v4/edge_firewall/wafs/4044/exceptions/10',
method: 'GET'
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const makeSut = () => {
describe('WafRulesServices', () => {
it('should return the API base url to waf rules allowed service', () => {
const { sut } = makeSut()
const correctApiUrl = `v4/edge/wafs`
const correctApiUrl = `v4/edge_firewall/wafs`

const baseUrl = sut()

Expand Down

0 comments on commit e5b1aa8

Please sign in to comment.