semaphoreui-client 0.1.15__py3-none-any.whl → 0.1.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- __version__ = "0.1.15"
1
+ __version__ = "0.1.16"
@@ -451,6 +451,37 @@ class SemaphoreUIClient:
451
451
  )
452
452
  return Template(**response.json(), client=self)
453
453
 
454
+ def run_template(
455
+ self,
456
+ template_id: int,
457
+ project_id: int,
458
+ debug: bool,
459
+ dry_run: bool,
460
+ diff: bool,
461
+ message: str,
462
+ git_branch: str,
463
+ limit: int,
464
+ environment_id: int,
465
+ playbook: str,
466
+ ) -> "Task":
467
+ response = self.http.post(
468
+ f"{self.api_endpoint}/project/{project_id}/tasks",
469
+ json={
470
+ "template_id": template_id,
471
+ "debug": debug,
472
+ "dry_run": dry_run,
473
+ "diff": diff,
474
+ "playbook": playbook,
475
+ "environment": environment_id,
476
+ "limit": limit,
477
+ "git_branch": git_branch,
478
+ "message": message,
479
+ },
480
+ )
481
+ assert response.status_code == 201
482
+ # The response is not quite a full task, so re-fetch it.
483
+ return self.get_project_task(project_id, response.json()["id"])
484
+
454
485
  def delete_project_template(self, project_id: int, id: int) -> None:
455
486
  response = self.http.delete(
456
487
  f"{self.api_endpoint}/project/{project_id}/templates/{id}"
@@ -909,6 +940,33 @@ class Template:
909
940
 
910
941
  client: SemaphoreUIClient
911
942
 
943
+ def run(
944
+ self,
945
+ debug: bool = False,
946
+ dry_run: bool = False,
947
+ diff: bool = False,
948
+ message: str = "",
949
+ limit: int = 1,
950
+ ) -> "Task":
951
+ repo = [
952
+ repo
953
+ for repo in self.client.get_project_repositories(self.project_id)
954
+ if repo.id == self.repository_id
955
+ ][0]
956
+ git_branch = repo.git_branch
957
+ return self.client.run_template(
958
+ self.id,
959
+ self.project_id,
960
+ debug,
961
+ dry_run,
962
+ diff,
963
+ message,
964
+ git_branch,
965
+ limit,
966
+ self.environment_id,
967
+ self.playbook,
968
+ )
969
+
912
970
  def delete(self) -> None:
913
971
  self.client.delete_project_template(self.project_id, self.id)
914
972
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semaphoreui-client
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: An api client for interacting with Semaphore UI
5
5
  Project-URL: Documentation, https://github.com/rockstar/semaphoreui-client#readme
6
6
  Project-URL: Issues, https://github.com/rockstar/semaphoreui-client/issues
@@ -0,0 +1,6 @@
1
+ semaphoreui_client/__about__.py,sha256=yF88-8vL8keLe6gCTumymw0UoMkWkSrJnzLru4zBCLQ,23
2
+ semaphoreui_client/__init__.py,sha256=VpeJavEFhs5gyfih7CoRTR4K4IGXGY3UYUkgAWj_f2U,56
3
+ semaphoreui_client/client.py,sha256=N4aJXNQN0u5zSnnFrusBeb42Kq2IXHzZmhlVGbL-mjI,32136
4
+ semaphoreui_client-0.1.16.dist-info/METADATA,sha256=xnyndpXyiVFPC1bcLd7GzUgU34it-OdGfBmCxnCcDhU,1633
5
+ semaphoreui_client-0.1.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ semaphoreui_client-0.1.16.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- semaphoreui_client/__about__.py,sha256=qb0TalpSt1CbprnFyeLUKqgrqNtmnk9IoQQ7umAoXVY,23
2
- semaphoreui_client/__init__.py,sha256=VpeJavEFhs5gyfih7CoRTR4K4IGXGY3UYUkgAWj_f2U,56
3
- semaphoreui_client/client.py,sha256=jqIi0klcWz8OPcNIMxSdNeYDdeSxEyP17hFeNFde8BA,30515
4
- semaphoreui_client-0.1.15.dist-info/METADATA,sha256=Lm4YCA3i2XjkIS1ObTysWYkpPlmvPw-4zY67_LKdghQ,1633
5
- semaphoreui_client-0.1.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- semaphoreui_client-0.1.15.dist-info/RECORD,,