diff --git a/packages/api-v4/.changeset/pr-13461-changed-1772617190589.md b/packages/api-v4/.changeset/pr-13461-changed-1772617190589.md new file mode 100644 index 00000000000..80c2a79bfa8 --- /dev/null +++ b/packages/api-v4/.changeset/pr-13461-changed-1772617190589.md @@ -0,0 +1,5 @@ +--- +"@linode/api-v4": Changed +--- + +Switch delivery endpoints from Beta APIv4 to APIv4 ([#13461](https://github.com/linode/manager/pull/13461)) diff --git a/packages/api-v4/src/delivery/destinations.ts b/packages/api-v4/src/delivery/destinations.ts index 1dcd4d6442c..1626a17e4de 100644 --- a/packages/api-v4/src/delivery/destinations.ts +++ b/packages/api-v4/src/delivery/destinations.ts @@ -3,7 +3,7 @@ import { updateDestinationSchema, } from '@linode/validation'; -import { BETA_API_ROOT } from '../constants'; +import { API_ROOT } from '../constants'; import Request, { setData, setMethod, @@ -28,7 +28,7 @@ import type { export const getDestination = (destinationId: number) => Request( setURL( - `${BETA_API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`, + `${API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`, ), setMethod('GET'), ); @@ -39,7 +39,7 @@ export const getDestination = (destinationId: number) => */ export const getDestinations = (params?: Params, filter?: Filter) => Request>( - setURL(`${BETA_API_ROOT}/monitor/streams/destinations`), + setURL(`${API_ROOT}/monitor/streams/destinations`), setMethod('GET'), setParams(params), setXFilter(filter), @@ -53,7 +53,7 @@ export const getDestinations = (params?: Params, filter?: Filter) => export const createDestination = (data: CreateDestinationPayload) => Request( setData(data, createDestinationSchema), - setURL(`${BETA_API_ROOT}/monitor/streams/destinations`), + setURL(`${API_ROOT}/monitor/streams/destinations`), setMethod('POST'), ); @@ -70,7 +70,7 @@ export const updateDestination = ( Request( setData(data, updateDestinationSchema), setURL( - `${BETA_API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`, + `${API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`, ), setMethod('PUT'), ); @@ -83,7 +83,7 @@ export const updateDestination = ( export const deleteDestination = (destinationId: number) => Request<{}>( setURL( - `${BETA_API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`, + `${API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`, ), setMethod('DELETE'), ); @@ -96,6 +96,6 @@ export const deleteDestination = (destinationId: number) => export const verifyDestination = (data: CreateDestinationPayload) => Request( setData(data, createDestinationSchema), - setURL(`${BETA_API_ROOT}/monitor/streams/destinations/verify`), + setURL(`${API_ROOT}/monitor/streams/destinations/verify`), setMethod('POST'), ); diff --git a/packages/api-v4/src/delivery/streams.ts b/packages/api-v4/src/delivery/streams.ts index 621bafa7247..e1a5c41f3f1 100644 --- a/packages/api-v4/src/delivery/streams.ts +++ b/packages/api-v4/src/delivery/streams.ts @@ -1,6 +1,6 @@ import { createStreamSchema, updateStreamSchema } from '@linode/validation'; -import { BETA_API_ROOT } from '../constants'; +import { API_ROOT } from '../constants'; import Request, { setData, setMethod, @@ -20,7 +20,7 @@ import type { CreateStreamPayload, Stream, UpdateStreamPayload } from './types'; */ export const getStream = (streamId: number) => Request( - setURL(`${BETA_API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`), + setURL(`${API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`), setMethod('GET'), ); @@ -30,7 +30,7 @@ export const getStream = (streamId: number) => */ export const getStreams = (params?: Params, filter?: Filter) => Request>( - setURL(`${BETA_API_ROOT}/monitor/streams`), + setURL(`${API_ROOT}/monitor/streams`), setMethod('GET'), setParams(params), setXFilter(filter), @@ -44,7 +44,7 @@ export const getStreams = (params?: Params, filter?: Filter) => export const createStream = (data: CreateStreamPayload) => Request( setData(data, createStreamSchema), - setURL(`${BETA_API_ROOT}/monitor/streams`), + setURL(`${API_ROOT}/monitor/streams`), setMethod('POST'), ); @@ -57,7 +57,7 @@ export const createStream = (data: CreateStreamPayload) => export const updateStream = (streamId: number, data: UpdateStreamPayload) => Request( setData(data, updateStreamSchema), - setURL(`${BETA_API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`), + setURL(`${API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`), setMethod('PUT'), ); @@ -68,6 +68,6 @@ export const updateStream = (streamId: number, data: UpdateStreamPayload) => */ export const deleteStream = (streamId: number) => Request<{}>( - setURL(`${BETA_API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`), + setURL(`${API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`), setMethod('DELETE'), ); diff --git a/packages/manager/.changeset/pr-13461-changed-1772617249955.md b/packages/manager/.changeset/pr-13461-changed-1772617249955.md new file mode 100644 index 00000000000..5de9a12ee9d --- /dev/null +++ b/packages/manager/.changeset/pr-13461-changed-1772617249955.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Changed +--- + +Delivery CRUD mocks update from Beta APIv4 to APIv4 ([#13461](https://github.com/linode/manager/pull/13461)) diff --git a/packages/manager/src/mocks/presets/crud/handlers/delivery.ts b/packages/manager/src/mocks/presets/crud/handlers/delivery.ts index ec62a6204e3..5b0e39e0a7e 100644 --- a/packages/manager/src/mocks/presets/crud/handlers/delivery.ts +++ b/packages/manager/src/mocks/presets/crud/handlers/delivery.ts @@ -34,7 +34,7 @@ import type { export const getStreams = () => [ http.get( - '*/v4beta/monitor/streams', + '*/v4/monitor/streams', async ({ request, }): Promise< @@ -53,7 +53,7 @@ export const getStreams = () => [ } ), http.get( - '*/v4beta/monitor/streams/:id', + '*/v4/monitor/streams/:id', async ({ params }): Promise> => { const id = Number(params.id); const stream = await mswDB.get('streams', id); @@ -69,7 +69,7 @@ export const getStreams = () => [ export const createStreams = (mockState: MockState) => [ http.post( - '*/v4beta/monitor/streams', + '*/v4/monitor/streams', async ({ request }): Promise> => { const payload = await request.clone().json(); const destinations = await mswDB.getAll('destinations'); @@ -94,7 +94,7 @@ export const createStreams = (mockState: MockState) => [ id: stream.id, label: stream.label, type: 'stream', - url: `/v4beta/delivery/streams`, + url: `/v4/delivery/streams`, }, }, mockState, @@ -108,7 +108,7 @@ export const createStreams = (mockState: MockState) => [ export const updateStream = (mockState: MockState) => [ http.put( - '*/v4beta/monitor/streams/:id', + '*/v4/monitor/streams/:id', async ({ params, request, @@ -140,7 +140,7 @@ export const updateStream = (mockState: MockState) => [ id: stream.id, label: stream.label, type: 'stream', - url: `/v4beta/monitor/streams/${stream.id}`, + url: `/v4/monitor/streams/${stream.id}`, }, }, mockState, @@ -154,7 +154,7 @@ export const updateStream = (mockState: MockState) => [ export const deleteStream = (mockState: MockState) => [ http.delete( - '*/v4beta/monitor/streams/:id', + '*/v4/monitor/streams/:id', async ({ params }): Promise> => { const id = Number(params.id); const stream = await mswDB.get('streams', id); @@ -172,7 +172,7 @@ export const deleteStream = (mockState: MockState) => [ id: stream.id, label: stream.label, type: 'domain', - url: `/v4beta/monitor/streams/${stream.id}`, + url: `/v4/monitor/streams/${stream.id}`, }, }, mockState, @@ -186,7 +186,7 @@ export const deleteStream = (mockState: MockState) => [ export const getDestinations = () => [ http.get( - '*/v4beta/monitor/streams/destinations', + '*/v4/monitor/streams/destinations', async ({ request, }): Promise< @@ -205,7 +205,7 @@ export const getDestinations = () => [ } ), http.get( - '*/v4beta/monitor/streams/destinations/:id', + '*/v4/monitor/streams/destinations/:id', async ({ params, }): Promise> => { @@ -223,7 +223,7 @@ export const getDestinations = () => [ export const createDestinations = (mockState: MockState) => [ http.post( - '*/v4beta/monitor/streams/destinations', + '*/v4/monitor/streams/destinations', async ({ request, }): Promise> => { @@ -278,7 +278,7 @@ export const createDestinations = (mockState: MockState) => [ id: destination.id, label: destination.label, type: 'destination', - url: `/v4beta/delivery/streams/destinations`, + url: `/v4/delivery/streams/destinations`, }, }, mockState, @@ -292,7 +292,7 @@ export const createDestinations = (mockState: MockState) => [ export const updateDestination = (mockState: MockState) => [ http.put( - '*/v4beta/monitor/streams/destinations/:id', + '*/v4/monitor/streams/destinations/:id', async ({ params, request, @@ -322,7 +322,7 @@ export const updateDestination = (mockState: MockState) => [ id: destination.id, label: destination.label, type: 'stream', - url: `/v4beta/monitor/streams/${destination.id}`, + url: `/v4/monitor/streams/${destination.id}`, }, }, mockState, @@ -336,7 +336,7 @@ export const updateDestination = (mockState: MockState) => [ export const deleteDestination = (mockState: MockState) => [ http.delete( - '*/v4beta/monitor/streams/destinations/:id', + '*/v4/monitor/streams/destinations/:id', async ({ params }): Promise> => { const id = Number(params.id); const destination = await mswDB.get('destinations', id); @@ -367,7 +367,7 @@ export const deleteDestination = (mockState: MockState) => [ id: destination.id, label: destination.label, type: 'domain', - url: `/v4beta/monitor/streams/${destination.id}`, + url: `/v4/monitor/streams/${destination.id}`, }, }, mockState, @@ -381,7 +381,7 @@ export const deleteDestination = (mockState: MockState) => [ export const verifyDestination = () => [ http.post( - '*/v4beta/monitor/streams/destinations/verify', + '*/v4/monitor/streams/destinations/verify', async (): Promise> => { return makeResponse({}, 200); }