-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spline #1155 Foxx :: split routes into "producer", "consumer" and "ad…
…min" sub-routes
- Loading branch information
Showing
19 changed files
with
228 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { adminRouter } from './admin-router' | ||
|
||
|
||
export default adminRouter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { createRouter } from '@arangodb/foxx' | ||
|
||
import { plansRouter } from './plans-router' | ||
import { eventsRouter } from './events-router' | ||
import { operationsRouter } from './operations-router' | ||
|
||
|
||
const consumerRouter: Foxx.Router = createRouter() | ||
|
||
consumerRouter.use('/execution-plans', plansRouter) | ||
consumerRouter.use('/execution-events', eventsRouter) | ||
consumerRouter.use('/operations', operationsRouter) | ||
|
||
export default consumerRouter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
arangodb-foxx-services/src/main/routes/consumer/plans-router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { createRouter } from '@arangodb/foxx' | ||
import { DataSourceActionType } from '../../../external/consumer-api.model' | ||
import { getDataSourceURIsByActionType } from '../../services/execution-plan-store' | ||
import Joi from 'joi' | ||
|
||
|
||
export const plansRouter: Foxx.Router = createRouter() | ||
|
||
|
||
plansRouter | ||
.get('/:planId/data-sources', | ||
(req: Foxx.Request, res: Foxx.Response) => { | ||
const uris: string[] = getDataSourceURIsByActionType( | ||
req.pathParams.planId, | ||
req.queryParams.access | ||
) | ||
res.send(uris) | ||
}) | ||
.pathParam('planId', Joi.string().min(1).required(), 'Execution Plan ID') | ||
.queryParam('access', Joi.string().optional().valid(DataSourceActionType.values).default(null), 'Access type (read/write) to filter by') | ||
.response(200, ['application/json'], 'Array of data source URIs') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
arangodb-foxx-services/src/main/routes/producer/events-router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { createRouter } from '@arangodb/foxx' | ||
import Joi from 'joi' | ||
import { Progress } from '../../../external/persistence-api.model' | ||
import { checkExecutionEventExists, storeExecutionEvent } from '../../services/execution-event-store' | ||
|
||
|
||
export const eventsRouter: Foxx.Router = createRouter() | ||
|
||
|
||
// Store execution event | ||
eventsRouter | ||
.post('/', | ||
(req: Foxx.Request, res: Foxx.Response) => { | ||
const execEvent: Progress = req.body | ||
storeExecutionEvent(execEvent) | ||
res.status('created') | ||
}) | ||
.body(['application/json'], 'Execution Event (Progress) JSON') | ||
.response(201, 'Execution event recorded') | ||
.summary('Record a new execution event') | ||
|
||
|
||
// Check if execution event exists | ||
eventsRouter | ||
.get('/:eventId/_exists', | ||
(req: Foxx.Request, res: Foxx.Response) => { | ||
const exists = checkExecutionEventExists( | ||
req.pathParams.eventId, | ||
req.queryParams.discriminator | ||
) | ||
res.send(exists) | ||
}) | ||
.pathParam('eventId', Joi.string().min(1).required(), 'Execution Event ID') | ||
.queryParam('discriminator', Joi.string().optional(), 'Execution Event Discriminator') | ||
.response(200, ['application/json'], 'Boolean value indicating if the execution event exists') | ||
.summary('Check if the execution event with the given parameters exists') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { createRouter } from '@arangodb/foxx' | ||
import { dsRouter } from './data-sources-router' | ||
import { plansRouter } from './plans-router' | ||
import { eventsRouter } from './events-router' | ||
|
||
|
||
const producerRouter: Foxx.Router = createRouter() | ||
|
||
producerRouter.use('/data-sources', dsRouter) | ||
producerRouter.use('/execution-plans', plansRouter) | ||
producerRouter.use('/execution-events', eventsRouter) | ||
|
||
export default producerRouter |
Oops, something went wrong.