From 1f25f7fba5aae6376c5e090085c70858e27d8d01 Mon Sep 17 00:00:00 2001 From: Wang Yan Date: Tue, 21 Feb 2023 13:52:10 +0800 Subject: [PATCH] remove chart api from swagger Delete the api path for chart in the swagger Signed-off-by: Wang Yan --- Makefile | 1 - README.md | 1 - api/swagger.yaml | 500 +---------------------------- api/v2.0/legacy_swagger.yaml | 370 --------------------- make/photon/portal/Dockerfile | 1 - src/portal/docker-build/Dockerfile | 1 - 6 files changed, 1 insertion(+), 873 deletions(-) delete mode 100644 api/v2.0/legacy_swagger.yaml diff --git a/Makefile b/Makefile index 21c01ec3f25..95c7a927e7d 100644 --- a/Makefile +++ b/Makefile @@ -568,7 +568,6 @@ swagger_client: mkdir -p harborclient/harbor_swagger_client mkdir -p harborclient/harbor_v2_swagger_client java -jar openapi-generator-cli.jar generate -i api/swagger.yaml -g python -o harborclient/harbor_client --package-name client - java -jar openapi-generator-cli.jar generate -i api/v2.0/legacy_swagger.yaml -g python -o harborclient/harbor_swagger_client --package-name swagger_client java -jar openapi-generator-cli.jar generate -i api/v2.0/swagger.yaml -g python -o harborclient/harbor_v2_swagger_client --package-name v2_swagger_client cd harborclient/harbor_client; python ./setup.py install cd harborclient/harbor_swagger_client; python ./setup.py install diff --git a/README.md b/README.md index 101d70841a1..923eaf1fa3b 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,6 @@ For learning the architecture design of Harbor, check the document [Architecture * Harbor RESTful API: The APIs for most administrative operations of Harbor and can be used to perform integrations with Harbor programmatically. * Part 1: [New or changed APIs](https://editor.swagger.io/?url=https://raw.githubusercontent.com/goharbor/harbor/main/api/v2.0/swagger.yaml) - * Part 2: [Legacy APIs](https://editor.swagger.io/?url=https://raw.githubusercontent.com/goharbor/harbor/main/api/v2.0/legacy_swagger.yaml) ## Install & Run diff --git a/api/swagger.yaml b/api/swagger.yaml index d53124f6723..653889905af 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -32,502 +32,4 @@ paths: type: object properties: version: - type: string - - /chartrepo/health: - get: - summary: Check the health of chart repository service. - description: Check the health of chart repository service. - tags: - - Chart Repository - responses: - '200': - description: Health status of chart repository service is returned. - schema: - type: object - properties: - healthy: - type: boolean - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - /chartrepo/{repo}/charts: - get: - summary: Get all the charts under the specified project - description: Get all the charts under the specified project - tags: - - Chart Repository - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - responses: - '200': - description: Searched for charts of project in Harbor successfully. - schema: - type: array - items: - $ref: '#/definitions/ChartInfoEntry' - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - post: - summary: Upload a chart file to the specified project. - description: 'Upload a chart file to the specified project. With this API, the corresponding provance file can be uploaded together with chart file at once.' - tags: - - Chart Repository - consumes: - - multipart/form-data - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: chart - in: formData - type: file - required: true - description: The chart file - - name: prov - in: formData - type: file - required: false - description: The provance file - responses: - '201': - description: The specified chart is successfully uploaded. - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - '507': - $ref: '#/definitions/InsufficientStorageChartAPIError' - /chartrepo/{repo}/charts/{name}: - get: - summary: Get all the versions of the specified chart - description: Get all the versions of the specified chart - tags: - - Chart Repository - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: name - in: path - type: string - required: true - description: The chart name - responses: - '200': - description: Retrieved all versions of the specified chart - schema: - $ref: '#/definitions/ChartVersions' - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '404': - $ref: '#/definitions/NotFoundChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - delete: - summary: Delete all the versions of the specified chart - description: Delete all the versions of the specified chart - tags: - - Chart Repository - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: name - in: path - type: string - required: true - description: The chart name - responses: - '200': - description: The specified chart entry is successfully deleted. - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - /chartrepo/{repo}/charts/{name}/{version}: - get: - summary: Get the specified chart version - description: Get the specified chart version - tags: - - Chart Repository - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: name - in: path - type: string - required: true - description: The chart name - - name: version - in: path - type: string - required: true - description: The chart version - responses: - '200': - description: Successfully retrieved the chart version - schema: - $ref: '#/definitions/ChartVersionDetails' - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '404': - $ref: '#/definitions/NotFoundChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - delete: - summary: Delete the specified chart version - description: Delete the specified chart version - tags: - - Chart Repository - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: name - in: path - type: string - required: true - description: The chart name - - name: version - in: path - type: string - required: true - description: The chart version - responses: - '200': - description: The specified chart entry is successfully deleted. - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '404': - $ref: '#/definitions/NotFoundChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - /chartrepo/{repo}/prov: - post: - summary: Upload a provance file to the specified project. - description: Upload a provance file to the specified project. The provance file should be targeted for an existing chart file. - tags: - - Chart Repository - consumes: - - multipart/form-data - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: prov - in: formData - type: file - required: true - description: The provance file - responses: - '201': - description: The provance file is successfully uploaded. - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - '507': - $ref: '#/definitions/InsufficientStorageChartAPIError' - /chartrepo/charts: - post: - summary: Upload a chart file to the defult 'library' project. - description: Upload a chart file to the default 'library' project. Uploading together with the prov file at the same time is also supported. - tags: - - Chart Repository - consumes: - - multipart/form-data - parameters: - - name: chart - in: formData - type: file - required: true - description: The chart file - - name: prov - in: formData - type: file - required: false - description: The provance file - responses: - '201': - description: The specified chart is successfully uploaded. - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - '507': - $ref: '#/definitions/InsufficientStorageChartAPIError' -definitions: - ChartAPIError: - description: The error object returned by chart repository API - type: object - required: - - error - properties: - error: - type: string - description: The error message returned by the chart API - UnauthorizedChartAPIError: - description: Unauthorized - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - ForbiddenChartAPIError: - description: Operation is forbidden or quota exceeded - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - InternalChartAPIError: - description: Internal server error occurred - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - NotFoundChartAPIError: - description: Not found - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - InsufficientStorageChartAPIError: - description: Insufficient storage - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - ChartInfoEntry: - type: object - description: The object contains basic chart information - required: - - name - - total_versions - - created - properties: - name: - type: string - description: Name of chart - total_versions: - type: integer - description: Total count of chart versions - latest_version: - type: string - description: latest version of chart - created: - type: string - description: The created time of chart - updated: - type: string - description: The created time of chart - icon: - type: string - description: The icon path of chart - home: - type: string - description: The home website of chart - deprecated: - type: boolean - description: Flag to indicate if the chart is deprecated - ChartInfoList: - type: array - description: The chart list under the project - items: - $ref: '#/definitions/ChartInfoEntry' - ChartVersion: - type: object - description: A specified chart entry - allOf: - - $ref: '#/definitions/ChartMetadata' - - type: object - properties: - created: - type: string - description: The created time of the chart entry - removed: - type: boolean - description: A flag to indicate if the chart entry is removed - digest: - type: string - description: The digest value of the chart entry - urls: - type: array - description: The urls of the chart entry - items: - type: string - properties: - labels: - $ref: '#/definitions/Labels' - ChartVersions: - type: array - description: A list of chart entry - items: - $ref: '#/definitions/ChartVersion' - ChartVersionDetails: - type: object - description: The detailed information of the chart entry - properties: - metadata: - $ref: '#/definitions/ChartVersion' - security: - $ref: '#/definitions/SecurityReport' - dependencies: - type: array - items: - $ref: '#/definitions/Dependency' - values: - type: object - additionalProperties: - type: object - files: - type: object - additionalProperties: - type: string - labels: - $ref: '#/definitions/Labels' - ChartMetadata: - type: object - description: The metadata of chart version - required: - - name - - version - - engine - - icon - - apiVersion - - appVersion - properties: - name: - type: string - description: The name of the chart - home: - type: string - description: The URL to the relevant project page - sources: - type: array - description: The URL to the source code of chart - items: - type: string - version: - type: string - description: A SemVer 2 version of chart - description: - type: string - description: A one-sentence description of chart - keywords: - type: array - description: A list of string keywords - items: - type: string - engine: - type: string - description: The name of template engine - icon: - type: string - description: The URL to an icon file - apiVersion: - type: string - description: The API version of this chart - appVersion: - type: string - description: The version of the application enclosed in the chart - deprecated: - type: boolean - description: Whether or not this chart is deprecated - Labels: - type: array - description: A list of label - items: - $ref: '#/definitions/Label' - Label: - type: object - properties: - id: - type: integer - description: The ID of label. - name: - type: string - description: The name of label. - description: - type: string - description: The description of label. - color: - type: string - description: The color of label. - scope: - type: string - description: 'The scope of label, g for global labels and p for project labels.' - project_id: - type: integer - description: The project ID if the label is a project label. - creation_time: - type: string - description: The creation time of label. - update_time: - type: string - description: The update time of label. - deleted: - type: boolean - description: The label is deleted or not. - SecurityReport: - type: object - description: The security information of the chart - properties: - signature: - $ref: '#/definitions/DigitalSignature' - Dependency: - type: object - description: Another chart the chart depends on - required: - - name - - version - properties: - name: - type: string - description: The name of the chart denpendency - version: - type: string - description: The version of the chart dependency - repository: - type: string - description: The URL to the repository - DigitalSignature: - type: object - description: The signature of the chart - properties: - signed: - type: boolean - description: A flag to indicate if the chart is signed - prov_file: - type: string - description: The URL of the provance file + type: string \ No newline at end of file diff --git a/api/v2.0/legacy_swagger.yaml b/api/v2.0/legacy_swagger.yaml deleted file mode 100644 index 5cfd0d3ac48..00000000000 --- a/api/v2.0/legacy_swagger.yaml +++ /dev/null @@ -1,370 +0,0 @@ -swagger: '2.0' -info: - title: Harbor API - description: These APIs provide services for manipulating Harbor project. - version: '2.0' -host: localhost -schemes: - - http - - https -basePath: /api/v2.0 -produces: - - application/json - - text/plain -consumes: - - application/json -securityDefinitions: - basic: - type: basic -security: - - basic: [] - - {} -paths: - /chartrepo/{repo}/charts/{name}/{version}/labels: - get: - summary: Return the attached labels of chart. - description: Return the attached labels of the specified chart version. - tags: - - Products - - Chart Repository - - Label - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: name - in: path - type: string - required: true - description: The chart name - - name: version - in: path - type: string - required: true - description: The chart version - responses: - '200': - $ref: '#/definitions/Labels' - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '404': - $ref: '#/definitions/NotFoundChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' - post: - summary: Mark label to chart. - description: Mark label to the specified chart version. - tags: - - Products - - Chart Repository - - Label - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: name - in: path - type: string - required: true - description: The chart name - - name: version - in: path - type: string - required: true - description: The chart version - - name: label - in: body - required: true - schema: - $ref: '#/definitions/Label' - description: 'The label being marked to the chart version' - responses: - '200': - description: The label is successfully marked to the chart version. - '400': - $ref: '#/definitions/BadRequestFormatedError' - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '404': - $ref: '#/definitions/NotFoundChartAPIError' - '409': - $ref: '#/definitions/ConflictFormatedError' - '500': - $ref: '#/definitions/InternalChartAPIError' - /chartrepo/{repo}/charts/{name}/{version}/labels/{id}: - delete: - summary: Remove label from chart. - description: Remove label from the specified chart version. - tags: - - Products - - Chart Repository - - Label - parameters: - - name: repo - in: path - type: string - required: true - description: The project name - - name: name - in: path - type: string - required: true - description: The chart name - - name: version - in: path - type: string - required: true - description: The chart version - - name: id - in: path - type: integer - required: true - description: The label ID - responses: - '200': - description: The label is successfully unmarked from the chart version. - '400': - $ref: '#/definitions/BadRequestFormatedError' - '401': - $ref: '#/definitions/UnauthorizedChartAPIError' - '403': - $ref: '#/definitions/ForbiddenChartAPIError' - '404': - $ref: '#/definitions/NotFoundChartAPIError' - '500': - $ref: '#/definitions/InternalChartAPIError' -responses: - OK: - description: 'Success' - Created: - description: 'Created' - headers: - Location: - type: string - description: The URL of the created resource - BadRequest: - description: 'Bad Request' - Unauthorized: - description: 'Unauthorized' - Forbidden: - description: 'Forbidden' - NotFound: - description: 'Not Found' - Conflict: - description: 'Conflict' - PreconditionFailed: - description: 'Precondition Failed' - UnsupportedMediaType: - description: 'The Media Type of the request is not supported, it has to be "application/json"' - InternalServerError: - description: 'Internal Server Error' -definitions: - EmailServerSetting: - type: object - properties: - email_host: - type: string - description: The host of email server. - email_port: - type: integer - description: The port of email server. - email_username: - type: string - description: The username of email server. - email_password: - type: string - description: The password of email server. - email_ssl: - type: boolean - description: Use ssl/tls or not. - email_identity: - type: string - description: The dentity of email server. - ComponentOverviewEntry: - type: object - properties: - severity: - type: integer - description: '1-None/Negligible, 2-Unknown, 3-Low, 4-Medium, 5-High' - count: - type: integer - description: number of the components with certain severity. - Label: - type: object - properties: - id: - type: integer - description: The ID of label. - name: - type: string - description: The name of label. - description: - type: string - description: The description of label. - color: - type: string - description: The color of label. - scope: - type: string - description: 'The scope of label, g for global labels and p for project labels.' - project_id: - type: integer - description: The project ID if the label is a project label. - creation_time: - type: string - description: The creation time of label. - update_time: - type: string - description: The update time of label. - deleted: - type: boolean - description: The label is deleted or not. - ChartAPIError: - description: The error object returned by chart repository API - type: object - required: - - error - properties: - error: - type: string - description: The error message returned by the chart API - UnauthorizedChartAPIError: - description: Unauthorized - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - ForbiddenChartAPIError: - description: Operation is forbidden or quota exceeded - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - InternalChartAPIError: - description: Internal server error occurred - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - NotFoundChartAPIError: - description: Not found - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - InsufficientStorageChartAPIError: - description: Insufficient storage - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - BadRequestFormatedError: - description: Bad request - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - ConflictFormatedError: - description: Conflicts - type: object - allOf: - - $ref: '#/definitions/ChartAPIError' - ChartMetadata: - type: object - description: The metadata of chart version - required: - - name - - version - - engine - - icon - - apiVersion - - appVersion - properties: - name: - type: string - description: The name of the chart - home: - type: string - description: The URL to the relevant project page - sources: - type: array - description: The URL to the source code of chart - items: - type: string - version: - type: string - description: A SemVer 2 version of chart - description: - type: string - description: A one-sentence description of chart - keywords: - type: array - description: A list of string keywords - items: - type: string - engine: - type: string - description: The name of template engine - icon: - type: string - description: The URL to an icon file - apiVersion: - type: string - description: The API version of this chart - appVersion: - type: string - description: The version of the application enclosed in the chart - deprecated: - type: boolean - description: Whether or not this chart is deprecated - ChartVersion: - type: object - description: A specified chart entry - allOf: - - $ref: '#/definitions/ChartMetadata' - - type: object - properties: - created: - type: string - description: The created time of the chart entry - removed: - type: boolean - description: A flag to indicate if the chart entry is removed - digest: - type: string - description: The digest value of the chart entry - urls: - type: array - description: The urls of the chart entry - items: - type: string - properties: - labels: - $ref: '#/definitions/Labels' - Labels: - type: array - description: A list of label - items: - $ref: '#/definitions/Label' - Permission: - type: object - description: The permission - properties: - resource: - type: string - description: The permission resoruce - action: - type: string - description: The permission action - Namespace: - type: object - description: The namespace of registry - properties: - name: - type: string - description: The name of namespace - metadata: - type: object - description: The metadata of namespace diff --git a/make/photon/portal/Dockerfile b/make/photon/portal/Dockerfile index ea1cb4ae1ca..4a459ab0493 100644 --- a/make/photon/portal/Dockerfile +++ b/make/photon/portal/Dockerfile @@ -12,7 +12,6 @@ RUN apt-get update \ COPY src/portal/package.json /build_dir COPY src/portal/package-lock.json /build_dir COPY src/portal/scripts /build_dir -COPY ./api/v2.0/legacy_swagger.yaml /build_dir/swagger.yaml COPY ./api/v2.0/swagger.yaml /build_dir/swagger2.yaml COPY ./api/swagger.yaml /build_dir/swagger3.yaml diff --git a/src/portal/docker-build/Dockerfile b/src/portal/docker-build/Dockerfile index c744fc0607f..e74b1ea7201 100644 --- a/src/portal/docker-build/Dockerfile +++ b/src/portal/docker-build/Dockerfile @@ -3,7 +3,6 @@ FROM node:16.10.0 as builder WORKDIR /build_dir COPY src/portal /build_dir -COPY api/v2.0/legacy_swagger.yaml /build_dir/swagger.yaml COPY api/v2.0/swagger.yaml /build_dir/swagger2.yaml COPY api/swagger.yaml /build_dir/swagger3.yaml