Skip to content

Commit

Permalink
Fixes 2615: add config.repo endpoint (#414)
Browse files Browse the repository at this point in the history
* Fixes 2615: add repo config file endpoint

* address review comments

* review comments

* add support for repository response

* add repo path to list

* fix popular repositories
  • Loading branch information
rverdile authored Oct 18, 2023
1 parent 62b7023 commit 6f89eb3
Show file tree
Hide file tree
Showing 37 changed files with 1,038 additions and 378 deletions.
70 changes: 70 additions & 0 deletions api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,69 @@ const docTemplate = `{
}
}
},
"/repositories/{uuid}/snapshots/{snapshot_uuid}/config.repo": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"text/plain"
],
"tags": [
"repositories"
],
"summary": "Get configuration file of a repository",
"operationId": "getRepoConfigurationFile",
"parameters": [
{
"type": "string",
"description": "Identifier of the repository",
"name": "uuid",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Identifier of the snapshot",
"name": "snapshot_uuid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/errors.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/errors.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/errors.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/errors.ErrorResponse"
}
}
}
}
},
"/repository_parameters/": {
"get": {
"description": "List repository parameters.",
Expand Down Expand Up @@ -1897,6 +1960,13 @@ const docTemplate = `{
"repository_path": {
"description": "Path to repository snapshot contents",
"type": "string"
},
"url": {
"description": "URL to the snapshot's content",
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
Expand Down
88 changes: 88 additions & 0 deletions api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,13 @@
"repository_path": {
"description": "Path to repository snapshot contents",
"type": "string"
},
"url": {
"description": "URL to the snapshot's content",
"type": "string"
},
"uuid": {
"type": "string"
}
},
"type": "object"
Expand Down Expand Up @@ -1942,6 +1949,87 @@
]
}
},
"/repositories/{uuid}/snapshots/{snapshot_uuid}/config.repo": {
"get": {
"operationId": "getRepoConfigurationFile",
"parameters": [
{
"description": "Identifier of the repository",
"in": "path",
"name": "uuid",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Identifier of the snapshot",
"in": "path",
"name": "snapshot_uuid",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
},
"description": "OK"
},
"400": {
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/errors.ErrorResponse"
}
}
},
"description": "Bad Request"
},
"401": {
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/errors.ErrorResponse"
}
}
},
"description": "Unauthorized"
},
"404": {
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/errors.ErrorResponse"
}
}
},
"description": "Not Found"
},
"500": {
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/errors.ErrorResponse"
}
}
},
"description": "Internal Server Error"
}
},
"summary": "Get configuration file of a repository",
"tags": [
"repositories"
]
}
},
"/repository_parameters/": {
"get": {
"description": "List repository parameters.",
Expand Down
48 changes: 0 additions & 48 deletions cmd/test/main.go.bak

This file was deleted.

53 changes: 0 additions & 53 deletions cmd/test/main.go.listupstreampulps

This file was deleted.

63 changes: 0 additions & 63 deletions cmd/test/main.go.multirequest

This file was deleted.

4 changes: 3 additions & 1 deletion configs/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ clients:
host: localhost
port: 6379
db: 1
expiration: 30s
expiration:
rbac: 1m
pulp_content_path: 1h

# Configuration for the mocks
mocks:
Expand Down
8 changes: 7 additions & 1 deletion pkg/api/snapshots.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package api

import "time"
import (
"time"
)

type SnapshotResponse struct {
UUID string `json:"uuid"`
CreatedAt time.Time `json:"created_at"` // Datetime the snapshot was created
RepositoryPath string `json:"repository_path"` // Path to repository snapshot contents
ContentCounts map[string]int64 `json:"content_counts"` // Count of each content type
AddedCounts map[string]int64 `json:"added_counts"` // Count of each content type
RemovedCounts map[string]int64 `json:"removed_counts"` // Count of each content type
URL string `json:"url"` // URL to the snapshot's content
}

type SnapshotCollectionResponse struct {
Expand All @@ -20,3 +24,5 @@ func (r *SnapshotCollectionResponse) SetMetadata(meta ResponseMetadata, links Li
r.Meta = meta
r.Links = links
}

type RepositoryConfigurationFile string
Loading

0 comments on commit 6f89eb3

Please sign in to comment.