From 914901e7798f722aecbef27b1cd43d97b5d1a367 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Mon, 15 Jul 2024 11:28:05 +0800 Subject: [PATCH] Swap warehouse endpoints to /platform (#27957) --- ...warehouse-access-tokens-create-mutation.ts | 2 +- ...warehouse-access-tokens-delete-mutation.ts | 2 +- .../warehouse-access-tokens-query.ts | 2 +- .../warehouse-collections-create-mutation.ts | 2 +- .../warehouse-collections-delete-mutation.ts | 9 +- .../analytics/warehouse-collections-query.ts | 2 +- .../warehouse-collections-update-mutation.ts | 2 +- apps/studio/data/analytics/warehouse-query.ts | 2 +- .../data/analytics/warehouse-tenant-query.ts | 2 +- packages/api-types/types/api.d.ts | 568 ++++++++++-------- 10 files changed, 320 insertions(+), 273 deletions(-) diff --git a/apps/studio/data/analytics/warehouse-access-tokens-create-mutation.ts b/apps/studio/data/analytics/warehouse-access-tokens-create-mutation.ts index 074db39ab90..b74f6ba139b 100644 --- a/apps/studio/data/analytics/warehouse-access-tokens-create-mutation.ts +++ b/apps/studio/data/analytics/warehouse-access-tokens-create-mutation.ts @@ -13,7 +13,7 @@ async function createWarehouseAccessToken({ description, }: WarehouseAccessTokenCreateVariables) { // TODO: remove type cast when fetcher fn params are typed - const { data, error } = await post(`/v0/projects/{ref}/analytics/warehouse/access-tokens`, { + const { data, error } = await post(`/platform/projects/{ref}/analytics/warehouse/access-tokens`, { params: { path: { ref }, }, diff --git a/apps/studio/data/analytics/warehouse-access-tokens-delete-mutation.ts b/apps/studio/data/analytics/warehouse-access-tokens-delete-mutation.ts index 0b5140cf7c7..2d931a80037 100644 --- a/apps/studio/data/analytics/warehouse-access-tokens-delete-mutation.ts +++ b/apps/studio/data/analytics/warehouse-access-tokens-delete-mutation.ts @@ -11,7 +11,7 @@ export type DeleteAccessTokenArgs = { export async function deleteWarehouseAccessToken({ projectRef, token }: DeleteAccessTokenArgs) { const { data, error } = await del( - '/v0/projects/{ref}/analytics/warehouse/access-tokens/{token}', + '/platform/projects/{ref}/analytics/warehouse/access-tokens/{token}', { params: { path: { ref: projectRef, token } } as any, } diff --git a/apps/studio/data/analytics/warehouse-access-tokens-query.ts b/apps/studio/data/analytics/warehouse-access-tokens-query.ts index e743299ca6a..282b7b43952 100644 --- a/apps/studio/data/analytics/warehouse-access-tokens-query.ts +++ b/apps/studio/data/analytics/warehouse-access-tokens-query.ts @@ -16,7 +16,7 @@ export async function getWarehouseAccessTokens( } // TODO: Remove typecast when codegen types are fixed - const response = await get(`/v0/projects/{ref}/analytics/warehouse/access-tokens`, { + const response = await get(`/platform/projects/{ref}/analytics/warehouse/access-tokens`, { params: { path: { ref: projectRef } }, signal, }) diff --git a/apps/studio/data/analytics/warehouse-collections-create-mutation.ts b/apps/studio/data/analytics/warehouse-collections-create-mutation.ts index ca0ed7153bd..c1cefea73ca 100644 --- a/apps/studio/data/analytics/warehouse-collections-create-mutation.ts +++ b/apps/studio/data/analytics/warehouse-collections-create-mutation.ts @@ -10,7 +10,7 @@ export type CreateCollectionArgs = { } export async function createCollection({ projectRef, name }: CreateCollectionArgs) { - const { data, error } = await post('/v0/projects/{ref}/analytics/warehouse/collections', { + const { data, error } = await post('/platform/projects/{ref}/analytics/warehouse/collections', { params: { path: { ref: projectRef } }, body: { name }, } as any) diff --git a/apps/studio/data/analytics/warehouse-collections-delete-mutation.ts b/apps/studio/data/analytics/warehouse-collections-delete-mutation.ts index d631aae159c..1420074960a 100644 --- a/apps/studio/data/analytics/warehouse-collections-delete-mutation.ts +++ b/apps/studio/data/analytics/warehouse-collections-delete-mutation.ts @@ -11,9 +11,12 @@ export type DeleteCollectionVariables = { } export async function deleteCollection({ projectRef, collectionToken }: DeleteCollectionVariables) { - const { data, error } = await del('/v0/projects/{ref}/analytics/warehouse/collections/{token}', { - params: { path: { ref: projectRef, token: collectionToken } } as any, - }) + const { data, error } = await del( + '/platform/projects/{ref}/analytics/warehouse/collections/{token}', + { + params: { path: { ref: projectRef, token: collectionToken } } as any, + } + ) if (error) handleError(error) return data diff --git a/apps/studio/data/analytics/warehouse-collections-query.ts b/apps/studio/data/analytics/warehouse-collections-query.ts index 7090ab82db7..75de23c686f 100644 --- a/apps/studio/data/analytics/warehouse-collections-query.ts +++ b/apps/studio/data/analytics/warehouse-collections-query.ts @@ -15,7 +15,7 @@ export async function getWarehouseCollections( } // TODO: Remove type cast when codegen types are fixed - const { data, error } = await get(`/v0/projects/{ref}/analytics/warehouse/collections`, { + const { data, error } = await get(`/platform/projects/{ref}/analytics/warehouse/collections`, { params: { path: { ref: projectRef } }, signal, }) diff --git a/apps/studio/data/analytics/warehouse-collections-update-mutation.ts b/apps/studio/data/analytics/warehouse-collections-update-mutation.ts index 702904d792b..8c85f85e162 100644 --- a/apps/studio/data/analytics/warehouse-collections-update-mutation.ts +++ b/apps/studio/data/analytics/warehouse-collections-update-mutation.ts @@ -20,7 +20,7 @@ export async function updateCollection( payload: UpdateCollectionPayload ) { const { data, error } = await patch( - '/v0/projects/{ref}/analytics/warehouse/collections/{token}', + '/platform/projects/{ref}/analytics/warehouse/collections/{token}', { params: { path: { ref: projectRef, token: collectionToken } }, body: payload, diff --git a/apps/studio/data/analytics/warehouse-query.ts b/apps/studio/data/analytics/warehouse-query.ts index a827084e14c..54c34a18414 100644 --- a/apps/studio/data/analytics/warehouse-query.ts +++ b/apps/studio/data/analytics/warehouse-query.ts @@ -16,7 +16,7 @@ export async function getWarehouseQuery( throw new Error('SQL must be provided') } - const { data, error } = await get(`/v0/projects/{ref}/analytics/warehouse/query`, { + const { data, error } = await get(`/platform/projects/{ref}/analytics/warehouse/query`, { params: { path: { ref: ref }, query: { bq_sql: sql } }, signal, } as any) diff --git a/apps/studio/data/analytics/warehouse-tenant-query.ts b/apps/studio/data/analytics/warehouse-tenant-query.ts index c83f1cce4b1..19c35c557a1 100644 --- a/apps/studio/data/analytics/warehouse-tenant-query.ts +++ b/apps/studio/data/analytics/warehouse-tenant-query.ts @@ -16,7 +16,7 @@ export async function getWarehouseTenant( if (!projectRef) { throw new Error('projectRef is required') } - const { data, error } = await get(`/v0/projects/{ref}/analytics/warehouse/tenant`, { + const { data, error } = await get(`/platform/projects/{ref}/analytics/warehouse/tenant`, { params: { path: { ref: projectRef } }, signal, }) diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.ts index d377ceec4ff..b51495042ed 100644 --- a/packages/api-types/types/api.d.ts +++ b/packages/api-types/types/api.d.ts @@ -663,6 +663,50 @@ export interface paths { /** Gets project's usage api requests count */ get: operations['UsageApiController_getApiRequestsCount'] } + '/platform/projects/{ref}/analytics/warehouse/access-tokens': { + /** Lists project's warehouse access tokens from logflare */ + get: operations['v1-list-all-warehouse-tokens'] + /** Create a warehouse access token */ + post: operations['v1-create-a-warehouse-token'] + } + '/platform/projects/{ref}/analytics/warehouse/access-tokens/{token}': { + /** Delete a warehouse access token */ + delete: operations['v1-delete-a-warehouse-token'] + } + '/platform/projects/{ref}/analytics/warehouse/collections': { + /** Lists project's warehouse collections from logflare */ + get: operations['v1-list-all-warehouse-collections'] + /** Create a warehouse collection */ + post: operations['v1-create-a-warehouse-collection'] + } + '/platform/projects/{ref}/analytics/warehouse/collections/{token}': { + /** Get a warehouse collection */ + get: operations['v1-get-a-warehouse-collection'] + /** Delete a warehouse collection */ + delete: operations['v1-delete-a-warehouse-collection'] + /** Update a warehouse collection */ + patch: operations['v1-update-a-warehouse-collection'] + } + '/platform/projects/{ref}/analytics/warehouse/endpoints': { + /** Lists project's warehouse endpoints from logflare */ + get: operations['v1-list-all-warehouse-endpoints'] + /** Create a warehouse endpoint */ + post: operations['v1-create-a-warehouse-endpoint'] + } + '/platform/projects/{ref}/analytics/warehouse/endpoints/{token}': { + /** Update a warehouse endpoint */ + put: operations['v1-update-a-warehouse-endpoint'] + /** Delete a warehouse endpoint */ + delete: operations['v1-delete-a-warehouse-endpoint'] + } + '/platform/projects/{ref}/analytics/warehouse/query': { + /** Lists project's warehouse queries from logflare */ + get: operations['v1-list-all-warehouse-queries'] + } + '/platform/projects/{ref}/analytics/warehouse/tenant': { + /** Gets project's warehouse tenant from logflare */ + get: operations['v1-provision-a-warehouse-tenant'] + } '/platform/projects/{ref}/api/graphql': { /** Queries project Graphql */ post: operations['ProjectsApiController_projectGraphql'] @@ -10692,6 +10736,268 @@ export interface operations { } } } + /** Lists project's warehouse access tokens from logflare */ + 'v1-list-all-warehouse-tokens': { + parameters: { + path: { + /** @description Project ref */ + ref: string + } + } + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFAccessToken'][] + } + } + 403: { + content: never + } + /** @description Failed to fetch warehouse access tokens */ + 500: { + content: never + } + } + } + /** Create a warehouse access token */ + 'v1-create-a-warehouse-token': { + responses: { + 201: { + content: { + 'application/json': components['schemas']['LFAccessToken'] + } + } + 403: { + content: never + } + /** @description Failed to create warehouse access token */ + 500: { + content: never + } + } + } + /** Delete a warehouse access token */ + 'v1-delete-a-warehouse-token': { + responses: { + 200: { + content: never + } + 403: { + content: never + } + /** @description Failed to delete warehouse access token */ + 500: { + content: never + } + } + } + /** Lists project's warehouse collections from logflare */ + 'v1-list-all-warehouse-collections': { + parameters: { + path: { + /** @description Project ref */ + ref: string + } + } + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFSource'][] + } + } + 403: { + content: never + } + /** @description Failed to fetch warehouse collections */ + 500: { + content: never + } + } + } + /** Create a warehouse collection */ + 'v1-create-a-warehouse-collection': { + responses: { + 201: { + content: { + 'application/json': components['schemas']['LFSource'] + } + } + 403: { + content: never + } + /** @description Failed to create warehouse collection */ + 500: { + content: never + } + } + } + /** Get a warehouse collection */ + 'v1-get-a-warehouse-collection': { + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFSource'] + } + } + 403: { + content: never + } + /** @description Failed to fetch warehouse collection */ + 500: { + content: never + } + } + } + /** Delete a warehouse collection */ + 'v1-delete-a-warehouse-collection': { + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFSource'] + } + } + 403: { + content: never + } + /** @description Failed to delete warehouse collection */ + 500: { + content: never + } + } + } + /** Update a warehouse collection */ + 'v1-update-a-warehouse-collection': { + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFSource'] + } + } + 403: { + content: never + } + /** @description Failed to update warehouse collection */ + 500: { + content: never + } + } + } + /** Lists project's warehouse endpoints from logflare */ + 'v1-list-all-warehouse-endpoints': { + parameters: { + path: { + /** @description Project ref */ + ref: string + } + } + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFEndpoint'][] + } + } + 403: { + content: never + } + /** @description Failed to fetch warehouse endpoints */ + 500: { + content: never + } + } + } + /** Create a warehouse endpoint */ + 'v1-create-a-warehouse-endpoint': { + responses: { + 201: { + content: { + 'application/json': components['schemas']['LFEndpoint'] + } + } + 403: { + content: never + } + /** @description Failed to create warehouse endpoint */ + 500: { + content: never + } + } + } + /** Update a warehouse endpoint */ + 'v1-update-a-warehouse-endpoint': { + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFEndpoint'] + } + } + 403: { + content: never + } + /** @description Failed to update warehouse endpoint */ + 500: { + content: never + } + } + } + /** Delete a warehouse endpoint */ + 'v1-delete-a-warehouse-endpoint': { + responses: { + 200: { + content: never + } + 403: { + content: never + } + /** @description Failed to delete warehouse endpoint */ + 500: { + content: never + } + } + } + /** Lists project's warehouse queries from logflare */ + 'v1-list-all-warehouse-queries': { + parameters: { + path: { + /** @description Project ref */ + ref: string + } + } + responses: { + 200: { + content: never + } + 403: { + content: never + } + /** @description Failed to fetch warehouse queries */ + 500: { + content: never + } + } + } + /** Gets project's warehouse tenant from logflare */ + 'v1-provision-a-warehouse-tenant': { + parameters: { + path: { + /** @description Project ref */ + ref: string + } + } + responses: { + 200: { + content: { + 'application/json': components['schemas']['LFUser'] + } + } + 403: { + content: never + } + /** @description Failed to fetch or provision warehouse tenant */ + 500: { + content: never + } + } + } /** Queries project Graphql */ ProjectsApiController_projectGraphql: { parameters: { @@ -13307,268 +13613,6 @@ export interface operations { } } } - /** Lists project's warehouse access tokens from logflare */ - 'v1-list-all-warehouse-tokens': { - parameters: { - path: { - /** @description Project ref */ - ref: string - } - } - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFAccessToken'][] - } - } - 403: { - content: never - } - /** @description Failed to fetch warehouse access tokens */ - 500: { - content: never - } - } - } - /** Create a warehouse access token */ - 'v1-create-a-warehouse-token': { - responses: { - 201: { - content: { - 'application/json': components['schemas']['LFAccessToken'] - } - } - 403: { - content: never - } - /** @description Failed to create warehouse access token */ - 500: { - content: never - } - } - } - /** Delete a warehouse access token */ - 'v1-delete-a-warehouse-token': { - responses: { - 200: { - content: never - } - 403: { - content: never - } - /** @description Failed to delete warehouse access token */ - 500: { - content: never - } - } - } - /** Lists project's warehouse collections from logflare */ - 'v1-list-all-warehouse-collections': { - parameters: { - path: { - /** @description Project ref */ - ref: string - } - } - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFSource'][] - } - } - 403: { - content: never - } - /** @description Failed to fetch warehouse collections */ - 500: { - content: never - } - } - } - /** Create a warehouse collection */ - 'v1-create-a-warehouse-collection': { - responses: { - 201: { - content: { - 'application/json': components['schemas']['LFSource'] - } - } - 403: { - content: never - } - /** @description Failed to create warehouse collection */ - 500: { - content: never - } - } - } - /** Get a warehouse collection */ - 'v1-get-a-warehouse-collection': { - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFSource'] - } - } - 403: { - content: never - } - /** @description Failed to fetch warehouse collection */ - 500: { - content: never - } - } - } - /** Delete a warehouse collection */ - 'v1-delete-a-warehouse-collection': { - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFSource'] - } - } - 403: { - content: never - } - /** @description Failed to delete warehouse collection */ - 500: { - content: never - } - } - } - /** Update a warehouse collection */ - 'v1-update-a-warehouse-collection': { - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFSource'] - } - } - 403: { - content: never - } - /** @description Failed to update warehouse collection */ - 500: { - content: never - } - } - } - /** Lists project's warehouse endpoints from logflare */ - 'v1-list-all-warehouse-endpoints': { - parameters: { - path: { - /** @description Project ref */ - ref: string - } - } - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFEndpoint'][] - } - } - 403: { - content: never - } - /** @description Failed to fetch warehouse endpoints */ - 500: { - content: never - } - } - } - /** Create a warehouse endpoint */ - 'v1-create-a-warehouse-endpoint': { - responses: { - 201: { - content: { - 'application/json': components['schemas']['LFEndpoint'] - } - } - 403: { - content: never - } - /** @description Failed to create warehouse endpoint */ - 500: { - content: never - } - } - } - /** Update a warehouse endpoint */ - 'v1-update-a-warehouse-endpoint': { - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFEndpoint'] - } - } - 403: { - content: never - } - /** @description Failed to update warehouse endpoint */ - 500: { - content: never - } - } - } - /** Delete a warehouse endpoint */ - 'v1-delete-a-warehouse-endpoint': { - responses: { - 200: { - content: never - } - 403: { - content: never - } - /** @description Failed to delete warehouse endpoint */ - 500: { - content: never - } - } - } - /** Lists project's warehouse queries from logflare */ - 'v1-list-all-warehouse-queries': { - parameters: { - path: { - /** @description Project ref */ - ref: string - } - } - responses: { - 200: { - content: never - } - 403: { - content: never - } - /** @description Failed to fetch warehouse queries */ - 500: { - content: never - } - } - } - /** Gets project's warehouse tenant from logflare */ - 'v1-provision-a-warehouse-tenant': { - parameters: { - path: { - /** @description Project ref */ - ref: string - } - } - responses: { - 200: { - content: { - 'application/json': components['schemas']['LFUser'] - } - } - 403: { - content: never - } - /** @description Failed to fetch or provision warehouse tenant */ - 500: { - content: never - } - } - } /** * Get metrics * @description At most 50 projects can be queried at a time.