diff --git a/src/main/python/ddadevops/application/artifact_deployment_service.py b/src/main/python/ddadevops/application/artifact_deployment_service.py index f90847a..e7e3c61 100644 --- a/src/main/python/ddadevops/application/artifact_deployment_service.py +++ b/src/main/python/ddadevops/application/artifact_deployment_service.py @@ -1,15 +1,27 @@ -from ..infrastructure import GitApi - +from ..infrastructure import GitApi, ArtifactDeploymentApi +from ..domain import Credentials class ArtifactDeploymentService: - def __init__(self, git_api: GitApi): + def __init__(self, git_api: GitApi, artifact_deployment_api: ArtifactDeploymentApi): self.git_api = git_api + self.artifact_deployment_api = artifact_deployment_api @classmethod def prod(cls): return cls( GitApi(), + ArtifactDeploymentApi(), ) -# def __get_base_artifact_release_url(self, base_url: str, organization: str, name: str) -> str: -# return f"{base_url}/{organization}/{name}/releases" + def __get_base_artifact_release_url(self, base_url: str, organization: str, name: str) -> str: + return f"{base_url}/{organization}/{name}/releases" + + def post_release(self, target_url: str, tag: str, credentials: Credentials): + response = self.artifact_deployment_api.post_release(target_url, tag, credentials.mappings["token"]) + # Get release id from response + + def post_asset(self, target_url: str, release_id: str, attachment: str, attachment_type: str, token: str): + self.artifact_deployment_api.post_asset(target_url, release_id, attachment, attachment_type, token) + + def calculate_checksums(self, build_path: str): + self.artifact_deployment_api.calculate_checksums(build_path)