Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/docker/setup-build…
Browse files Browse the repository at this point in the history
…x-action-3.1.0
  • Loading branch information
MVrachev authored Mar 6, 2024
2 parents 5488bf6 + 835281e commit cbe6b36
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 240 deletions.
36 changes: 18 additions & 18 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

135 changes: 88 additions & 47 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "Repository Service for TUF API",
"description": "Repository Service for TUF Rest API",
"version": "0.11.1b1"
"version": "0.12.0b1"
},
"paths": {
"/api/v1/bootstrap/": {
Expand Down Expand Up @@ -528,6 +528,27 @@
]
}
},
"BinsRole": {
"properties": {
"expiration": {
"type": "integer",
"exclusiveMinimum": 0.0,
"title": "Expiration"
},
"number_of_delegated_bins": {
"type": "integer",
"exclusiveMaximum": 16385.0,
"exclusiveMinimum": 1.0,
"title": "Number Of Delegated Bins"
}
},
"type": "object",
"required": [
"expiration",
"number_of_delegated_bins"
],
"title": "BinsRole"
},
"BootstrapGetResponse": {
"properties": {
"data": {
Expand Down Expand Up @@ -662,17 +683,23 @@
}
},
"settings": {
"expiration": {
"bins": 1,
"root": 365,
"snapshot": 1,
"targets": 365,
"timestamp": 1
},
"services": {
"number_of_delegated_bins": 4,
"targets_base_url": "http://www.example.com/repository/",
"targets_online_key": true
"roles": {
"bins": {
"expiration": 30,
"number_of_delegated_bins": 4
},
"root": {
"expiration": 365
},
"snapshot": {
"expiration": 1
},
"targets": {
"expiration": 365
},
"timestamp": {
"expiration": 1
}
}
}
}
Expand Down Expand Up @@ -827,7 +854,6 @@
"snapshot_expiration": 1,
"snapshot_num_keys": 1,
"snapshot_threshold": 1,
"targets_base_url": "http://www.example.com/repository/",
"targets_expiration": 365,
"targets_num_keys": 1,
"targets_online_key": true,
Expand Down Expand Up @@ -1293,15 +1319,38 @@
],
"title": "ResponseData"
},
"RolesData": {
"Role": {
"properties": {
"expiration": {
"type": "integer",
"exclusiveMinimum": 0.0,
"title": "Expiration"
}
},
"type": "object",
"required": [
"expiration"
],
"title": "Role"
},
"RolesData-Input": {
"properties": {
"root": {
"$ref": "#/components/schemas/TUFMetadata-Output"
"$ref": "#/components/schemas/Role"
},
"trusted_root": {
"targets": {
"$ref": "#/components/schemas/Role"
},
"snapshot": {
"$ref": "#/components/schemas/Role"
},
"timestamp": {
"$ref": "#/components/schemas/Role"
},
"bins": {
"anyOf": [
{
"$ref": "#/components/schemas/TUFMetadata-Output"
"$ref": "#/components/schemas/BinsRole"
},
{
"type": "null"
Expand All @@ -1311,39 +1360,39 @@
},
"type": "object",
"required": [
"root"
"root",
"targets",
"snapshot",
"timestamp"
],
"title": "RolesData"
},
"ServiceSettings": {
"RolesData-Output": {
"properties": {
"targets_base_url": {
"type": "string",
"title": "Targets Base Url"
},
"number_of_delegated_bins": {
"type": "integer",
"exclusiveMaximum": 16385.0,
"exclusiveMinimum": 1.0,
"title": "Number Of Delegated Bins"
"root": {
"$ref": "#/components/schemas/TUFMetadata-Output"
},
"targets_online_key": {
"type": "boolean",
"title": "Targets Online Key"
"trusted_root": {
"anyOf": [
{
"$ref": "#/components/schemas/TUFMetadata-Output"
},
{
"type": "null"
}
]
}
},
"type": "object",
"required": [
"targets_base_url",
"number_of_delegated_bins",
"targets_online_key"
"root"
],
"title": "ServiceSettings"
"title": "RolesData"
},
"SigningData": {
"properties": {
"metadata": {
"$ref": "#/components/schemas/RolesData"
"$ref": "#/components/schemas/RolesData-Output"
}
},
"type": "object",
Expand Down Expand Up @@ -2078,21 +2127,13 @@
},
"repository_service_tuf_api__bootstrap__Settings": {
"properties": {
"expiration": {
"additionalProperties": {
"type": "integer"
},
"type": "object",
"title": "Expiration"
},
"services": {
"$ref": "#/components/schemas/ServiceSettings"
"roles": {
"$ref": "#/components/schemas/RolesData-Input"
}
},
"type": "object",
"required": [
"expiration",
"services"
"roles"
],
"title": "Settings"
},
Expand Down
2 changes: 1 addition & 1 deletion repository_service_tuf_api/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#
# SPDX-License-Identifier: MIT

version = "0.11.1b1"
version = "0.12.0b1"
copyright = "Copyright (c) 2024 Repository Service for TUF Contributors"
author = "Kairo de Araujo"
23 changes: 16 additions & 7 deletions repository_service_tuf_api/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import time
from datetime import datetime
from threading import Thread
from typing import Dict, Literal
from typing import Dict, Literal, Optional

from fastapi import HTTPException, status
from pydantic import BaseModel, ConfigDict, Field
Expand All @@ -26,20 +26,29 @@
TUFMetadata,
)

with open("tests/data_examples/bootstrap/payload.json") as f:
with open("tests/data_examples/bootstrap/payload_bins.json") as f:
content = f.read()
payload_example = json.loads(content)


class ServiceSettings(BaseModel):
targets_base_url: str
class Role(BaseModel):
expiration: int = Field(gt=0)


class BinsRole(Role):
number_of_delegated_bins: int = Field(gt=1, lt=16385)
targets_online_key: bool


class RolesData(BaseModel):
root: Role
targets: Role
snapshot: Role
timestamp: Role
bins: Optional[BinsRole] = Field(default=None)


class Settings(BaseModel):
expiration: Dict[Roles.values(), int]
services: ServiceSettings
roles: RolesData


class BootstrapPayload(BaseModel):
Expand Down
Loading

0 comments on commit cbe6b36

Please sign in to comment.