|
2 | 2 |
|
3 | 3 | ## Entry Points |
4 | 4 |
|
5 | | -- `platform-api/src/internal/handler/api.go` – implements `/api/v1/apis` CRUD, `/api/v1/projects/:projectId/apis` listing routes and `/api/v1/apis/:apiId/deploy-revision` for API deployment |
6 | | -- `platform-api/src/internal/service/api.go` – validates names, contexts, versions, orchestrates default values and generates deployment YAML and deploys APIs in the Gateway plus repository calls. |
| 5 | +- `platform-api/src/internal/handler/api.go` – implements `/api/v1/apis` CRUD, `/api/v1/projects/:projectId/apis` listing routes, `/api/v1/apis/:apiId/deploy-revision` for API deployment, and `/api/v1/apis/:apiId/gateways` for retrieving deployment status |
| 6 | +- `platform-api/src/internal/service/api.go` – validates names, contexts, versions, orchestrates default values and generates deployment YAML and deploys APIs in the Gateway plus repository calls. Also handles gateway deployment queries. |
7 | 7 | - `platform-api/src/internal/repository/api.go` – persists APIs, security, CORS, backend services, rate limiting, and operations using transactions. |
8 | | -- `platform-api/src/internal/database/schema.sql` – contains tables for APIs, security configs, backend services, rate limits, and operations. |
| 8 | +- `platform-api/src/internal/repository/gateway.go` – handles gateway operations including querying which gateways have specific APIs deployed. |
| 9 | +- `platform-api/src/internal/database/schema.sql` – contains tables for APIs, security configs, backend services, rate limits, operations, and API deployments tracking. |
9 | 10 | - `platform-api/src/resources/openapi.yaml` – provides the published API lifecycle contract for client integrations. |
10 | 11 |
|
11 | 12 | ## Behaviour |
|
14 | 15 | 2. Repository layer writes the main API record and related configuration tables within a single transaction. |
15 | 16 | 3. GET routes return fully hydrated API structures, including nested security and backend definitions. |
16 | 17 | 4. Update requests replace mutable fields and rebuild related configuration sets; deletes cascade via foreign keys. |
17 | | -5. Generates comprehensive deployment API YAML including: |
| 18 | +5. Gateway deployment tracking uses the `api_deployments` table to maintain relationships between APIs and gateways. |
| 19 | +6. The gateways endpoint queries deployed APIs by joining API deployments with gateway records, filtered by organization for security. |
| 20 | +7. Generates comprehensive deployment API YAML including: |
18 | 21 | - API metadata and configuration |
19 | 22 | - Security policies (mTLS, OAuth2, API Key) |
| 23 | + |
| 24 | +## Verification |
20 | 25 | - Create: `curl -k -X POST https://localhost:8443/api/v1/apis -H 'Content-Type: application/json' -d '{"name":"inventory","context":"/inventory","version":"v1","projectId":"<projectId>"}'`. |
21 | 26 | - Fetch: `curl -k https://localhost:8443/api/v1/apis/<apiId>`; confirm nested structures. |
22 | 27 | - List: `curl -k https://localhost:8443/api/v1/projects/<projectId>/apis` to verify pagination metadata and entries. |
23 | 28 | - Deploy API: `curl -k -X POST https://localhost:8443/api/v1/apis/<apiId>/deploy-revision -H 'Content-Type: application/json' -d '[{"name": "production-deployment","gatewayId": "987e6543-e21b-45d3-a789-426614174999", "displayOnDevportal": true}]'` to trigger API deployment. |
| 29 | +- Get API Gateways: `curl -k https://localhost:8443/api/v1/apis/<apiId>/gateways` to retrieve all gateways where the API is deployed; expect JSON array with gateway details (id, name, displayName, vhost, isActive, etc.). |
0 commit comments