From 5f41f6ed6bfd644e290419120b44990a29e7bb9e Mon Sep 17 00:00:00 2001 From: mohit-singh4 <158050587+mohit-singh4@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:17:43 +0530 Subject: [PATCH] [MNT-24127] Added Endpoint to Calculate the Folder Size. (#215) [feature/MNT-24127-AddedEndpointToCalculateTheFolderSize] Swagger endpoints to calculate and retrieve folder size details --- .../webapp/definitions/alfresco-core.yaml | 131 +++++++++++++++++- 1 file changed, 128 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/definitions/alfresco-core.yaml b/src/main/webapp/definitions/alfresco-core.yaml index 625717be..d4e09277 100755 --- a/src/main/webapp/definitions/alfresco-core.yaml +++ b/src/main/webapp/definitions/alfresco-core.yaml @@ -123,6 +123,12 @@ parameters: description: The identifier of a target node. required: true type: string + jobIdParam: + name: jobId + in: path + description: The identifier of a job. + required: true + type: string nodeFolderIdParam: name: nodeId in: path @@ -2198,6 +2204,83 @@ paths: description: Unexpected error schema: $ref: '#/definitions/Error' + '/nodes/{nodeId}/size-details': + post: + tags: + - nodes + summary: Accepts request to generate Node Size Details + description: | + + This may be executed against a node specified by **nodeId** and this nodeId must be a valid node ID. + Furthermore, this POST endpoint will be executed **asynchronously** with a `202` HTTP response signifying that + the request has been accepted successfully. + + The response body will include the ```jobId``` of the pending/completed action. + operationId: getNodeSizeDetailsRequest + produces: + - application/json + parameters: + - $ref: '#/parameters/nodeTargetIdParam' + responses: + '202': + description: Request Accepted + schema: + $ref: '#/definitions/sizeDetailsRequestResultEntry' + '401': + description: Authentication failed + '403': + description: Current user does not have permission for **nodeId** + '404': + description: | + **nodeId** or **folderId** does not exist + '422': + description: | + Invalid parameter: value of **nodeId** is invalid + default: + description: Unexpected error + schema: + $ref: '#/definitions/Error' + '/nodes/{nodeId}/size-details/{jobId}': + get: + tags: + - nodes + summary: Get the result of a background job to get the size of a node. + description: | + ***Receiving the size*** + This endpoint takes ```nodeId``` and ```jobId``` as the path parameters and returns the result after executing above GET request. + The size details job can be in one of three states: + + ``` + NOT-INITIATED: Not Initiated yet. + IN-PROGRESS: Calculation is in progress. + COMPLETED: Calculation has been done. + ``` + + operationId: getNodeSizeDetails + produces: + - application/json + parameters: + - $ref: '#/parameters/nodeTargetIdParam' + - $ref: '#/parameters/jobIdParam' + responses: + '200': + description: Successful Response + schema: + $ref: '#/definitions/getNodeSizeDetailsResponse' + '401': + description: Authentication failed + '403': + description: Current user does not have permission for **nodeId** + '404': + description: | + **nodeId** or **jobId** does not exist + '422': + description: | + Invalid parameter: value of **nodeId** is invalid + default: + description: Unexpected error + schema: + $ref: '#/definitions/Error' '/nodes/{nodeId}/renditions': post: x-alfresco-since: "5.2" @@ -2484,7 +2567,6 @@ paths: description: Unexpected error schema: $ref: '#/definitions/Error' - '/nodes/{nodeId}/secondary-children': post: x-alfresco-since: "5.2" @@ -4434,7 +4516,7 @@ paths: **nodeId** does not exist '412': description: | - Content is archived and is inaccessible + Content is archived and is inaccessible '501': description: The actual ContentStore implementation can't fulfil this request default: @@ -8582,7 +8664,7 @@ paths: parameters: - $ref: '#/parameters/auditApplicationIdParam' - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/omitTotalItemsParam' + - $ref: '#/parameters/omitTotalItemsParam' - $ref: '#/parameters/orderByParam' - $ref: '#/parameters/maxItemsParam' - name: where @@ -10690,6 +10772,34 @@ definitions: $ref: '#/definitions/PermissionsInfo' definition: $ref: '#/definitions/Definition' + getNodeSizeDetailsResponse: + type: object + properties: + id: + type: string + description: Provides the nodeId for which POST/size-details has been initiated. + sizeInBytes: + type: string + description: The folder size in bytes. + calculatedAt: + type: string + description: Provides the timestamp when the calculation of folder size is completed. + numberOfFiles: + type: integer + description: Provides the number of files in the folder. + status: + type: string + description: | + Provides a status that signifies the completion of the calculateSize mechanism. + ``` + NOT-INITIATED: Not Initiated yet. + IN-PROGRESS: Calculation is in progress. + COMPLETED: Calculation has been done. + + ``` + jobId: + type: string + description: Provides the getId for which POST/size-details has been initiated. ProbeEntry: type: object required: @@ -11298,6 +11408,21 @@ definitions: id: type: string description: The unique identifier of the action pending execution + sizeDetailsRequestResultEntry: + type: object + required: + - entry + properties: + entry: + $ref: '#/definitions/sizeDetailsRequestExecResult' + sizeDetailsRequestExecResult: + type: object + required: + - jobId + properties: + jobId: + type: string + description: The unique identifier of the size details execution request Definition: properties: properties: