|
|
@@ -11,6 +11,21 @@ import (
|
|
|
"github.com/porter-dev/porter/api/types"
|
|
|
)
|
|
|
|
|
|
+// swagger:parameters getRegistry deleteRegistry createRegistryRepository listRegistryRepositories listRegistryImages
|
|
|
+type registryPathParams struct {
|
|
|
+ // The project id
|
|
|
+ // in: path
|
|
|
+ // required: true
|
|
|
+ // minimum: 1
|
|
|
+ ProjectID uint `json:"project_id"`
|
|
|
+
|
|
|
+ // The registry id
|
|
|
+ // in: path
|
|
|
+ // required: true
|
|
|
+ // minimum: 1
|
|
|
+ RegistryID uint `json:"registry_id"`
|
|
|
+}
|
|
|
+
|
|
|
func NewV1RegistryScopedRegisterer(children ...*router.Registerer) *router.Registerer {
|
|
|
return &router.Registerer{
|
|
|
GetRoutes: GetV1RegistryScopedRoutes,
|
|
|
@@ -56,6 +71,30 @@ func getV1RegistryRoutes(
|
|
|
var routes []*router.Route
|
|
|
|
|
|
// POST /api/v1/projects/{project_id}/registries -> registry.NewRegistryCreateHandler
|
|
|
+ // swagger:operation POST /api/v1/projects/{project_id}/registries createRegistry
|
|
|
+ //
|
|
|
+ // Connects a new image registry
|
|
|
+ //
|
|
|
+ // ---
|
|
|
+ // produces:
|
|
|
+ // - application/json
|
|
|
+ // summary: Connect an image registry
|
|
|
+ // tags:
|
|
|
+ // - Registries
|
|
|
+ // parameters:
|
|
|
+ // - name: project_id
|
|
|
+ // - in: body
|
|
|
+ // name: CreateRegistryRequest
|
|
|
+ // description: The registry to connect
|
|
|
+ // schema:
|
|
|
+ // $ref: '#/definitions/CreateRegistryRequest'
|
|
|
+ // responses:
|
|
|
+ // '201':
|
|
|
+ // description: Successfully connected the registry
|
|
|
+ // schema:
|
|
|
+ // $ref: '#/definitions/CreateRegistryResponse'
|
|
|
+ // '403':
|
|
|
+ // description: Forbidden
|
|
|
createRegistryEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbCreate,
|
|
|
@@ -84,6 +123,26 @@ func getV1RegistryRoutes(
|
|
|
})
|
|
|
|
|
|
// GET /api/v1/projects/{project_id}/registries/{registry_id} -> registry.NewRegistryGetHandler
|
|
|
+ // swagger:operation GET /api/v1/projects/{project_id}/registries/{registry_id} getRegistry
|
|
|
+ //
|
|
|
+ // Gets an image registry
|
|
|
+ //
|
|
|
+ // ---
|
|
|
+ // produces:
|
|
|
+ // - application/json
|
|
|
+ // summary: Get an image registry
|
|
|
+ // tags:
|
|
|
+ // - Registries
|
|
|
+ // parameters:
|
|
|
+ // - name: project_id
|
|
|
+ // - name: registry_id
|
|
|
+ // responses:
|
|
|
+ // '201':
|
|
|
+ // description: Successfully got the registry
|
|
|
+ // schema:
|
|
|
+ // $ref: '#/definitions/GetRegistryResponse'
|
|
|
+ // '403':
|
|
|
+ // description: Forbidden
|
|
|
getEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
|
@@ -112,6 +171,26 @@ func getV1RegistryRoutes(
|
|
|
})
|
|
|
|
|
|
// GET /api/v1/projects/{project_id}/registries -> registry.NewRegistryListHandler
|
|
|
+ // swagger:operation GET /api/v1/projects/{project_id}/registries listRegistries
|
|
|
+ //
|
|
|
+ // Lists registries
|
|
|
+ //
|
|
|
+ // ---
|
|
|
+ // produces:
|
|
|
+ // - application/json
|
|
|
+ // summary: List image registries
|
|
|
+ // tags:
|
|
|
+ // - Registries
|
|
|
+ // parameters:
|
|
|
+ // - name: project_id
|
|
|
+ // - name: registry_id
|
|
|
+ // responses:
|
|
|
+ // '200':
|
|
|
+ // description: Successfully listed registries
|
|
|
+ // schema:
|
|
|
+ // $ref: '#/definitions/ListRegistriesResponse'
|
|
|
+ // '403':
|
|
|
+ // description: Forbidden
|
|
|
listRegistriesEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbList,
|
|
|
@@ -139,6 +218,24 @@ func getV1RegistryRoutes(
|
|
|
})
|
|
|
|
|
|
// DELETE /api/v1/projects/{project_id}/registries/{registry_id} -> registry.NewRegistryDeleteHandler
|
|
|
+ // swagger:operation DELETE /api/v1/projects/{project_id}/registries/{registry_id} deleteRegistry
|
|
|
+ //
|
|
|
+ // Deletes an image registry.
|
|
|
+ //
|
|
|
+ // ---
|
|
|
+ // produces:
|
|
|
+ // - application/json
|
|
|
+ // summary: Disconnect image registry
|
|
|
+ // tags:
|
|
|
+ // - Registries
|
|
|
+ // parameters:
|
|
|
+ // - name: project_id
|
|
|
+ // - name: registry_id
|
|
|
+ // responses:
|
|
|
+ // '200':
|
|
|
+ // description: Successfully disconnected image registry
|
|
|
+ // '403':
|
|
|
+ // description: Forbidden
|
|
|
deleteEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbDelete,
|
|
|
@@ -167,6 +264,30 @@ func getV1RegistryRoutes(
|
|
|
})
|
|
|
|
|
|
// POST /api/v1/projects/{project_id}/registries/{registry_id}/repositories -> registry.NewRegistryCreateRepositoryHandler
|
|
|
+ // swagger:operation POST /api/v1/projects/{project_id}/registries/{registry_id}/repositories createRegistryRepository
|
|
|
+ //
|
|
|
+ // Creates an image repository inside the registry specified by `registry_id`. This method **only** creates repositories for ECR-integrated
|
|
|
+ // repositories.
|
|
|
+ //
|
|
|
+ // ---
|
|
|
+ // produces:
|
|
|
+ // - application/json
|
|
|
+ // summary: Create image repository
|
|
|
+ // tags:
|
|
|
+ // - Registries
|
|
|
+ // parameters:
|
|
|
+ // - name: project_id
|
|
|
+ // - name: registry_id
|
|
|
+ // - in: body
|
|
|
+ // name: CreateRepositoryRequest
|
|
|
+ // description: The repository to create
|
|
|
+ // schema:
|
|
|
+ // $ref: '#/definitions/CreateRegistryRepositoryRequest'
|
|
|
+ // responses:
|
|
|
+ // '201':
|
|
|
+ // description: Successfully created the image repository
|
|
|
+ // '403':
|
|
|
+ // description: Forbidden
|
|
|
createRepositoryEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbCreate,
|
|
|
@@ -196,6 +317,26 @@ func getV1RegistryRoutes(
|
|
|
})
|
|
|
|
|
|
// GET /api/v1/projects/{project_id}/registries/{registry_id}/repositories -> registry.NewRegistryListRepositoriesHandler
|
|
|
+ // swagger:operation GET /api/v1/projects/{project_id}/registries/{registry_id}/repositories listRegistryRepositories
|
|
|
+ //
|
|
|
+ // Lists image repositories inside the image registry given by `registry_id`
|
|
|
+ //
|
|
|
+ // ---
|
|
|
+ // produces:
|
|
|
+ // - application/json
|
|
|
+ // summary: List image repositories
|
|
|
+ // tags:
|
|
|
+ // - Registries
|
|
|
+ // parameters:
|
|
|
+ // - name: project_id
|
|
|
+ // - name: registry_id
|
|
|
+ // responses:
|
|
|
+ // '200':
|
|
|
+ // description: Successfully listed image repositories
|
|
|
+ // schema:
|
|
|
+ // $ref: '#/definitions/ListRegistryRepositoriesResponse'
|
|
|
+ // '403':
|
|
|
+ // description: Forbidden
|
|
|
listRepositoriesEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbList,
|
|
|
@@ -224,6 +365,31 @@ func getV1RegistryRoutes(
|
|
|
})
|
|
|
|
|
|
// GET /api/v1/projects/{project_id}/registries/{registry_id}/repositories/* -> registry.NewRegistryListImagesHandler
|
|
|
+ // swagger:operation GET /api/v1/projects/{project_id}/registries/{registry_id}/repositories/{repository} listRegistryImages
|
|
|
+ //
|
|
|
+ // Lists all images in an image repository.
|
|
|
+ //
|
|
|
+ // ---
|
|
|
+ // produces:
|
|
|
+ // - application/json
|
|
|
+ // summary: List images
|
|
|
+ // tags:
|
|
|
+ // - Registries
|
|
|
+ // parameters:
|
|
|
+ // - name: project_id
|
|
|
+ // - name: registry_id
|
|
|
+ // - name: repository
|
|
|
+ // in: path
|
|
|
+ // description: the image repository name
|
|
|
+ // type: string
|
|
|
+ // required: true
|
|
|
+ // responses:
|
|
|
+ // '200':
|
|
|
+ // description: Successfully listed images
|
|
|
+ // schema:
|
|
|
+ // $ref: '#/definitions/ListImagesResponse'
|
|
|
+ // '403':
|
|
|
+ // description: Forbidden
|
|
|
listImagesEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbList,
|