repository_service_tuf_api package

Subpackages

Submodules

repository_service_tuf_api.artifacts module

repository_service_tuf_api.bootstrap module

repository_service_tuf_api.common_models module

class repository_service_tuf_api.common_models.BaseErrorResponse(*, error: str, details: Dict[str, str] | None = None, code: int | None = None)[source]

Bases: BaseModel

code: int | None
details: Dict[str, str] | None
error: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class repository_service_tuf_api.common_models.Roles(*values)[source]

Bases: Enum

BINS = 'bins'
ROOT = 'root'
SNAPSHOT = 'snapshot'
TARGETS = 'targets'
TIMESTAMP = 'timestamp'
static all_str() str[source]
static is_role(input: Any) bool[source]
static online_roles_values() List[str][source]
static values() List[str][source]
class repository_service_tuf_api.common_models.TUFDelegations(*, keys: Dict[str, TUFKeys], roles: List[TUFSignedDelegationsRoles])[source]

Bases: BaseModel

keys: Dict[str, TUFKeys]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

roles: List[TUFSignedDelegationsRoles]
class repository_service_tuf_api.common_models.TUFKeys(*, keytype: str, scheme: str, keyval: Dict[Literal['public', 'issuer', 'identity'], str], name: str | None = None, x_rstuf_key_name: str | None = None, x_rstuf_online_key_uri: str | None = None)[source]

Bases: BaseModel

keytype: str
keyval: Dict[Literal['public', 'issuer', 'identity'], str]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
scheme: str
x_rstuf_key_name: str | None
x_rstuf_online_key_uri: str | None
class repository_service_tuf_api.common_models.TUFMetadata(*, signatures: List[TUFSignatures], signed: TUFSigned)[source]

Bases: BaseModel

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

signatures: List[TUFSignatures]
signed: TUFSigned
class repository_service_tuf_api.common_models.TUFSignatures(*, keyid: str, sig: str, bundle: Dict[str, Any] | None = None)[source]

Bases: BaseModel

bundle: Dict[str, Any] | None
keyid: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

sig: str
class repository_service_tuf_api.common_models.TUFSigned(*, _type: str, version: int, spec_version: str, expires: str, keys: Dict[str, TUFKeys] | None = None, consistent_snapshot: bool | None = None, roles: Dict[Literal['root', 'targets', 'snapshot', 'timestamp', 'bins'], TUFSignedRoles] | None = None, meta: Dict[str, TUFSignedMetaFile] | None = None, targets: Dict[str, str] | None = None, delegations: TUFSignedDelegations | None = None, **extra_data: Any)[source]

Bases: BaseModel

consistent_snapshot: bool | None
delegations: TUFSignedDelegations | None
expires: str
keys: Dict[str, TUFKeys] | None
meta: Dict[str, TUFSignedMetaFile] | None
model_config = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

roles: Dict[Literal['root', 'targets', 'snapshot', 'timestamp', 'bins'], TUFSignedRoles] | None
spec_version: str
targets: Dict[str, str] | None
type: str
classmethod validate_unrecognized_fields(values: Dict[str, Any]) Dict[str, Any][source]
version: int
class repository_service_tuf_api.common_models.TUFSignedDelegations(*, keys: Dict[str, TUFKeys], roles: List[TUFSignedDelegationsRoles] | None, succinct_roles: TUFSignedDelegationsSuccinctRoles | None)[source]

Bases: BaseModel

keys: Dict[str, TUFKeys]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

roles: List[TUFSignedDelegationsRoles] | None
succinct_roles: TUFSignedDelegationsSuccinctRoles | None
class repository_service_tuf_api.common_models.TUFSignedDelegationsRoles(*, name: str, terminating: bool, keyids: List[str], threshold: int, paths: Annotated[List[str], MinLen(min_length=1)], path_hash_prefixes: List[str] | None = None, x_rstuf_expire_policy: int = None)[source]

Bases: BaseModel

keyids: List[str]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
path_hash_prefixes: List[str] | None
paths: List[str]
terminating: bool
threshold: int
classmethod validate_path_patterns(values: Dict[str, Any])[source]
x_rstuf_expire_policy: int
class repository_service_tuf_api.common_models.TUFSignedDelegationsSuccinctRoles(*, bit_length: Annotated[int, Gt(gt=0), Lt(lt=15)], name_prefix: str, keyids: List[str], threshold: int)[source]

Bases: BaseModel

bit_length: int
keyids: List[str]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name_prefix: str
threshold: int
class repository_service_tuf_api.common_models.TUFSignedMetaFile(*, version: int)[source]

Bases: BaseModel

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

version: int
class repository_service_tuf_api.common_models.TUFSignedRoles(*, keyids: List[str], threshold: int)[source]

Bases: BaseModel

keyids: List[str]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

threshold: int

repository_service_tuf_api.config module

repository_service_tuf_api.delegations module

repository_service_tuf_api.metadata module

repository_service_tuf_api.tasks module

class repository_service_tuf_api.tasks.GetParameters(*, task_id: str)[source]

Bases: BaseModel

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

task_id: str
class repository_service_tuf_api.tasks.Response(*, data: TasksData, message: str | None = None)[source]

Bases: BaseModel

data: TasksData
message: str | None
model_config = {'json_schema_extra': {'example': {'data': {'result': {'details': {'added_artifacts': ['file1.tar.gz'], 'invalid_paths': ['invalid_file.tar.gz'], 'target_roles': ['bins-3']}, 'last_update': '2023-11-17T09:54:15.762882', 'message': 'Artifact(s) Added', 'status': True, 'task': TaskName.ADD_ARTIFACTS}, 'state': TaskState.SUCCESS, 'task_id': '33e66671dcc84cdfa2535a1eb030104c'}, 'message': 'Task state.'}}}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class repository_service_tuf_api.tasks.TaskName(*values)[source]

Bases: str, Enum

ADD_ARTIFACTS = 'add_artifacts'
BOOTSTRAP = 'bootstrap'
DELETE_SIGN_METADATA = 'delete_sign_metadata'
METADATA_DELEGATION = 'metadata_delegation'
METADATA_UPDATE = 'metadata_update'
PUBLISH_ARTIFACTS = 'publish_artifacts'
REMOVE_ARTIFACTS = 'remove_artifacts'
SIGN_METADATA = 'sign_metadata'
UPDATE_SETTINGS = 'update_settings'
class repository_service_tuf_api.tasks.TaskResult(*, message: str | None = None, error: str | None = None, status: None | bool = None, task: TaskName | None = None, last_update: datetime | None = None, details: Dict[str, Any] | None = None)[source]

Bases: BaseModel

details: Dict[str, Any] | None
error: str | None
last_update: datetime | None
message: str | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

status: None | bool
task: TaskName | None
class repository_service_tuf_api.tasks.TaskState(*values)[source]

Bases: str, Enum

ERRORED = 'ERRORED'
FAILURE = 'FAILURE'
IGNORED = 'IGNORED'
PENDING = 'PENDING'
PRE_RUN = 'PRE_RUN'
RECEIVED = 'RECEIVED'
REJECTED = 'REJECTED'
RETRY = 'RETRY'
REVOKED = 'REVOKED'
RUNNING = 'RUNNING'
STARTED = 'STARTED'
SUCCESS = 'SUCCESS'
class repository_service_tuf_api.tasks.TasksData(*, task_id: str, state: TaskState, result: TaskResult | None = None)[source]

Bases: BaseModel

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

result: TaskResult | None
state: TaskState
task_id: str
repository_service_tuf_api.tasks.get(task_id: str) Response[source]

Get the task details from Result Backend Server.

Uses the Celery implementation in repository_service_tuf_api.metadata.metadata_repository.AsyncResult to fetch from Result Backend the task state.

Args:

task_id: Task ID

Returns:

Response as BaseModel from pydantic

Module contents

class repository_service_tuf_api.BootstrapState(bootstrap: bool, state: str | None = None, task_id: str | None = None)[source]

Bases: object

bootstrap: bool
state: str | None = None
task_id: str | None = None
repository_service_tuf_api.bootstrap_state() BootstrapState[source]

Bootstrap state

The bootstrap state is registered in Redis. Detailed definitions are available in https://repository-service-tuf.readthedocs.io/en/stable/devel/design.html#tuf-repository-settings # noqa

repository_service_tuf_api.get_task_id()[source]
repository_service_tuf_api.pre_lock_bootstrap(task_id)[source]

Add a pre-lock to the bootstrap repository settings.

Add to the repository settings in Redis the lock as pre-<task_id>.

Args:

task_id: Task id generated by bootstrap

repository_service_tuf_api.release_bootstrap_lock()[source]

Remove the pre-lock from repository settings.

Move the repository settings BOOTSTRAP to None if not finished.