Add new API endpoints for push mirrors management (#19841)

- Add a new push mirror to specific repository
- Sync now ( send all the changes to the configured push mirrors )
- Get list of all push mirrors of a repository
- Get a push mirror by ID
- Delete push mirror by ID

Signed-off-by: Mohamed Sekour <mohamed.sekour@exfo.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
Mohamed Sekour 2022-07-30 18:45:59 +02:00 committed by GitHub
parent e819da0837
commit 0e61a74e5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 787 additions and 44 deletions

View file

@ -8774,6 +8774,233 @@
}
}
},
"/repos/{owner}/{repo}/push_mirrors": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Get all push mirrors of the repository",
"operationId": "repoListPushMirrors",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "page number of results to return (1-based)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "page size of results",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"$ref": "#/responses/PushMirrorList"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "add a push mirror to the repository",
"operationId": "repoAddPushMirror",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/CreatePushMirrorOption"
}
}
],
"responses": {
"201": {
"$ref": "#/responses/PushMirror"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
}
}
}
},
"/repos/{owner}/{repo}/push_mirrors-sync": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Sync all push mirrored repository",
"operationId": "repoPushMirrorSync",
"parameters": [
{
"type": "string",
"description": "owner of the repo to sync",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo to sync",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/empty"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
}
}
}
},
"/repos/{owner}/{repo}/push_mirrors/{name}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Get push mirror of the repository by remoteName",
"operationId": "repoGetPushMirrorByRemoteName",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "remote name of push mirror",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/PushMirror"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
}
}
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "deletes a push mirror from a repository by remoteName",
"operationId": "repoDeletePushMirror",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "remote name of the pushMirror",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"$ref": "#/responses/empty"
},
"400": {
"$ref": "#/responses/error"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/{repo}/raw/{filepath}": {
"get": {
"produces": [
@ -14441,6 +14668,29 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreatePushMirrorOption": {
"type": "object",
"title": "CreatePushMirrorOption represents need information to create a push mirror of a repository.",
"properties": {
"interval": {
"type": "string",
"x-go-name": "Interval"
},
"remote_address": {
"type": "string",
"x-go-name": "RemoteAddress"
},
"remote_password": {
"type": "string",
"x-go-name": "RemotePassword"
},
"remote_username": {
"type": "string",
"x-go-name": "RemoteUsername"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateReleaseOption": {
"description": "CreateReleaseOption options when creating a release",
"type": "object",
@ -17516,6 +17766,41 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"PushMirror": {
"description": "PushMirror represents information of a push mirror",
"type": "object",
"properties": {
"created": {
"type": "string",
"x-go-name": "CreatedUnix"
},
"interval": {
"type": "string",
"x-go-name": "Interval"
},
"last_error": {
"type": "string",
"x-go-name": "LastError"
},
"last_update": {
"type": "string",
"x-go-name": "LastUpdateUnix"
},
"remote_address": {
"type": "string",
"x-go-name": "RemoteAddress"
},
"remote_name": {
"type": "string",
"x-go-name": "RemoteName"
},
"repo_name": {
"type": "string",
"x-go-name": "RepoName"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"Reaction": {
"description": "Reaction contain one reaction",
"type": "object",
@ -19293,6 +19578,21 @@
}
}
},
"PushMirror": {
"description": "PushMirror",
"schema": {
"$ref": "#/definitions/PushMirror"
}
},
"PushMirrorList": {
"description": "PushMirrorList",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/PushMirror"
}
}
},
"Reaction": {
"description": "Reaction",
"schema": {
@ -19572,7 +19872,7 @@
"parameterBodies": {
"description": "parameterBodies",
"schema": {
"$ref": "#/definitions/CreateWikiPageOptions"
"$ref": "#/definitions/CreatePushMirrorOption"
}
},
"redirect": {