Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/api-v4/.changeset/pr-13461-changed-1772617190589.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Changed
---

Switch delivery endpoints from Beta APIv4 to APIv4 ([#13461](https://github.com/linode/manager/pull/13461))
14 changes: 7 additions & 7 deletions packages/api-v4/src/delivery/destinations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
updateDestinationSchema,
} from '@linode/validation';

import { BETA_API_ROOT } from '../constants';
import { API_ROOT } from '../constants';
import Request, {
setData,
setMethod,
Expand All @@ -28,7 +28,7 @@ import type {
export const getDestination = (destinationId: number) =>
Request<Destination>(
setURL(
`${BETA_API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`,
`${API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`,
),
setMethod('GET'),
);
Expand All @@ -39,7 +39,7 @@ export const getDestination = (destinationId: number) =>
*/
export const getDestinations = (params?: Params, filter?: Filter) =>
Request<Page<Destination>>(
setURL(`${BETA_API_ROOT}/monitor/streams/destinations`),
setURL(`${API_ROOT}/monitor/streams/destinations`),
setMethod('GET'),
setParams(params),
setXFilter(filter),
Expand All @@ -53,7 +53,7 @@ export const getDestinations = (params?: Params, filter?: Filter) =>
export const createDestination = (data: CreateDestinationPayload) =>
Request<Destination>(
setData(data, createDestinationSchema),
setURL(`${BETA_API_ROOT}/monitor/streams/destinations`),
setURL(`${API_ROOT}/monitor/streams/destinations`),
setMethod('POST'),
);

Expand All @@ -70,7 +70,7 @@ export const updateDestination = (
Request<Destination>(
setData(data, updateDestinationSchema),
setURL(
`${BETA_API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`,
`${API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`,
),
setMethod('PUT'),
);
Expand All @@ -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'),
);
Expand All @@ -96,6 +96,6 @@ export const deleteDestination = (destinationId: number) =>
export const verifyDestination = (data: CreateDestinationPayload) =>
Request<Destination>(
setData(data, createDestinationSchema),
setURL(`${BETA_API_ROOT}/monitor/streams/destinations/verify`),
setURL(`${API_ROOT}/monitor/streams/destinations/verify`),
setMethod('POST'),
);
12 changes: 6 additions & 6 deletions packages/api-v4/src/delivery/streams.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -20,7 +20,7 @@ import type { CreateStreamPayload, Stream, UpdateStreamPayload } from './types';
*/
export const getStream = (streamId: number) =>
Request<Stream>(
setURL(`${BETA_API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`),
setURL(`${API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`),
setMethod('GET'),
);

Expand All @@ -30,7 +30,7 @@ export const getStream = (streamId: number) =>
*/
export const getStreams = (params?: Params, filter?: Filter) =>
Request<Page<Stream>>(
setURL(`${BETA_API_ROOT}/monitor/streams`),
setURL(`${API_ROOT}/monitor/streams`),
setMethod('GET'),
setParams(params),
setXFilter(filter),
Expand All @@ -44,7 +44,7 @@ export const getStreams = (params?: Params, filter?: Filter) =>
export const createStream = (data: CreateStreamPayload) =>
Request<Stream>(
setData(data, createStreamSchema),
setURL(`${BETA_API_ROOT}/monitor/streams`),
setURL(`${API_ROOT}/monitor/streams`),
setMethod('POST'),
);

Expand All @@ -57,7 +57,7 @@ export const createStream = (data: CreateStreamPayload) =>
export const updateStream = (streamId: number, data: UpdateStreamPayload) =>
Request<Stream>(
setData(data, updateStreamSchema),
setURL(`${BETA_API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`),
setURL(`${API_ROOT}/monitor/streams/${encodeURIComponent(streamId)}`),
setMethod('PUT'),
);

Expand All @@ -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'),
);
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13461-changed-1772617249955.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Delivery CRUD mocks update from Beta APIv4 to APIv4 ([#13461](https://github.com/linode/manager/pull/13461))
34 changes: 17 additions & 17 deletions packages/manager/src/mocks/presets/crud/handlers/delivery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

export const getStreams = () => [
http.get(
'*/v4beta/monitor/streams',
'*/v4/monitor/streams',
async ({
request,
}): Promise<
Expand All @@ -53,7 +53,7 @@
}
),
http.get(
'*/v4beta/monitor/streams/:id',
'*/v4/monitor/streams/:id',

Check warning on line 56 in packages/manager/src/mocks/presets/crud/handlers/delivery.ts

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Define a constant instead of duplicating this literal 3 times. Raw Output: {"ruleId":"sonarjs/no-duplicate-string","severity":1,"message":"Define a constant instead of duplicating this literal 3 times.","line":56,"column":5,"nodeType":"Literal","endLine":56,"endColumn":31}
async ({ params }): Promise<StrictResponse<APIErrorResponse | Stream>> => {
const id = Number(params.id);
const stream = await mswDB.get('streams', id);
Expand All @@ -69,7 +69,7 @@

export const createStreams = (mockState: MockState) => [
http.post(
'*/v4beta/monitor/streams',
'*/v4/monitor/streams',
async ({ request }): Promise<StrictResponse<APIErrorResponse | Stream>> => {
const payload = await request.clone().json();
const destinations = await mswDB.getAll('destinations');
Expand All @@ -94,7 +94,7 @@
id: stream.id,
label: stream.label,
type: 'stream',
url: `/v4beta/delivery/streams`,
url: `/v4/delivery/streams`,
},
},
mockState,
Expand All @@ -108,7 +108,7 @@

export const updateStream = (mockState: MockState) => [
http.put(
'*/v4beta/monitor/streams/:id',
'*/v4/monitor/streams/:id',
async ({
params,
request,
Expand Down Expand Up @@ -140,7 +140,7 @@
id: stream.id,
label: stream.label,
type: 'stream',
url: `/v4beta/monitor/streams/${stream.id}`,
url: `/v4/monitor/streams/${stream.id}`,
},
},
mockState,
Expand All @@ -154,7 +154,7 @@

export const deleteStream = (mockState: MockState) => [
http.delete(
'*/v4beta/monitor/streams/:id',
'*/v4/monitor/streams/:id',
async ({ params }): Promise<StrictResponse<APIErrorResponse | {}>> => {
const id = Number(params.id);
const stream = await mswDB.get('streams', id);
Expand All @@ -172,7 +172,7 @@
id: stream.id,
label: stream.label,
type: 'domain',
url: `/v4beta/monitor/streams/${stream.id}`,
url: `/v4/monitor/streams/${stream.id}`,
},
},
mockState,
Expand All @@ -186,7 +186,7 @@

export const getDestinations = () => [
http.get(
'*/v4beta/monitor/streams/destinations',
'*/v4/monitor/streams/destinations',
async ({
request,
}): Promise<
Expand All @@ -205,7 +205,7 @@
}
),
http.get(
'*/v4beta/monitor/streams/destinations/:id',
'*/v4/monitor/streams/destinations/:id',

Check warning on line 208 in packages/manager/src/mocks/presets/crud/handlers/delivery.ts

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Define a constant instead of duplicating this literal 3 times. Raw Output: {"ruleId":"sonarjs/no-duplicate-string","severity":1,"message":"Define a constant instead of duplicating this literal 3 times.","line":208,"column":5,"nodeType":"Literal","endLine":208,"endColumn":44}
async ({
params,
}): Promise<StrictResponse<APIErrorResponse | Destination>> => {
Expand All @@ -223,7 +223,7 @@

export const createDestinations = (mockState: MockState) => [
http.post(
'*/v4beta/monitor/streams/destinations',
'*/v4/monitor/streams/destinations',
async ({
request,
}): Promise<StrictResponse<APIErrorResponse | Destination>> => {
Expand Down Expand Up @@ -278,7 +278,7 @@
id: destination.id,
label: destination.label,
type: 'destination',
url: `/v4beta/delivery/streams/destinations`,
url: `/v4/delivery/streams/destinations`,
},
},
mockState,
Expand All @@ -292,7 +292,7 @@

export const updateDestination = (mockState: MockState) => [
http.put(
'*/v4beta/monitor/streams/destinations/:id',
'*/v4/monitor/streams/destinations/:id',
async ({
params,
request,
Expand Down Expand Up @@ -322,7 +322,7 @@
id: destination.id,
label: destination.label,
type: 'stream',
url: `/v4beta/monitor/streams/${destination.id}`,
url: `/v4/monitor/streams/${destination.id}`,
},
},
mockState,
Expand All @@ -336,7 +336,7 @@

export const deleteDestination = (mockState: MockState) => [
http.delete(
'*/v4beta/monitor/streams/destinations/:id',
'*/v4/monitor/streams/destinations/:id',
async ({ params }): Promise<StrictResponse<APIErrorResponse | {}>> => {
const id = Number(params.id);
const destination = await mswDB.get('destinations', id);
Expand Down Expand Up @@ -367,7 +367,7 @@
id: destination.id,
label: destination.label,
type: 'domain',
url: `/v4beta/monitor/streams/${destination.id}`,
url: `/v4/monitor/streams/${destination.id}`,
},
},
mockState,
Expand All @@ -381,7 +381,7 @@

export const verifyDestination = () => [
http.post(
'*/v4beta/monitor/streams/destinations/verify',
'*/v4/monitor/streams/destinations/verify',
async (): Promise<StrictResponse<APIErrorResponse | {}>> => {
return makeResponse({}, 200);
}
Expand Down