From ad4cfc64ee6a56334e03a41f6a0830fa4b571a39 Mon Sep 17 00:00:00 2001 From: dborovcanin Date: Fri, 8 Mar 2024 09:46:07 +0000 Subject: [PATCH] deploy: 163ccbbe5951e3f946cf742ffd5b7a98b450b283 --- CNAME | 2 +- apis/api/openapi/auth.yml | 585 ++++++++++++++++++++++- apis/api/openapi/bootstrap.yml | 31 +- apis/api/openapi/certs.yml | 13 +- apis/api/openapi/consumers-notifiers.yml | 11 +- apis/api/openapi/http.yml | 11 +- apis/api/openapi/invitations.yml | 486 +++++++++++++++++++ apis/api/openapi/provision.yml | 11 +- apis/api/openapi/readers.yml | 56 ++- apis/api/openapi/schemas/HealthInfo.yml | 3 + apis/api/openapi/things.yml | 160 ++----- apis/api/openapi/twins.yml | 15 +- apis/api/openapi/users.yml | 266 +++-------- swagger-config.json | 2 +- 14 files changed, 1303 insertions(+), 349 deletions(-) create mode 100644 apis/api/openapi/invitations.yml diff --git a/CNAME b/CNAME index 0ad21f1ec8..d3d27158ca 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -apidocs.magistrala.abstractmachines.fr \ No newline at end of file +api.mainflux.io diff --git a/apis/api/openapi/auth.yml b/apis/api/openapi/auth.yml index 7fba2878c0..5d798276fd 100644 --- a/apis/api/openapi/auth.yml +++ b/apis/api/openapi/auth.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.3 info: - title: Mainflux Auth Service + title: Magistrala Auth Service description: | This is the Auth Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform users. You can now help us improve the API whether it's by making changes to the definition itself or to the code. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,14 +24,299 @@ tags: description: Everything about your Authentication and Authorization. externalDocs: description: Find out more about auth - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ - name: Keys description: Everything about your Keys. externalDocs: description: Find out more about keys - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: + /domains: + post: + tags: + - Domains + summary: Adds new domain + description: | + Adds new domain. + requestBody: + $ref: "#/components/requestBodies/DomainCreateReq" + responses: + "201": + $ref: "#/components/responses/DomainCreateRes" + "400": + description: Failed due to malformed JSON. + "401": + description: Missing or invalid access token provided. + "409": + description: Failed due to using an existing alias. + "415": + description: Missing or invalid content type. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + get: + summary: Retrieves list of domains. + description: | + Retrieves list of domains that the user have access. + parameters: + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Metadata" + - $ref: "#/components/parameters/Status" + - $ref: "#/components/parameters/DomainName" + - $ref: "#/components/parameters/Permission" + tags: + - Domains + security: + - bearerAuth: [] + responses: + "200": + $ref: "#/components/responses/DomainsPageRes" + "401": + description: Missing or invalid access token provided. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + /domains/{domainID}: + get: + summary: Retrieves domain information + description: | + Retrieves a specific domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + security: + - bearerAuth: [] + responses: + "200": + $ref: "#/components/responses/DomainRes" + "401": + description: Missing or invalid access token provided. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + patch: + summary: Updates name, metadata, tags and alias of the domain. + description: | + Updates name, metadata, tags and alias of the domain. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + requestBody: + $ref: "#/components/requestBodies/DomainUpdateReq" + security: + - bearerAuth: [] + responses: + "200": + $ref: "#/components/responses/DomainRes" + "400": + description: Failed due to malformed JSON. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access to domain id. + "404": + description: Failed due to non existing domain. + "415": + description: Missing or invalid content type. + "500": + $ref: "#/components/responses/ServiceError" + delete: + summary: Delete domain for a domain with the given id. + description: | + Delete domain removes a domain with the given id from repo + and removes all the things, channels, assigned users, policies related to this domain. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + security: + - bearerAuth: [] + responses: + "204": + description: Domain deleted. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access to domain id. + "500": + $ref: "#/components/responses/ServiceError" + /domains/{domainID}/permissions: + get: + summary: Retrieves user permissions on domain. + description: | + Retrieves user permissions on domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + security: + - bearerAuth: [] + responses: + "200": + $ref: "#/components/responses/DomainPermissionRes" + "401": + description: Missing or invalid access token provided. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + /domains/{domainID}/enable: + post: + summary: Enables a domain + description: | + Enables a specific domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + security: + - bearerAuth: [] + responses: + "200": + description: Successfully enabled domain. + "400": + description: Failed due to malformed domain's ID. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access the domain ID. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + /domains/{domainID}/disable: + post: + summary: Disable a domain + description: | + Disable a specific domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + security: + - bearerAuth: [] + responses: + "200": + description: Successfully disabled domain. + "400": + description: Failed due to malformed domain's ID. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access the domain ID. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + /domains/{domainID}/freeze: + post: + summary: Freeze a domain + description: | + Freeze a specific domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + security: + - bearerAuth: [] + responses: + "200": + description: Successfully freezed domain. + "400": + description: Failed due to malformed domain's ID. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access the domain ID. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + /domains/{domainID}/users/assign: + post: + summary: Assign users to domain + description: | + Assign users to domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + requestBody: + $ref: "#/components/requestBodies/AssignUserReq" + security: + - bearerAuth: [] + responses: + "200": + description: Users successfully assigned to domain. + "400": + description: Failed due to malformed domain's ID. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access the domain ID. + "404": + description: A non-existent entity request. + "409": + description: Conflict of data. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + /domains/{domainID}/users/unassign: + post: + summary: Unassign users from domain + description: | + Unassign users from domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "#/components/parameters/DomainID" + requestBody: + $ref: "#/components/requestBodies/UnassignUsersReq" + security: + - bearerAuth: [] + responses: + "200": + description: Users successfully unassigned from domain. + "400": + description: Failed due to malformed domain's ID. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access the domain ID. + "404": + description: A non-existent entity request. + "409": + description: Conflict of data. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" /keys: post: tags: @@ -133,6 +421,39 @@ paths: description: Missing or invalid content type. "500": $ref: "#/components/responses/ServiceError" + /users/{memberID}/domains: + get: + tags: + - Domains + summary: List users in a group + description: | + Retrieves a list of users in a domain. Due to performance concerns, data + is retrieved in subsets. The API must ensure that the entire + dataset is consumed either by making subsequent requests, or by + increasing the subset size of the initial request. + parameters: + - $ref: "users.yml#/components/parameters/MemberID" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Metadata" + - $ref: "#/components/parameters/Status" + security: + - bearerAuth: [] + responses: + "200": + $ref: "users.yml#/components/responses/UserPageRes" + "400": + description: Failed due to malformed query parameters. + "401": + description: | + Missing or invalid access token provided. + This endpoint is available only for administrators. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" /health: get: @@ -147,6 +468,164 @@ paths: components: schemas: + DomainReqObj: + type: object + properties: + name: + type: string + example: domainName + description: Domain name. + tags: + type: array + minItems: 0 + items: + type: string + example: ["tag1", "tag2"] + description: domain tags. + metadata: + type: object + example: { "domain": "example.com" } + description: Arbitrary, object-encoded domain's data. + alias: + type: string + example: domain alias + description: Domain alias. + required: + - name + - alias + Domain: + type: object + properties: + id: + type: string + format: uuid + example: bb7edb32-2eac-4aad-aebe-ed96fe073879 + description: Domain unique identifier. + name: + type: string + example: domainName + description: Domain name. + tags: + type: array + minItems: 0 + items: + type: string + example: ["tag1", "tag2"] + description: domain tags. + metadata: + type: object + example: { "domain": "example.com" } + description: Arbitrary, object-encoded domain's data. + alias: + type: string + example: domain alias + description: Domain alias. + status: + type: string + description: Domain Status + format: string + example: enabled + created_by: + type: string + format: uuid + example: "0d837f56-3f8a-4e2a-9359-6347d0fc9f06 " + description: User ID of the user who created the domain. + created_at: + type: string + format: date-time + example: "2019-11-26 13:31:52" + description: Time when the domain was created. + updated_by: + type: string + format: uuid + example: "80f66b77-ed74-4e74-9f88-6cce9a0a3049" + description: User ID of the user who last updated the domain. + updated_at: + type: string + format: date-time + example: "2019-11-26 13:31:52" + description: Time when the domain was last updated. + xml: + name: domain + + DomainsPage: + type: object + properties: + domains: + type: array + minItems: 0 + uniqueItems: true + items: + $ref: "#/components/schemas/Domain" + total: + type: integer + example: 1 + description: Total number of items. + offset: + type: integer + description: Number of items to skip during retrieval. + limit: + type: integer + example: 10 + description: Maximum number of items to return in one page. + required: + - domain + - total + - offset + DomainUpdate: + type: object + properties: + name: + type: string + example: domainName + description: Domain name. + tags: + type: array + minItems: 0 + items: + type: string + example: ["tag1", "tag2"] + description: domain tags. + metadata: + type: object + example: { "domain": "example.com" } + description: Arbitrary, object-encoded thing's data. + alias: + type: string + example: domain alias + description: Domain alias. + Permissions: + type: object + properties: + permissions: + type: array + minItems: 0 + items: + type: string + description: Permissions + + UserDomainRelationReq: + type: object + properties: + users_ids: + type: array + minItems: 1 + items: + type: string + description: Users IDs + example: + [ + "5dc1ce4b-7cc9-4f12-98a6-9d74cc4980bb", + "c01ed106-e52d-4aa4-bed3-39f360177cfa", + ] + relation: + type: string + enum: ["administrator", "editor","viewer","member"] + example: "administrator" + description: Policy relations. + required: + - users_ids + - relation Key: type: object properties: @@ -203,6 +682,40 @@ components: type: string parameters: + DomainID: + name: domainID + description: Unique domain identifier. + in: path + schema: + type: string + format: uuid + required: true + example: bb7edb32-2eac-4aad-aebe-ed96fe073879 + Status: + name: status + description: Domain status. + in: query + schema: + type: string + default: enabled + required: false + example: enabled + DomainName: + name: name + description: Domain's name. + in: query + schema: + type: string + required: false + example: "domainName" + Permission: + name: permission + description: permission. + in: query + schema: + type: string + required: false + example: "edit" ApiKeyId: name: keyID description: API Key ID. @@ -256,6 +769,36 @@ components: required: false requestBodies: + DomainCreateReq: + description: JSON-formatted document describing the new domain to be registered + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/DomainReqObj" + DomainUpdateReq: + description: JSON-formated document describing the name, alias, tags, and metadata of the domain to be updated + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/DomainUpdate" + AssignUserReq: + description: JSON-formated document describing the policy related to assigning users to a domain + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UserDomainRelationReq" + + UnassignUsersReq: + description: JSON-formated document describing the policy related to unassigning users to a domain + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UserDomainRelationReq" + KeyRequest: description: JSON-formatted document describing key request. required: true @@ -286,6 +829,38 @@ components: ServiceError: description: Unexpected server-side error occurred. + DomainCreateRes: + description: Create new domain. + headers: + Location: + schema: + type: string + format: url + description: Registered domain relative URL in the format `/domains/` + content: + application/json: + schema: + $ref: "#/components/schemas/Domain" + + DomainRes: + description: Data retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/Domain" + DomainPermissionRes: + description: Data retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/Permissions" + DomainsPageRes: + description: Data retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/DomainsPage" + KeyRes: description: Data retrieved. content: diff --git a/apis/api/openapi/bootstrap.yml b/apis/api/openapi/bootstrap.yml index d36ee9b9ac..2a8177a54f 100644 --- a/apis/api/openapi/bootstrap.yml +++ b/apis/api/openapi/bootstrap.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.1 info: - title: Mainflux Bootstrap service + title: Magistrala Bootstrap service description: | HTTP API for managing platform things configuration. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,7 +24,7 @@ tags: description: Everything about your Configs externalDocs: description: Find out more about Configs - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /things/configs: @@ -89,7 +92,7 @@ paths: description: | Update is performed by replacing the current resource data with values provided in a request payload. Note that the owner, ID, external ID, - external key, Mainflux Thing ID and key cannot be changed. + external key, Magistrala Thing ID and key cannot be changed. tags: - configs parameters: @@ -113,7 +116,7 @@ paths: summary: Removes a Config description: | Removes a Config. In case of successful removal the service will ensure - that the removed config is disconnected from all of the Mainflux channels. + that the removed config is disconnected from all of the Magistrala channels. tags: - configs parameters: @@ -224,7 +227,7 @@ paths: summary: Updates Config state. description: | Updating state represents enabling/disabling Config, i.e. connecting - and disconnecting corresponding Mainflux Thing to the list of Channels. + and disconnecting corresponding Magistrala Thing to the list of Channels. tags: - configs parameters: @@ -262,11 +265,11 @@ components: thing_id: type: string format: uuid - description: Corresponding Mainflux Thing ID. - mainflux_key: + description: Corresponding Magistrala Thing ID. + magistrala_key: type: string format: uuid - description: Corresponding Mainflux Thing key. + description: Corresponding Magistrala Thing key. channels: type: array minItems: 0 @@ -334,11 +337,11 @@ components: thing_id: type: string format: uuid - description: Corresponding Mainflux Thing ID. + description: Corresponding Magistrala Thing ID. thing_key: type: string format: uuid - description: Corresponding Mainflux Thing key. + description: Corresponding Magistrala Thing key. channels: type: array minItems: 0 @@ -367,7 +370,7 @@ components: thing_id: type: string format: uuid - description: Corresponding Mainflux Thing ID. + description: Corresponding Magistrala Thing ID. client_cert: type: string description: Client certificate. @@ -450,7 +453,7 @@ components: description: External key. thing_id: type: string - description: ID of the corresponding Mainflux Thing. + description: ID of the corresponding Magistrala Thing. channels: type: array minItems: 0 diff --git a/apis/api/openapi/certs.yml b/apis/api/openapi/certs.yml index f2ea440507..e8a7e88f4d 100644 --- a/apis/api/openapi/certs.yml +++ b/apis/api/openapi/certs.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.1 info: - title: Mainflux Certs service + title: Magistrala Certs service description: | HTTP API for Certs service Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,7 +24,7 @@ tags: description: Everything about your Certs externalDocs: description: Find out more about certs - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /certs: @@ -138,7 +141,7 @@ components: thing_id: type: string format: uuid - description: Corresponding Mainflux Thing ID. + description: Corresponding Magistrala Thing ID. client_cert: type: string description: Client Certificate. diff --git a/apis/api/openapi/consumers-notifiers.yml b/apis/api/openapi/consumers-notifiers.yml index 36a029b968..067d8f96bf 100644 --- a/apis/api/openapi/consumers-notifiers.yml +++ b/apis/api/openapi/consumers-notifiers.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.1 info: - title: Mainflux Notifiers service + title: Magistrala Notifiers service description: | HTTP API for Notifiers service. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -23,7 +26,7 @@ tags: description: Everything about your Notifiers externalDocs: description: Find out more about notifiers - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /subscriptions: diff --git a/apis/api/openapi/http.yml b/apis/api/openapi/http.yml index 4a34b2e4d1..5a5a985f09 100644 --- a/apis/api/openapi/http.yml +++ b/apis/api/openapi/http.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.1 info: - title: Mainflux http adapter + title: Magistrala http adapter description: | HTTP API for sending messages through communication channels. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,7 +24,7 @@ tags: description: Everything about your Messages externalDocs: description: Find out more about messages - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /channels/{id}/messages: diff --git a/apis/api/openapi/invitations.yml b/apis/api/openapi/invitations.yml new file mode 100644 index 0000000000..0dd3c3fc8d --- /dev/null +++ b/apis/api/openapi/invitations.yml @@ -0,0 +1,486 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + +openapi: 3.0.3 +info: + title: Magistrala Invitations Service + description: | + This is the Invitations Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform invitations. You can now help us improve the API whether it's by making changes to the definition itself or to the code. + Some useful links: + - [The Magistrala repository](https://github.com/absmach/magistrala) + contact: + email: info@mainflux.com + license: + name: Apache 2.0 + url: https://github.com/absmach/magistrala/blob/master/LICENSE + version: 0.14.0 + +servers: + - url: http://localhost:9020 + - url: https://localhost:9020 + +tags: + - name: Invitations + description: Everything about your Invitations + externalDocs: + description: Find out more about Invitations + url: https://docs.magistrala.abstractmachines.fr/ + +paths: + /invitations: + post: + tags: + - Invitations + summary: Send invitation + description: | + Send invitation to user to join domain. + requestBody: + $ref: "#/components/requestBodies/SendInvitationReq" + security: + - bearerAuth: [] + responses: + "201": + description: Invitation sent. + "400": + description: Failed due to malformed JSON. + "401": + description: Missing or invalid access token provided. + "409": + description: Failed due to using an existing identity. + "415": + description: Missing or invalid content type. + "500": + $ref: "#/components/responses/ServiceError" + + get: + tags: + - Invitations + summary: List invitations + description: | + Retrieves a list of invitations. Due to performance concerns, data + is retrieved in subsets. The API must ensure that the entire + dataset is consumed either by making subsequent requests, or by + increasing the subset size of the initial request. + parameters: + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/UserID" + - $ref: "#/components/parameters/InvitedBy" + - $ref: "#/components/parameters/DomainID" + - $ref: "#/components/parameters/Relation" + - $ref: "#/components/parameters/State" + security: + - bearerAuth: [] + responses: + "200": + $ref: "#/components/responses/InvitationPageRes" + "400": + description: Failed due to malformed query parameters. + "401": + description: | + Missing or invalid access token provided. + This endpoint is available only for administrators. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + /invitations/accept: + post: + summary: Accept invitation + description: | + Current logged in user accepts invitation to join domain. + tags: + - Invitations + security: + - bearerAuth: [] + requestBody: + $ref: "#/components/requestBodies/AcceptInvitationReq" + responses: + "200": + description: Invitation accepted. + "400": + description: Failed due to malformed query parameters. + "401": + description: Missing or invalid access token provided. + "500": + $ref: "#/components/responses/ServiceError" + + /invitations/{user_id}/{domain_id}: + get: + summary: Retrieves a specific invitation + description: | + Retrieves a specific invitation that is identifier by the user ID and domain ID. + tags: + - Invitations + parameters: + - $ref: "#/components/parameters/user_id" + - $ref: "#/components/parameters/domain_id" + security: + - bearerAuth: [] + responses: + "200": + $ref: "#/components/responses/InvitationRes" + "400": + description: Failed due to malformed query parameters. + "401": + description: Missing or invalid access token provided. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" + + delete: + summary: Deletes a specific invitation + description: | + Deletes a specific invitation that is identifier by the user ID and domain ID. + tags: + - Invitations + parameters: + - $ref: "#/components/parameters/user_id" + - $ref: "#/components/parameters/domain_id" + security: + - bearerAuth: [] + responses: + "204": + description: Invitation deleted. + "400": + description: Failed due to malformed JSON. + "404": + description: Failed due to non existing user. + "401": + description: Missing or invalid access token provided. + "500": + $ref: "#/components/responses/ServiceError" + + /health: + get: + summary: Retrieves service health check info. + tags: + - health + responses: + "200": + $ref: "#/components/responses/HealthRes" + "500": + $ref: "#/components/responses/ServiceError" + +components: + schemas: + SendInvitationReqObj: + type: object + properties: + user_id: + type: string + 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: + - administrator + - editor + - viewer + - member + - domain + - parent_group + - role_group + - group + - platform + example: editor + description: Relation between user and domain. + resend: + type: boolean + example: true + description: Resend invitation. + required: + - user_id + - domain_id + - relation + + Invitation: + type: object + properties: + invited_by: + type: string + format: uuid + example: bb7edb32-2eac-4aad-aebe-ed96fe073879 + description: User unique identifier. + user_id: + type: string + 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: + - administrator + - editor + - viewer + - member + - domain + - parent_group + - role_group + - group + - platform + example: editor + description: Relation between user and domain. + created_at: + type: string + format: date-time + example: "2019-11-26 13:31:52" + description: Time when the group was created. + updated_at: + type: string + format: date-time + example: "2019-11-26 13:31:52" + description: Time when the group was created. + confirmed_at: + type: string + format: date-time + example: "2019-11-26 13:31:52" + description: Time when the group was created. + xml: + name: invitation + + InvitationPage: + type: object + properties: + invitations: + type: array + minItems: 0 + uniqueItems: true + items: + $ref: "#/components/schemas/Invitation" + total: + type: integer + example: 1 + description: Total number of items. + offset: + type: integer + description: Number of items to skip during retrieval. + limit: + type: integer + example: 10 + description: Maximum number of items to return in one page. + required: + - invitations + - total + - offset + + Error: + type: object + properties: + error: + type: string + description: Error message + example: { "error": "malformed entity specification" } + + HealthRes: + type: object + properties: + status: + type: string + description: Service status. + enum: + - pass + version: + type: string + description: Service version. + example: 0.14.0 + commit: + type: string + description: Service commit hash. + example: 7d6f4dc4f7f0c1fa3dc24eddfb18bb5073ff4f62 + description: + type: string + description: Service description. + example: service + build_time: + type: string + description: Service build time. + example: 1970-01-01_00:00:00 + + parameters: + Offset: + name: offset + description: Number of items to skip during retrieval. + in: query + schema: + type: integer + default: 0 + minimum: 0 + required: false + example: "0" + + Limit: + name: limit + description: Size of the subset to retrieve. + in: query + schema: + type: integer + default: 10 + maximum: 10 + minimum: 1 + required: false + example: "10" + + UserID: + name: user_id + description: Unique user identifier. + in: query + schema: + type: string + format: uuid + required: true + example: bb7edb32-2eac-4aad-aebe-ed96fe073879 + + user_id: + name: user_id + description: Unique user identifier. + in: path + schema: + type: string + format: uuid + 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. + in: query + schema: + type: string + format: uuid + required: false + example: bb7edb32-2eac-4aad-aebe-ed96fe073879 + + Relation: + name: relation + description: Relation between user and domain. + in: query + schema: + type: string + enum: + - administrator + - editor + - viewer + - member + - domain + - parent_group + - role_group + - group + - platform + required: false + example: editor + + State: + name: state + description: Invitation state. + in: query + schema: + type: string + enum: + - pending + - accepted + - all + required: false + example: accepted + + requestBodies: + SendInvitationReq: + description: JSON-formatted document describing request for sending invitation + required: true + content: + application/json: + 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. + content: + application/json: + schema: + $ref: "#/components/schemas/Invitation" + + InvitationPageRes: + description: Data retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/InvitationPage" + + HealthRes: + description: Service Health Check. + content: + application/health+json: + schema: + $ref: "#/components/schemas/HealthRes" + + ServiceError: + description: Unexpected server-side error occurred. + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + description: | + * User access: "Authorization: Bearer " + +security: + - bearerAuth: [] diff --git a/apis/api/openapi/provision.yml b/apis/api/openapi/provision.yml index 82f8d6c817..e7d57dae24 100644 --- a/apis/api/openapi/provision.yml +++ b/apis/api/openapi/provision.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.1 info: - title: Mainflux Provision service + title: Magistrala Provision service description: | HTTP API for Provision service Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,7 +24,7 @@ tags: description: Everything about your Provision externalDocs: description: Find out more about provision - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /mapping: diff --git a/apis/api/openapi/readers.yml b/apis/api/openapi/readers.yml index cb978683cb..2391060e27 100644 --- a/apis/api/openapi/readers.yml +++ b/apis/api/openapi/readers.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.1 info: - title: Mainflux reader service + title: Magistrala reader service description: | HTTP API for reading messages. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -23,13 +26,13 @@ servers: - url: https://localhost:9009 - url: http://localhost:9011 - url: https://localhost:9011 - + tags: - name: readers description: Everything about your Readers externalDocs: description: Find out more about readers - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /channels/{chanId}/messages: @@ -54,14 +57,16 @@ paths: - $ref: "#/components/parameters/DataValue" - $ref: "#/components/parameters/From" - $ref: "#/components/parameters/To" + - $ref: "#/components/parameters/Aggregation" + - $ref: "#/components/parameters/Interval" responses: - '200': + "200": $ref: "#/components/responses/MessagesPageRes" - '400': + "400": description: Failed due to malformed query parameters. - '401': + "401": description: Missing or invalid access token provided. - '500': + "500": $ref: "#/components/responses/ServiceError" /health: get: @@ -69,9 +74,9 @@ paths: tags: - health responses: - '200': + "200": $ref: "#/components/responses/HealthRes" - '500': + "500": $ref: "#/components/responses/ServiceError" components: @@ -223,6 +228,7 @@ components: in: query schema: type: number + example: 1709218556069 required: false To: name: to @@ -230,6 +236,34 @@ components: in: query schema: type: number + example: 1709218757503 + required: false + Aggregation: + name: aggregation + description: Aggregation function. + in: query + schema: + type: string + enum: + - MAX + - AVG + - MIN + - SUM + - COUNT + - max + - min + - sum + - avg + - count + example: MAX + required: false + Interval: + name: interval + description: Aggregation interval. + in: query + schema: + type: string + example: 10s required: false responses: diff --git a/apis/api/openapi/schemas/HealthInfo.yml b/apis/api/openapi/schemas/HealthInfo.yml index 4d4c062c4e..a3acb18970 100644 --- a/apis/api/openapi/schemas/HealthInfo.yml +++ b/apis/api/openapi/schemas/HealthInfo.yml @@ -1,3 +1,6 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + type: object properties: status: diff --git a/apis/api/openapi/things.yml b/apis/api/openapi/things.yml index f9b2912a1c..4ed91b8cdf 100644 --- a/apis/api/openapi/things.yml +++ b/apis/api/openapi/things.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.3 info: - title: Mainflux Things Service + title: Magistrala Things Service description: | This is the Things Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform things and channels. You can now help us improve the API whether it's by making changes to the definition itself or to the code. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,17 +24,17 @@ tags: description: Everything about your Things externalDocs: description: Find out more about things - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ - name: Channels description: Everything about your Channels externalDocs: description: Find out more about things channels - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ - name: Policies description: Access to things policies externalDocs: description: Find out more about things policies - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /things: @@ -76,7 +79,6 @@ paths: - $ref: "#/components/parameters/Status" - $ref: "#/components/parameters/ThingName" - $ref: "#/components/parameters/Tags" - - $ref: "#/components/parameters/Owner" security: - bearerAuth: [] responses: @@ -166,45 +168,38 @@ paths: description: Missing or invalid content type. "500": $ref: "#/components/responses/ServiceError" - - /things/{thingID}/tags: - patch: - summary: Updates tags the thing. + delete: + summary: Delete thing for a thing with the given id. description: | - Updates tags of the thing with provided ID. Tags is updated using - authorization token and the new tags received in request. + Delete thing removes a thing with the given id from repo + and removes all the policies related to this thing. tags: - Things parameters: - $ref: "#/components/parameters/ThingID" - requestBody: - $ref: "#/components/requestBodies/ThingUpdateTagsReq" security: - bearerAuth: [] responses: - "200": - $ref: "#/components/responses/ThingRes" - "400": - description: Failed due to malformed JSON. - "404": - description: Failed due to non existing thing. + "204": + description: Thing deleted. "401": description: Missing or invalid access token provided. + "403": + description: Unauthorized access to thing id. "500": $ref: "#/components/responses/ServiceError" - - /things/{thingID}/owner: + /things/{thingID}/tags: patch: - summary: Updates the thing owner. + summary: Updates tags the thing. description: | - Updates owner for the thing with provided ID. Owner is updated using - authorization token and a new owner identifier received in request. + Updates tags of the thing with provided ID. Tags is updated using + authorization token and the new tags received in request. tags: - Things parameters: - $ref: "#/components/parameters/ThingID" requestBody: - $ref: "#/components/requestBodies/ThingUpdateOwnerReq" + $ref: "#/components/requestBodies/ThingUpdateTagsReq" security: - bearerAuth: [] responses: @@ -386,8 +381,7 @@ paths: - Channels summary: Creates new channel description: | - Creates new channel. User identified by the provided access token will - be the channel's owner. + Creates new channel in domain. requestBody: $ref: "#/components/requestBodies/ChannelCreateReq" security: @@ -422,7 +416,6 @@ paths: - $ref: "#/components/parameters/Offset" - $ref: "#/components/parameters/Metadata" - $ref: "#/components/parameters/ChannelName" - - $ref: "#/components/parameters/OwnerId" responses: "200": $ref: "#/components/responses/ChannelPageRes" @@ -489,6 +482,26 @@ paths: description: Missing or invalid content type. "500": $ref: "#/components/responses/ServiceError" + delete: + summary: Delete channel for given channel id. + description: | + Delete channel remove given channel id from repo + and removes all the policies related to channel. + tags: + - Channels + parameters: + - $ref: "#/components/parameters/chanID" + security: + - bearerAuth: [] + responses: + "204": + description: Channel deleted. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access to thing id. + "500": + $ref: "#/components/responses/ServiceError" /channels/{chanID}/enable: post: @@ -864,14 +877,9 @@ components: example: bb7edb32-2eac-4aad-aebe-ed96fe073879 minimum: 8 description: Free-form account secret used for acquiring auth token(s). - owner: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Thing owner must be exsiting in the databse. metadata: type: object - example: { "domain": "example.com" } + example: { "model": "example" } description: Arbitrary, object-encoded thing's data. status: type: string @@ -898,18 +906,13 @@ components: description: Id of parent channel, it must be existing channel. metadata: type: object - example: { "domain": "example.com" } + example: { "location": "example" } description: Arbitrary, object-encoded channels's data. status: type: string description: Channel Status format: string example: enabled - owner_id: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Channel owner ID must be exsiting in the databse. required: - name @@ -1023,11 +1026,11 @@ components: type: string example: ["tag1", "tag2"] description: Thing tags. - owner: + domain_id: type: string format: uuid example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Thing owner identifier. + description: ID of the domain to which thing belongs. credentials: type: object properties: @@ -1041,7 +1044,7 @@ components: description: Thing secret password. metadata: type: object - example: { "domain": "example.com" } + example: { "model": "example" } description: Arbitrary, object-encoded thing's data. status: type: string @@ -1080,11 +1083,11 @@ components: type: string example: ["tag1", "tag2"] description: Thing tags. - owner: + domain_id: type: string format: uuid example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Thing owner identifier. + description: ID of the domain to which thing belongs. credentials: type: object properties: @@ -1098,7 +1101,7 @@ components: description: Thing secret password. metadata: type: object - example: { "domain": "example.com" } + example: { "model": "example" } description: Arbitrary, object-encoded thing's data. status: type: string @@ -1130,11 +1133,11 @@ components: type: string example: channelName description: Free-form channel name. Channel name is unique on the given hierarchy level. - owner_id: + domain_id: type: string format: uuid example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Channel owner identifier of thing that created the channel.. + description: ID of the domain to which the group belongs. parent_id: type: string format: uuid @@ -1326,16 +1329,6 @@ components: required: - secret - ThingOwner: - type: object - properties: - owner: - type: string - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Thing owner for example email address. - required: - - owner - ChannelUpdate: type: object properties: @@ -1452,35 +1445,6 @@ components: required: false example: "thingName" - ThingIdentity: - name: identity - description: Thing's identity. - in: query - schema: - type: string - required: false - example: "admin@example.com" - - Owner: - name: owner_id - description: Thing's owner. - in: query - schema: - type: string - format: uuid - required: false - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - - ThingOwner: - name: owner - description: Unique owner identifier for a thing. - in: query - schema: - type: string - format: uuid - required: false - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - Status: name: status description: Thing account status. @@ -1561,16 +1525,6 @@ components: type: boolean default: false - OwnerId: - name: ownerId - description: Unique owner identifier for a channel. - in: query - schema: - type: string - format: uuid - required: false - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - Metadata: name: metadata description: Metadata filter. Filtering is performed matching the parameter with metadata on top level. Parameter is json. @@ -1645,14 +1599,6 @@ components: schema: $ref: "#/components/schemas/ThingSecret" - ThingUpdateOwnerReq: - description: JSON-formated document describing the owner of thing to be update - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ThingOwner" - ShareThingReq: description: JSON-formated document describing the policy related to sharing things required: true diff --git a/apis/api/openapi/twins.yml b/apis/api/openapi/twins.yml index 38a352dea4..fd826ca319 100644 --- a/apis/api/openapi/twins.yml +++ b/apis/api/openapi/twins.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.1 info: - title: Mainflux twins service + title: Magistrala twins service description: | HTTP API for managing digital twins and their states. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,7 +24,7 @@ tags: description: Everything about your Twins externalDocs: description: Find out more about twins - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: @@ -221,7 +224,7 @@ components: description: Name of the attribute. channel: type: string - description: Mainflux channel used by attribute. + description: Magistrala channel used by attribute. subtopic: type: string description: Subtopic used by attribute. @@ -256,7 +259,7 @@ components: properties: owner: type: string - description: Email address of Mainflux user that owns twin. + description: Email address of Magistrala user that owns twin. id: type: string format: uuid diff --git a/apis/api/openapi/users.yml b/apis/api/openapi/users.yml index a9e2ba57c2..e4dd97b3b6 100644 --- a/apis/api/openapi/users.yml +++ b/apis/api/openapi/users.yml @@ -1,15 +1,18 @@ +# Copyright (c) Abstract Machines +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.3 info: - title: Mainflux Users Service + title: Magistrala Users Service description: | This is the Users Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform users. You can now help us improve the API whether it's by making changes to the definition itself or to the code. Some useful links: - - [The Mainflux repository](https://github.com/mainflux/mainflux) + - [The Magistrala repository](https://github.com/absmach/magistrala) contact: email: info@mainflux.com license: name: Apache 2.0 - url: https://github.com/mainflux/mainflux/blob/master/LICENSE + url: https://github.com/absmach/magistrala/blob/master/LICENSE version: 0.14.0 servers: @@ -21,12 +24,12 @@ tags: description: Everything about your Users externalDocs: description: Find out more about users - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ - name: Groups description: Everything about your Groups externalDocs: description: Find out more about users groups - url: http://docs.mainflux.io/ + url: https://docs.magistrala.abstractmachines.fr/ paths: /users: @@ -70,8 +73,6 @@ paths: - $ref: "#/components/parameters/UserName" - $ref: "#/components/parameters/UserIdentity" - $ref: "#/components/parameters/Tags" - - $ref: "#/components/parameters/Owner" - - $ref: "#/components/parameters/UserVisibility" security: - bearerAuth: [] responses: @@ -212,18 +213,17 @@ paths: "500": $ref: "#/components/responses/ServiceError" - /users/{userID}/owner: + /users/{userID}/role: patch: - summary: Updates the user owner. + summary: Updates the user role. description: | - Updates owner for the user with provided ID. Owner is updated using - authorization token and a new owner identifier received in request. + Updates role for the user with provided ID. tags: - Users parameters: - $ref: "#/components/parameters/UserID" requestBody: - $ref: "#/components/requestBodies/UserUpdateOwnerReq" + $ref: "#/components/requestBodies/UserUpdateRoleReq" security: - bearerAuth: [] responses: @@ -296,8 +296,6 @@ paths: authorization token and the new received info. tags: - Users - parameters: - - $ref: "#/components/parameters/UserID" requestBody: $ref: "#/components/requestBodies/UserUpdateSecretReq" security: @@ -376,7 +374,6 @@ paths: - $ref: "#/components/parameters/Metadata" - $ref: "#/components/parameters/GroupName" - $ref: "#/components/parameters/ParentID" - - $ref: "#/components/parameters/OwnerID" responses: "200": $ref: "#/components/responses/MembersPageRes" @@ -412,7 +409,6 @@ paths: - $ref: "#/components/parameters/Metadata" - $ref: "#/components/parameters/ChannelName" - $ref: "#/components/parameters/ParentID" - - $ref: "#/components/parameters/OwnerID" responses: "200": $ref: "#/components/responses/MembersPageRes" @@ -512,7 +508,6 @@ paths: - $ref: "#/components/parameters/Metadata" - $ref: "#/components/parameters/GroupName" - $ref: "#/components/parameters/ParentID" - - $ref: "#/components/parameters/OwnerID" responses: "200": $ref: "#/components/responses/GroupPageRes" @@ -571,6 +566,26 @@ paths: description: Group does not exist. "500": $ref: "#/components/responses/ServiceError" + delete: + summary: Delete group for a group with the given id. + description: | + Delete group removes a group with the given id from repo + and removes all the policies related to this group. + tags: + - Groups + parameters: + - $ref: "#/components/parameters/GroupID" + security: + - bearerAuth: [] + responses: + "204": + description: Group deleted. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access to group id. + "500": + $ref: "#/components/responses/ServiceError" /groups/{groupID}/children: get: @@ -593,7 +608,6 @@ paths: - $ref: "#/components/parameters/Metadata" - $ref: "#/components/parameters/GroupName" - $ref: "#/components/parameters/ParentID" - - $ref: "#/components/parameters/OwnerID" responses: "200": $ref: "#/components/responses/GroupPageRes" @@ -627,7 +641,6 @@ paths: - $ref: "#/components/parameters/Metadata" - $ref: "#/components/parameters/GroupName" - $ref: "#/components/parameters/ParentID" - - $ref: "#/components/parameters/OwnerID" responses: "200": $ref: "#/components/responses/GroupPageRes" @@ -799,7 +812,37 @@ paths: description: Group does not exist. "500": $ref: "#/components/responses/ServiceError" - + /domains/{domainID}/users: + get: + summary: List users assigned to domain + description: | + List users assigned to domain that is identified by the domain ID. + tags: + - Domains + parameters: + - $ref: "auth.yml#/components/parameters/DomainID" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Metadata" + - $ref: "#/components/parameters/Status" + security: + - bearerAuth: [] + responses: + "200": + $ref: "#/components/responses/UserPageRes" + description: List of users assigned to domain. + "400": + description: Failed due to malformed domain's ID. + "401": + description: Missing or invalid access token provided. + "403": + description: Unauthorized access the domain ID. + "404": + description: A non-existent entity request. + "422": + description: Database can't process request. + "500": + $ref: "#/components/responses/ServiceError" /health: get: summary: Retrieves service health check info. @@ -840,11 +883,6 @@ components: example: password minimum: 8 description: Free-form account secret used for acquiring auth token(s). - owner: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: User owner must be exsiting in the databse. metadata: type: object example: { "domain": "example.com" } @@ -881,11 +919,6 @@ components: description: Group Status format: string example: enabled - owner_id: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Group owner ID must be exsiting in the databse. required: - name @@ -908,21 +941,16 @@ components: type: string example: ["tag1", "tag2"] description: User tags. - owner: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: User owner identifier. credentials: type: object properties: identity: type: string - example: admin@mainflux.com + example: admin@magistrala.com description: User Identity for example email address. metadata: type: object - example: { "domain": "example.com" } + example: { "address": "example" } description: Arbitrary, object-encoded user's data. status: type: string @@ -954,11 +982,11 @@ components: type: string example: groupName description: Free-form group name. Group name is unique on the given hierarchy level. - owner_id: + domain_id: type: string format: uuid example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Group owner identifier of user that created the group.. + description: ID of the domain to which the group belongs.. parent_id: type: string format: uuid @@ -1000,58 +1028,6 @@ components: xml: name: group - Memberships: - type: object - properties: - id: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Unique group identifier generated by the service. - name: - type: string - example: groupName - description: Free-form group name. Group name is unique on the given hierarchy level. - owner_id: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Group owner identifier of user that created the group.. - parent_id: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Group parent identifier. - description: - type: string - example: long group description - description: Group description, free form text. - metadata: - type: object - example: { "role": "general" } - description: Arbitrary, object-encoded groups's data. - path: - type: string - example: bb7edb32-2eac-4aad-aebe-ed96fe073879.bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: Hierarchy path, concatenated ids of group ancestors. - level: - type: integer - description: Level in hierarchy, distance from the root group. - format: int32 - example: 2 - created_at: - type: string - format: date-time - example: "2019-11-26 13:31:52" - description: Datetime when the group was created. - updated_at: - type: string - format: date-time - example: "2019-11-26 13:31:52" - description: Datetime when the group was created. - xml: - name: memberships - Members: type: object properties: @@ -1071,17 +1047,12 @@ components: type: string example: ["computations", "datasets"] description: User tags. - owner: - type: string - format: uuid - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - description: User owner identifier. credentials: type: object properties: identity: type: string - example: user@mainflux.com + example: user@magistrala.com description: User Identity for example email address. secret: type: string @@ -1159,31 +1130,6 @@ components: - total - level - MembershipsPage: - type: object - properties: - memberships: - type: array - minItems: 0 - uniqueItems: true - items: - $ref: "#/components/schemas/Memberships" - total: - type: integer - example: 1 - description: Total number of items. - offset: - type: integer - description: Number of items to skip during retrieval. - limit: - type: integer - example: 10 - description: Maximum number of items to return in one page. - required: - - memberships - - total - - level - MembersPage: type: object properties: @@ -1241,7 +1187,7 @@ components: properties: identity: type: string - example: user@mainflux.com + example: user@magistrala.com description: User Identity for example email address. required: - identity @@ -1261,15 +1207,16 @@ components: - old_secret - new_secret - UserOwner: + UserRole: type: object properties: - owner: + role: type: string - example: user@mainflux.com - description: User owner for example email address. + enum: ["admin","user"] + example: user + description: User role example. required: - - owner + - role GroupUpdate: type: object @@ -1345,7 +1292,7 @@ components: properties: identity: type: string - example: user@mainflux.com + example: user@magistrala.com description: User Identity for example email address. secret: type: string @@ -1407,15 +1354,6 @@ components: required: true example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - Visibility: - name: visibility - description: The visibility specifier when listing users. Either all, shared or mine. - in: path - schema: - type: string - required: true - example: all - UserName: name: name description: User's name. @@ -1434,35 +1372,6 @@ components: required: false example: "admin@example.com" - Owner: - name: owner_id - description: User's owner. - in: query - schema: - type: string - format: uuid - required: false - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - - UserOwner: - name: owner - description: Unique owner identifier for a user. - in: query - schema: - type: string - format: uuid - required: false - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - - UserVisibility: - name: visibility - description: visibility to list either users I own or users that are shared with me or both users I own and shared with me - in: query - schema: - type: string - required: false - example: shared - Status: name: status description: User account status. @@ -1572,16 +1481,6 @@ components: type: boolean default: false - OwnerID: - name: ownerID - description: Unique owner identifier for a group. - in: query - schema: - type: string - format: uuid - required: false - example: bb7edb32-2eac-4aad-aebe-ed96fe073879 - Metadata: name: metadata description: Metadata filter. Filtering is performed matching the parameter with metadata on top level. Parameter is json. @@ -1655,13 +1554,13 @@ components: schema: $ref: "#/components/schemas/UserSecret" - UserUpdateOwnerReq: - description: JSON-formated document describing the owner of user to be update + UserUpdateRoleReq: + description: JSON-formated document describing the role of the user to be updated required: true content: application/json: schema: - $ref: "#/components/schemas/UserOwner" + $ref: "#/components/schemas/UserRole" GroupCreateReq: description: JSON-formatted document describing the new group to be registered @@ -1783,13 +1682,6 @@ components: schema: $ref: "#/components/schemas/UsersPage" - MembershipsPageRes: - description: Memberships associated with the user. - content: - application/json: - schema: - $ref: "#/components/schemas/MembershipsPage" - GroupCreateRes: description: Registered new group. headers: diff --git a/swagger-config.json b/swagger-config.json index c658712c02..c869fd69f4 100644 --- a/swagger-config.json +++ b/swagger-config.json @@ -1 +1 @@ -{"urls":[{"name":"auth.yml","url":"apis/api/openapi/auth.yml"},{"name":"bootstrap.yml","url":"apis/api/openapi/bootstrap.yml"},{"name":"certs.yml","url":"apis/api/openapi/certs.yml"},{"name":"consumers-notifiers.yml","url":"apis/api/openapi/consumers-notifiers.yml"},{"name":"http.yml","url":"apis/api/openapi/http.yml"},{"name":"provision.yml","url":"apis/api/openapi/provision.yml"},{"name":"readers.yml","url":"apis/api/openapi/readers.yml"},{"name":"things.yml","url":"apis/api/openapi/things.yml"},{"name":"twins.yml","url":"apis/api/openapi/twins.yml"},{"name":"users.yml","url":"apis/api/openapi/users.yml"}]} +{"urls":[{"name":"auth.yml","url":"apis/api/openapi/auth.yml"},{"name":"bootstrap.yml","url":"apis/api/openapi/bootstrap.yml"},{"name":"certs.yml","url":"apis/api/openapi/certs.yml"},{"name":"consumers-notifiers.yml","url":"apis/api/openapi/consumers-notifiers.yml"},{"name":"http.yml","url":"apis/api/openapi/http.yml"},{"name":"invitations.yml","url":"apis/api/openapi/invitations.yml"},{"name":"provision.yml","url":"apis/api/openapi/provision.yml"},{"name":"readers.yml","url":"apis/api/openapi/readers.yml"},{"name":"things.yml","url":"apis/api/openapi/things.yml"},{"name":"twins.yml","url":"apis/api/openapi/twins.yml"},{"name":"users.yml","url":"apis/api/openapi/users.yml"}]}