repository_service_tuf.helpers package

Submodules

repository_service_tuf.helpers.api_client module

class repository_service_tuf.helpers.api_client.Methods(*values)[source]

Bases: Enum

DELETE = 'delete'
GET = 'get'
POST = 'post'
class repository_service_tuf.helpers.api_client.URL(*values)[source]

Bases: Enum

ARTIFACTS = 'api/v1/artifacts/'
ARTIFACTS_DELETE = 'api/v1/artifacts/delete'
BOOTSTRAP = 'api/v1/bootstrap/'
CONFIG = 'api/v1/config/'
DELEGATIONS = 'api/v1/delegations/'
DELEGATIONS_DELETE = 'api/v1/delegations/delete'
METADATA = 'api/v1/metadata/'
METADATA_SIGN = 'api/v1/metadata/sign/'
METADATA_SIGN_DELETE = 'api/v1/metadata/sign/delete'
PUBLISH_ARTIFACTS = 'api/v1/artifacts/publish/'
TASK = 'api/v1/task/?task_id='
repository_service_tuf.helpers.api_client.bootstrap_status(settings: LazySettings) Dict[str, Any][source]
repository_service_tuf.helpers.api_client.get_task(task_id: str, settings: LazySettings) tuple[Dict[str, Any], Response][source]
repository_service_tuf.helpers.api_client.publish_artifacts(settings: LazySettings) str[source]
repository_service_tuf.helpers.api_client.request_server(server: str, url: str, method: Methods, payload: Dict[str, Any] | None = None, data: Dict[str, Any] | None = None, headers: Dict[str, str] | None = None) Response[source]
repository_service_tuf.helpers.api_client.send_payload(settings: LazySettings, url: str, payload: Dict[str, Any], expected_msg: str, command_name: str, expected_status_code: int | None = 202) str[source]

Send ‘payload’ to a given ‘settings.SERVER’.

Args:

settings: the command context settings object url: one of the URLs to a given endpoint as defined in api_client.py payload: dictionary containing the payload to send expected_msg: expected message to receive as a response to the request command_name: name of the command sending the payload, used for logging expected_status_code: [Optional] expected status code. Default: 202

Returns:

Task id of the job sending the payload.

repository_service_tuf.helpers.api_client.task_status(task_id: str, settings: LazySettings, title: str | None, silent: bool | None = False) Dict[str, Any][source]

repository_service_tuf.helpers.cli module

class repository_service_tuf.helpers.cli.AddPayload(artifacts: List[Artifact], add_task_id_to_custom: bool = False, publish_artifacts: bool = True)[source]

Bases: object

The POST /api/v1/artifacts/ required payload.

add_task_id_to_custom: bool = False
artifacts: List[Artifact]
publish_artifacts: bool = True
to_dict()[source]
class repository_service_tuf.helpers.cli.Artifact(info: ArtifactInfo, path: str)[source]

Bases: object

An artifact of AddPayload

info: ArtifactInfo
path: str
class repository_service_tuf.helpers.cli.ArtifactInfo(length: int, hashes: Dict[PayloadArtifactsHashes, str], custom: Dict[str, Any] | None)[source]

Bases: object

The target information of a Targets role.

custom: Dict[str, Any] | None
hashes: Dict[PayloadArtifactsHashes, str]
length: int
class repository_service_tuf.helpers.cli.DeletePayload(artifacts: List[str])[source]

Bases: object

The POST /api/v1/artifacts/delete required payload.

artifacts: List[str]
to_dict()[source]
class repository_service_tuf.helpers.cli.PayloadArtifactsHashes(*values)[source]

Bases: str, Enum

The supported hashes of ArtifactsInfo

blake2b_256 = 'blake2b-256'
repository_service_tuf.helpers.cli.calculate_blake2b_256(filepath: str) str[source]

Calculate the blake2b-256 hash of the given file

Parameters:

filepath – The file path to calculate the hash.

repository_service_tuf.helpers.cli.create_artifact_add_payload_from_filepath(filepath: str, path: str | None) Dict[str, Any][source]

Create the payload for the API request of POST api/v1/artifacts/. The blake2b-256 cryptographic hash function is used to hash the file.

Parameters:
  • filepath – The file path to calculate the hash.

  • path – The path defined in the metadata for the artifact.

repository_service_tuf.helpers.cli.create_artifact_delete_payload_from_filepath(path: str) Dict[str, Any][source]

Create the payload for the API request of POST api/v1/artifacts/delete.

Module contents