2020-01-14 03:20:18 +01:00
|
|
|
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
|
|
|
|
consumes:
|
|
|
|
- application/json
|
|
|
|
securityDefinitions:
|
|
|
|
basicAuth:
|
|
|
|
type: basic
|
|
|
|
security:
|
|
|
|
- basicAuth: []
|
|
|
|
paths:
|
2020-01-16 01:04:22 +01:00
|
|
|
/projects/{project_name}/repositories/{repository_name}/artifacts/{digest}:
|
2020-01-14 03:20:18 +01:00
|
|
|
get:
|
2020-01-16 01:04:22 +01:00
|
|
|
summary: Get the specific artifact
|
|
|
|
description: Get the artifact specified by the digest under the project and repository
|
2020-01-14 03:20:18 +01:00
|
|
|
tags:
|
|
|
|
- artifact
|
2020-01-16 01:04:22 +01:00
|
|
|
operationId: getArtifact
|
2020-01-14 03:20:18 +01:00
|
|
|
parameters:
|
|
|
|
- $ref: '#/parameters/requestId'
|
2020-01-16 01:04:22 +01:00
|
|
|
- $ref: '#/parameters/projectName'
|
|
|
|
- $ref: '#/parameters/repositoryName'
|
|
|
|
- $ref: '#/parameters/digest'
|
|
|
|
- name: with_tag
|
|
|
|
in: query
|
|
|
|
description: Specify whether the tags are inclued inside the returning artifacts
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: true
|
|
|
|
- name: with_label
|
|
|
|
in: query
|
|
|
|
description: Specify whether the labels are inclued inside the returning artifacts
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
- name: with_scan_overview
|
|
|
|
in: query
|
|
|
|
description: Specify whether the scan overview is inclued inside the returning artifacts
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
# should be in tag level
|
|
|
|
- name: with_signatrue
|
|
|
|
in: query
|
|
|
|
description: Specify whether the signature is inclued inside the returning artifacts
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
- name: with_immutable_status
|
|
|
|
in: query
|
|
|
|
description: Specify whether the immutable status is inclued inside the tags of the returning artifacts. Only works when setting "with_tag=true"
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
2020-01-14 03:20:18 +01:00
|
|
|
responses:
|
|
|
|
'200':
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Success
|
2020-01-14 03:20:18 +01:00
|
|
|
schema:
|
|
|
|
$ref: '#/definitions/Artifact'
|
|
|
|
'401':
|
|
|
|
$ref: '#/responses/401'
|
|
|
|
'403':
|
|
|
|
$ref: '#/responses/403'
|
|
|
|
'500':
|
|
|
|
$ref: '#/responses/500'
|
|
|
|
delete:
|
2020-01-16 01:04:22 +01:00
|
|
|
summary: Delete the specific artifact
|
|
|
|
description: Delete the artifact specified by the digest under the project and repository
|
2020-01-14 03:20:18 +01:00
|
|
|
tags:
|
|
|
|
- artifact
|
|
|
|
operationId: deleteArtifact
|
|
|
|
parameters:
|
|
|
|
- $ref: '#/parameters/requestId'
|
2020-01-16 01:04:22 +01:00
|
|
|
- $ref: '#/parameters/projectName'
|
|
|
|
- $ref: '#/parameters/repositoryName'
|
|
|
|
- $ref: '#/parameters/digest'
|
2020-01-14 03:20:18 +01:00
|
|
|
responses:
|
|
|
|
'200':
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Success
|
2020-01-14 03:20:18 +01:00
|
|
|
'401':
|
|
|
|
$ref: '#/responses/401'
|
|
|
|
'403':
|
|
|
|
$ref: '#/responses/403'
|
|
|
|
'500':
|
|
|
|
$ref: '#/responses/500'
|
2020-01-16 01:04:22 +01:00
|
|
|
/projects/{project_name}/repositories/{repository_name}/artifacts:
|
2020-01-14 03:20:18 +01:00
|
|
|
get:
|
2020-01-16 01:04:22 +01:00
|
|
|
summary: List artifacts
|
|
|
|
description: List artifacts under the specific project and repository.
|
2020-01-14 03:20:18 +01:00
|
|
|
tags:
|
|
|
|
- artifact
|
|
|
|
operationId: listArtifacts
|
|
|
|
parameters:
|
|
|
|
- $ref: '#/parameters/requestId'
|
2020-01-16 01:04:22 +01:00
|
|
|
- $ref: '#/parameters/projectName'
|
|
|
|
- $ref: '#/parameters/repositoryName'
|
2020-01-14 03:20:18 +01:00
|
|
|
- $ref: '#/parameters/page'
|
|
|
|
- $ref: '#/parameters/pageSize'
|
2020-01-16 01:04:22 +01:00
|
|
|
- name: type
|
2020-01-14 03:20:18 +01:00
|
|
|
in: query
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Query the artifacts by type. Valid values can be "IMAGE", "CHART", etc.
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
- name: with_tag
|
|
|
|
in: query
|
|
|
|
description: Specify whether the tags are inclued inside the returning artifacts
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: true
|
|
|
|
- name: with_label
|
|
|
|
in: query
|
|
|
|
description: Specify whether the labels are inclued inside the returning artifacts
|
2020-01-14 03:20:18 +01:00
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
2020-01-16 01:04:22 +01:00
|
|
|
- name: with_scan_overview
|
2020-01-14 03:20:18 +01:00
|
|
|
in: query
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Specify whether the scan overview is inclued inside the returning artifacts
|
2020-01-14 03:20:18 +01:00
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
2020-01-16 01:04:22 +01:00
|
|
|
# should be in tag level
|
|
|
|
- name: with_signatrue
|
2020-01-14 03:20:18 +01:00
|
|
|
in: query
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Specify whether the signature is inclued inside the returning artifacts
|
2020-01-14 03:20:18 +01:00
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
2020-01-16 01:04:22 +01:00
|
|
|
- name: with_immutable_status
|
|
|
|
in: query
|
|
|
|
description: Specify whether the immutable status is inclued inside the tags of the returning artifacts. Only works when setting "with_tag=true"
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
# TODO add other query string: type, ....
|
2020-01-14 03:20:18 +01:00
|
|
|
responses:
|
|
|
|
'200':
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Success
|
2020-01-14 03:20:18 +01:00
|
|
|
headers:
|
|
|
|
X-Total-Count:
|
|
|
|
description: The total count of artifacts
|
|
|
|
type: integer
|
|
|
|
Link:
|
|
|
|
description: Link refers to the previous page and next page
|
|
|
|
type: string
|
|
|
|
schema:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/definitions/Artifact'
|
|
|
|
'401':
|
|
|
|
$ref: '#/responses/401'
|
|
|
|
'403':
|
|
|
|
$ref: '#/responses/403'
|
|
|
|
'500':
|
|
|
|
$ref: '#/responses/500'
|
|
|
|
parameters:
|
|
|
|
requestId:
|
|
|
|
name: X-Request-Id
|
2020-01-16 01:04:22 +01:00
|
|
|
description: An unique ID for the request
|
2020-01-14 03:20:18 +01:00
|
|
|
in: header
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
minLength: 1
|
2020-01-16 01:04:22 +01:00
|
|
|
projectName:
|
|
|
|
name: project_name
|
2020-01-14 03:20:18 +01:00
|
|
|
in: path
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The name of the project
|
2020-01-14 03:20:18 +01:00
|
|
|
required: true
|
2020-01-16 01:04:22 +01:00
|
|
|
type: string
|
|
|
|
repositoryName:
|
|
|
|
name: repository_name
|
2020-01-14 03:20:18 +01:00
|
|
|
in: path
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The name of the repository
|
2020-01-14 03:20:18 +01:00
|
|
|
required: true
|
2020-01-16 01:04:22 +01:00
|
|
|
type: string
|
|
|
|
digest:
|
|
|
|
name: digest
|
2020-01-14 03:20:18 +01:00
|
|
|
in: path
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The digest of the artifact
|
2020-01-14 03:20:18 +01:00
|
|
|
required: true
|
2020-01-16 01:04:22 +01:00
|
|
|
type: string
|
2020-01-14 03:20:18 +01:00
|
|
|
page:
|
|
|
|
name: page
|
|
|
|
in: query
|
|
|
|
type: integer
|
2020-01-16 01:04:22 +01:00
|
|
|
format: int64
|
2020-01-14 03:20:18 +01:00
|
|
|
required: false
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The page number
|
2020-01-14 03:20:18 +01:00
|
|
|
default: 1
|
|
|
|
pageSize:
|
|
|
|
name: page_size
|
|
|
|
in: query
|
|
|
|
type: integer
|
2020-01-16 01:04:22 +01:00
|
|
|
format: int64
|
2020-01-14 03:20:18 +01:00
|
|
|
required: false
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The size of per page
|
2020-01-14 03:20:18 +01:00
|
|
|
default: 10
|
|
|
|
responses:
|
|
|
|
'401':
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Unauthorized
|
2020-01-14 03:20:18 +01:00
|
|
|
headers:
|
|
|
|
X-Request-Id:
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The ID of the corresponding request for the response
|
2020-01-14 03:20:18 +01:00
|
|
|
type: string
|
|
|
|
schema:
|
|
|
|
$ref: '#/definitions/Error'
|
|
|
|
'403':
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Forbidden
|
2020-01-14 03:20:18 +01:00
|
|
|
headers:
|
|
|
|
X-Request-Id:
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The ID of the corresponding request for the response
|
2020-01-14 03:20:18 +01:00
|
|
|
type: string
|
|
|
|
schema:
|
|
|
|
$ref: '#/definitions/Error'
|
|
|
|
'500':
|
2020-01-16 01:04:22 +01:00
|
|
|
description: Internal server error
|
2020-01-14 03:20:18 +01:00
|
|
|
headers:
|
|
|
|
X-Request-Id:
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The ID of the corresponding request for the response
|
2020-01-14 03:20:18 +01:00
|
|
|
type: string
|
|
|
|
schema:
|
|
|
|
$ref: '#/definitions/Error'
|
|
|
|
definitions:
|
|
|
|
Error:
|
|
|
|
description: a model for all the error response coming from harbor
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
code:
|
|
|
|
type: string
|
|
|
|
description: The error code
|
|
|
|
message:
|
|
|
|
type: string
|
|
|
|
description: The error message
|
|
|
|
x-go-type:
|
|
|
|
import:
|
|
|
|
package: "github.com/goharbor/harbor/src/internal/error"
|
|
|
|
alias: "ierrors"
|
|
|
|
type: "Error"
|
|
|
|
Artifact:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The ID of the artifact
|
2020-01-14 03:20:18 +01:00
|
|
|
type:
|
|
|
|
type: string
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The type of the artifact, e.g. image, chart, etc
|
2020-01-14 03:20:18 +01:00
|
|
|
media_type:
|
|
|
|
type: string
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The media type of the artifact
|
|
|
|
manifest_media_type:
|
|
|
|
type: string
|
|
|
|
description: The manifest media type of the artifact
|
|
|
|
project_id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
description: The ID of the project that the artifact belongs to
|
|
|
|
repository_id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
description: The ID of the repository that the artifact belongs to
|
2020-01-14 03:20:18 +01:00
|
|
|
digest:
|
|
|
|
type: string
|
|
|
|
description: The digest of the artifact
|
|
|
|
size:
|
2020-01-16 01:04:22 +01:00
|
|
|
type: integer
|
2020-01-14 03:20:18 +01:00
|
|
|
format: int64
|
|
|
|
description: The size of the artifact
|
2020-01-16 01:04:22 +01:00
|
|
|
push_time:
|
2020-01-14 03:20:18 +01:00
|
|
|
type: string
|
|
|
|
format: date-time
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The push time of the artifact
|
|
|
|
pull_time:
|
|
|
|
type: string
|
|
|
|
format: date-time
|
|
|
|
description: The latest pull time of the artifact
|
|
|
|
extra_attrs:
|
|
|
|
$ref: '#/definitions/ExtraAttrs'
|
|
|
|
annotations:
|
|
|
|
$ref: '#/definitions/Annotations'
|
|
|
|
references:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/definitions/Reference'
|
|
|
|
tags:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/definitions/Tag'
|
|
|
|
sub_resource_links:
|
|
|
|
$ref: '#/definitions/SubResourceLinks'
|
|
|
|
Tag:
|
2020-01-14 03:20:18 +01:00
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The ID of the tag
|
|
|
|
repository_id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
description: The ID of the repository that the tag belongs to
|
|
|
|
artifact_id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
description: The ID of the artifact that the tag attached to
|
2020-01-14 03:20:18 +01:00
|
|
|
name:
|
|
|
|
type: string
|
2020-01-16 01:04:22 +01:00
|
|
|
description: The name of the tag
|
|
|
|
push_time:
|
|
|
|
type: string
|
|
|
|
format: date-time
|
|
|
|
description: The push time of the tag
|
|
|
|
pull_time:
|
|
|
|
type: string
|
|
|
|
format: date-time
|
|
|
|
description: The latest pull time of the tag
|
|
|
|
ExtraAttrs:
|
|
|
|
type: object
|
|
|
|
additionalProperties:
|
|
|
|
type: object
|
|
|
|
Annotations:
|
|
|
|
type: object
|
|
|
|
additionalProperties:
|
|
|
|
type: string
|
|
|
|
SubResourceLinks:
|
|
|
|
type: object
|
|
|
|
additionalProperties:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/definitions/ResourceLink'
|
|
|
|
ResourceLink:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
href:
|
|
|
|
type: string
|
|
|
|
description: The link of the resource
|
|
|
|
absolute:
|
|
|
|
type: boolean
|
|
|
|
description: Determine whether the link is an absolute URL or not
|
|
|
|
Reference:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
parent_id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
description: The parent ID of the reference
|
|
|
|
child_id:
|
|
|
|
type: integer
|
|
|
|
format: int64
|
|
|
|
description: The child ID of the reference
|
|
|
|
platform:
|
|
|
|
$ref: '#/definitions/Platform'
|
|
|
|
Platform:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
architecture:
|
|
|
|
type: string
|
|
|
|
description: The architecture that the artifact applys to
|
|
|
|
os:
|
|
|
|
type: string
|
|
|
|
description: The OS that the artifact applys to
|
|
|
|
os.version:
|
|
|
|
type: string
|
|
|
|
description: The version of the OS that the artifact applys to
|
|
|
|
os.features:
|
|
|
|
type: array
|
|
|
|
description: The features of the OS that the artifact applys to
|
|
|
|
items:
|
|
|
|
type: string
|
|
|
|
variant:
|
|
|
|
type: string
|
|
|
|
description: The variant of the CPU
|