Skip to content

Commit

Permalink
MG-2441 - Add domain ID to API (absmach#2442)
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <[email protected]>
  • Loading branch information
nyagamunene authored Oct 23, 2024
1 parent 0a1ac01 commit ca8ed3b
Show file tree
Hide file tree
Showing 83 changed files with 5,545 additions and 4,163 deletions.
19 changes: 14 additions & 5 deletions api/openapi/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tags:
url: https://docs.magistrala.abstractmachines.fr/

paths:
/things/configs:
/{domainID}/things/configs:
post:
operationId: createConfig
summary: Adds new config
Expand All @@ -36,6 +36,8 @@ paths:
the provided access token.
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
requestBody:
$ref: "#/components/requestBodies/ConfigCreateReq"
responses:
Expand Down Expand Up @@ -70,6 +72,7 @@ paths:
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Offset"
- $ref: "#/components/parameters/State"
Expand All @@ -85,13 +88,14 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/things/configs/{configId}:
/{domainID}/things/configs/{configId}:
get:
operationId: getConfig
summary: Retrieves config info (with channels).
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/ConfigId"
responses:
"200":
Expand All @@ -118,6 +122,7 @@ paths:
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/ConfigId"
requestBody:
$ref: "#/components/requestBodies/ConfigUpdateReq"
Expand Down Expand Up @@ -147,6 +152,7 @@ paths:
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/ConfigId"
responses:
"204":
Expand All @@ -161,7 +167,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/things/configs/certs/{configId}:
/{domainID}/things/configs/certs/{configId}:
patch:
operationId: updateConfigCerts
summary: Updates certs
Expand All @@ -171,6 +177,7 @@ paths:
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/ConfigId"
requestBody:
$ref: "#/components/requestBodies/ConfigCertUpdateReq"
Expand All @@ -192,7 +199,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/things/configs/connections/{configId}:
/{domainID}/things/configs/connections/{configId}:
put:
operationId: updateConfigConnections
summary: Updates channels the thing is connected to
Expand All @@ -202,6 +209,7 @@ paths:
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/ConfigId"
requestBody:
$ref: "#/components/requestBodies/ConfigConnUpdateReq"
Expand Down Expand Up @@ -273,7 +281,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/things/state/{configId}:
/{domainID}/things/state/{configId}:
put:
operationId: updateConfigState
summary: Updates Config state.
Expand All @@ -283,6 +291,7 @@ paths:
tags:
- configs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/ConfigId"
requestBody:
$ref: "#/components/requestBodies/ConfigStateUpdateReq"
Expand Down
13 changes: 10 additions & 3 deletions api/openapi/certs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ tags:
url: https://docs.magistrala.abstractmachines.fr/

paths:
/certs:
/{domainID}/certs:
post:
operationId: createCert
summary: Creates a certificate for thing
description: Creates a certificate for thing
tags:
- certs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
requestBody:
$ref: "#/components/requestBodies/CertReq"
responses:
Expand All @@ -51,7 +53,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/certs/{certID}:
/{domainID}/certs/{certID}:
get:
operationId: getCert
summary: Retrieves a certificate
Expand All @@ -60,6 +62,7 @@ paths:
tags:
- certs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/CertID"
responses:
"200":
Expand All @@ -85,10 +88,13 @@ paths:
tags:
- certs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/CertID"
responses:
"200":
$ref: "#/components/responses/RevokeRes"
"400":
description: Failed due to malformed query parameters.
"401":
description: Missing or invalid access token provided.
"403":
Expand All @@ -100,7 +106,7 @@ paths:
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"
/serials/{thingID}:
/{domainID}/serials/{thingID}:
get:
operationId: getSerials
summary: Retrieves certificates' serial IDs
Expand All @@ -109,6 +115,7 @@ paths:
tags:
- certs
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/ThingID"
responses:
"200":
Expand Down
75 changes: 21 additions & 54 deletions api/openapi/invitations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ tags:
url: https://docs.magistrala.abstractmachines.fr/

paths:
/invitations:
/{domainID}/invitations:
post:
operationId: sendInvitation
tags:
- Invitations
summary: Send invitation
description: |
Send invitation to user to join domain.
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
requestBody:
$ref: "#/components/requestBodies/SendInvitationReq"
security:
Expand Down Expand Up @@ -70,7 +72,7 @@ paths:
- $ref: "#/components/parameters/Offset"
- $ref: "#/components/parameters/UserID"
- $ref: "#/components/parameters/InvitedBy"
- $ref: "#/components/parameters/DomainID"
- $ref: "auth.yml#/components/parameters/DomainID"
- $ref: "#/components/parameters/Relation"
- $ref: "#/components/parameters/State"
security:
Expand All @@ -91,7 +93,7 @@ paths:
"500":
$ref: "#/components/responses/ServiceError"

/invitations/accept:
/{domainID}/invitations/accept:
post:
operationId: acceptInvitation
summary: Accept invitation
Expand All @@ -101,8 +103,8 @@ paths:
- Invitations
security:
- bearerAuth: []
requestBody:
$ref: "#/components/requestBodies/AcceptInvitationReq"
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
responses:
"204":
description: Invitation accepted.
Expand All @@ -112,10 +114,12 @@ paths:
description: Missing or invalid access token provided.
"404":
description: A non-existent entity request.
"415":
description: Missing or invalid content type.
"500":
$ref: "#/components/responses/ServiceError"

/invitations/reject:
/{domainID}/invitations/reject:
post:
operationId: rejectInvitation
summary: Reject invitation
Expand All @@ -125,8 +129,8 @@ paths:
- Invitations
security:
- bearerAuth: []
requestBody:
$ref: "#/components/requestBodies/AcceptInvitationReq"
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
responses:
"204":
description: Invitation rejected.
Expand All @@ -136,10 +140,12 @@ paths:
description: Missing or invalid access token provided.
"404":
description: A non-existent entity request.
"415":
description: Missing or invalid content type.
"500":
$ref: "#/components/responses/ServiceError"

/invitations/{user_id}/{domain_id}:
/{domainID}/invitations/users/{user_id}:
get:
operationId: getInvitation
summary: Retrieves a specific invitation
Expand All @@ -149,7 +155,7 @@ paths:
- Invitations
parameters:
- $ref: "#/components/parameters/user_id"
- $ref: "#/components/parameters/domain_id"
- $ref: "auth.yml#/components/parameters/DomainID"
security:
- bearerAuth: []
responses:
Expand All @@ -161,6 +167,8 @@ paths:
description: Missing or invalid access token provided.
"404":
description: A non-existent entity request.
"415":
description: Missing or invalid content type.
"422":
description: Database can't process request.
"500":
Expand All @@ -175,7 +183,7 @@ paths:
- Invitations
parameters:
- $ref: "#/components/parameters/user_id"
- $ref: "#/components/parameters/domain_id"
- $ref: "auth.yml#/components/parameters/DomainID"
security:
- bearerAuth: []
responses:
Expand All @@ -187,6 +195,8 @@ paths:
description: Failed due to non existing user.
"401":
description: Missing or invalid access token provided.
"415":
description: Missing or invalid content type.
"500":
$ref: "#/components/responses/ServiceError"

Expand All @@ -212,11 +222,6 @@ components:
format: uuid
example: bb7edb32-2eac-4aad-aebe-ed96fe073879
description: User unique identifier.
domain_id:
type: string
format: uuid
example: bb7edb32-2eac-4aad-aebe-ed96fe073879
description: Domain unique identifier.
relation:
type: string
enum:
Expand All @@ -238,7 +243,6 @@ components:
description: Resend invitation.
required:
- user_id
- domain_id
- relation

Invitation:
Expand Down Expand Up @@ -394,26 +398,6 @@ components:
required: true
example: bb7edb32-2eac-4aad-aebe-ed96fe073879

DomainID:
name: domain_id
description: Unique identifier for a domain.
in: query
schema:
type: string
format: uuid
required: false
example: bb7edb32-2eac-4aad-aebe-ed96fe073879

domain_id:
name: domain_id
description: Unique identifier for a domain.
in: path
schema:
type: string
format: uuid
required: true
example: bb7edb32-2eac-4aad-aebe-ed96fe073879

InvitedBy:
name: invited_by
description: Unique identifier for a user that invited the user.
Expand Down Expand Up @@ -466,22 +450,6 @@ components:
schema:
$ref: "#/components/schemas/SendInvitationReqObj"

AcceptInvitationReq:
description: JSON-formatted document describing request for accepting invitation
required: true
content:
application/json:
schema:
type: object
properties:
domain_id:
type: string
format: uuid
example: bb7edb32-2eac-4aad-aebe-ed96fe073879
description: Domain unique identifier.
required:
- domain_id

responses:
InvitationRes:
description: Data retrieved.
Expand All @@ -494,7 +462,6 @@ components:
operationId: deleteInvitation
parameters:
user_id: $response.body#/user_id
domain_id: $response.body#/domain_id

InvitationPageRes:
description: Data retrieved.
Expand Down
6 changes: 5 additions & 1 deletion api/openapi/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ tags:
url: https://docs.magistrala.abstractmachines.fr/

paths:
/mapping:
/{domainID}/mapping:
post:
summary: Adds new device to proxy
description: Adds new device to proxy
tags:
- provision
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
requestBody:
$ref: "#/components/requestBodies/ProvisionReq"
responses:
Expand All @@ -55,6 +57,8 @@ paths:
configuration created with provision service.
tags:
- provision
parameters:
- $ref: "auth.yml#/components/parameters/DomainID"
responses:
"200":
$ref: "#/components/responses/ProvisionRes"
Expand Down
Loading

0 comments on commit ca8ed3b

Please sign in to comment.