Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: management separation #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
71 changes: 16 additions & 55 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapi: 3.0.3
info:
version: 1.0.0
version: 2.0.0
title: Crossid API
termsOfService: 'https://crossid.io/tos'
contact:
Expand All @@ -17,11 +17,14 @@ externalDocs:
description: Find out more about CrossID
url: 'https://www.crossid.io'
servers:
- url: https://{tenant}.crossid.io/api/v1
- url: https://{tenant}.{region}.crossid.io/api/v1
variables:
tenant:
default: acme
description: Tenant Identifier
region:
defualt: us
description: The tenant region
description: Development
tags:
- name: Secrets
Expand All @@ -31,39 +34,11 @@ tags:
x-tagGroups:
- name: Tenant API
tags:
- Secrets
- Tenants
- Resources
- Schemas
- Resource Types
- name: Global
tags:
- Namespaces
- Global Tenants
- Health
- Jobs
paths:
# tenants
#
/api/v1/tenants/{id}:
get:
$ref: resources/tenants/get_tenant.yml
put:
$ref: resources/tenants/replace_tenant.yml
patch:
$ref: resources/tenants/patch_tenant.yml
/api/global/v1/tenants:
post:
$ref: resources/tenants/create_tenant.yml
get:
$ref: resources/tenants/get_tenant_public.yml
/api/global/v1/tenants/.register:
post:
$ref: resources/tenants/register_tenant.yml
/api/global/v1/tenants/.activate:
post:
$ref: resources/tenants/activate_tenant.yml
/api/global/v1/tenants/{id}:
delete:
$ref: resources/tenants/delete_tenant.yml
# scim schemas
#
/api/v1/scim-schemas:
Expand All @@ -86,38 +61,24 @@ paths:
$ref: resources/resource_types/get_resource_type.yml
put:
$ref: resources/resource_types/replace_resource_type.yml
# secrets
# job
#
/api/v1/secrets/{path}:
/api/v1/jobs/{id}:
get:
$ref: resources/secrets/get_secret.yml
put:
$ref: resources/secrets/put_secret.yml
# namespace
$ref: resources/jobs/get_job.yml
# resources
#
/api/global/v1/namespaces:
post:
$ref: resources/cluster/create_namespace.yml
# health
#
/api/global/v1/health/ready:
get:
$ref: resources/health/ready.yml
/api/global/v1/health/alive:
/api/v1/resources/{appID}/{resourceTypes}:
get:
$ref: resources/health/alive.yml
$ref: resources/resources/list_resources_for_type.yml
components:
securitySchemes:
oauth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: 'https://{tenant}.crossid.io/oauth2/auth'
tokenUrl: 'https://{tenant}.crossid.io/oauth2/token'
authorizationUrl: 'https://crossid.us.crossid.io/oauth2/auth'
tokenUrl: 'https://crossid.us.crossid.io/oauth2/token'
scopes:
'read:users': read users info
'manage:read:users': read users info
'write:users': modify or remove users
namespaceApiKey:
type: http
scheme: bearer
bearerFormat: JWT
21 changes: 0 additions & 21 deletions openapi/resources/cluster/create_namespace.yml

This file was deleted.

7 changes: 0 additions & 7 deletions openapi/resources/cluster/examples/curl/create_namespace.yml

This file was deleted.

9 changes: 0 additions & 9 deletions openapi/resources/cluster/models/create_namespace_request.yml

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions openapi/resources/cluster/requests/create_namespace.yml

This file was deleted.

5 changes: 0 additions & 5 deletions openapi/resources/cluster/requests/examples.yml

This file was deleted.

17 changes: 0 additions & 17 deletions openapi/resources/cluster/responses/create_namespace.yml

This file was deleted.

3 changes: 0 additions & 3 deletions openapi/resources/cluster/responses/examples.yml

This file was deleted.

15 changes: 0 additions & 15 deletions openapi/resources/health/alive.yml

This file was deleted.

5 changes: 0 additions & 5 deletions openapi/resources/health/examples/curl/alive.yml

This file was deleted.

12 changes: 0 additions & 12 deletions openapi/resources/health/models/health_response.yml

This file was deleted.

11 changes: 0 additions & 11 deletions openapi/resources/health/ready.yml

This file was deleted.

3 changes: 0 additions & 3 deletions openapi/resources/health/responses/examples.yml

This file was deleted.

15 changes: 15 additions & 0 deletions openapi/resources/jobs/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
job:
value:
id: T1e642kLYG3iZYGjo5REVW
error: Item already exists.
status: fatal
statusCode: 500
reason: Creating a new user.
meta:
tenantId: acme
appId: '-'
resourceType: Job
created: '2021-09-13T19:00:14.646Z'
lastModified: '2021-09-13T19:00:14.646Z'
revision: 1
location: '/jobs/T1e642kLYG3iZYGjo5REVW'
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source: |-
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CID_TOKEN" \
"https://{tenant}.crossid.io/api/v1/secrets/secret/db_user"
"https://acme.us.crossid.io/api/v1/jobs/T1e642kLYG3iZYGjo5REVW"
17 changes: 17 additions & 0 deletions openapi/resources/jobs/get_job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
operationId: getJob
summary: Retrieve a Job.
description: Retrieve details about an existing Job by its id.
security:
- oauth2:
- job.read
tags:
- Jobs
parameters:
- $ref: parameters.yml#/id
responses:
'200':
$ref: responses/job.yml
default:
$ref: ../../shared/responses/default_error.yml
x-codeSamples:
- $ref: 'examples/curl/get_job.yml'
21 changes: 21 additions & 0 deletions openapi/resources/jobs/models/job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: Job model.
type: object
properties:
id:
type: string
description: Unique identifier of the job.
error:
type: string
description: Error message in case of a failure.
status:
type: string
enum: ['enqueued', 'started', 'failed', 'fatal', 'canceled', 'success']
description: The current status of the job.
statusCode:
type: number
description: The current status code of the job, corresponds to http status codes.
reason:
type: string
description: A descriptive reason describing the purpose of the job.
meta:
$ref: ../../../shared/models/meta.yml
8 changes: 8 additions & 0 deletions openapi/resources/jobs/parameters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id:
description: The job ID
in: path
name: id
required: true
schema:
type: string
example: T1e642kLYG3iZYGjo5REVW
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
description: A secret, in JSON format.
description: A Job, in JSON format.

content:
application/json:
schema:
$ref: ../models/secret.yml
$ref: ../models/job.yml
examples:
secret:
$ref: examples.yml#/secret
schema:
$ref: ../examples.yml#/job

headers:
ratelimit-limit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source: |-
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CID_TOKEN" \
-d '{"name": "User", "appId": "myapp", "schema": "scimUser", "mode": "local"}' \
"https://acme.crossid.io/api/v1/resource-types?reason=my-app"
"https://acme.us.crossid.io/api/v1/resource-types?reason=my-app"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source: |-
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CID_TOKEN" \
"https://acme.crossid.io/api/v1/resource-types/T9e682kLYG6iYFSjo5RJVW"
"https://acme.us.crossid.io/api/v1/resource-types/T9e682kLYG6iYFSjo5RJVW"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source: |-
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CID_TOKEN" \
"https://acme.crossid.io/api/v1/resource-types
"https://acme.us.crossid.io/api/v1/resource-types
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source: |-
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CID_TOKEN" \
-d '{"name": "User", "appId": "myapp", "schema": "scimUser", "mode": "local"}' \
"https://acme.crossid.io/api/v1/resource-types/T9e682kLYG6iYFSjo5RJVW?reason=my-app"
"https://acme.us.crossid.io/api/v1/resource-types/T9e682kLYG6iYFSjo5RJVW?reason=my-app"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source: |-
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CID_TOKEN" \
"https://{tenant}.crossid.io/api/v1/tenants/acme"
"https://acme.us.crossid.io/api/v1/resources/Users
24 changes: 24 additions & 0 deletions openapi/resources/resources/list_resources_for_type.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
operationId: listResourcesOfType
summary: List resources of a specific type
description: Retrieve a list of existing resources of a specific type.
security:
- oauth2:
- resource.read
tags:
- Resources
parameters:
- $ref: ../../shared/parameters.yml#/filter
- $ref: ../../shared/parameters.yml#/count
- $ref: ../../shared/parameters.yml#/startIndex
- $ref: ../../shared/parameters.yml#/sortBy
- $ref: ../../shared/parameters.yml#/sortOrder
- $ref: ../../shared/parameters.yml#/attributes
- $ref: ../../shared/parameters.yml#/excludedAttributes
- $ref: ../../shared/parameters.yml#/forTime
responses:
'200':
$ref: responses/list_resources.yml
default:
$ref: ../../shared/responses/default_error.yml
x-codeSamples:
- $ref: 'examples/curl/list_resources_for_type.yml'
Loading