semaphoreui-client 0.1.7__py3-none-any.whl → 0.1.9__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.7"
1
+ __version__ = "0.1.9"
@@ -507,6 +507,35 @@ class SemaphoreUIClient:
507
507
  )
508
508
  assert response.status_code == 204
509
509
 
510
+ def get_project_tasks(self, project_id: int) -> typing.List["Task"]:
511
+ response = self.http.get(f"{self.api_endpoint}/project/{project_id}/tasks")
512
+ assert response.status_code == 200
513
+ return [Task(**task, client=self) for task in response.json()]
514
+
515
+ def stop_project_task(self, project_id: int, id: int) -> None:
516
+ response = self.http.post(
517
+ f"{self.api_endpoint}/project/{project_id}/tasks/{id}/stop"
518
+ )
519
+ assert response.status_code == 204
520
+
521
+ def get_project_task(self, project_id: int, id: int) -> "Task":
522
+ response = self.http.get(f"{self.api_endpoint}/project/{project_id}/tasks/{id}")
523
+ assert response.status_code == 200
524
+ return Task(**response.json(), project_id=project_id, client=self)
525
+
526
+ def delete_project_task(self, project_id: int, id: int) -> None:
527
+ response = self.http.delete(
528
+ f"{self.api_endpoint}/project/{project_id}/tasks/{id}"
529
+ )
530
+ assert response.status_code == 204
531
+
532
+ def get_project_task_output(self, project_id: int, id: int) -> "TaskOutput":
533
+ response = self.http.get(
534
+ f"{self.api_endpoint}/project/{project_id}/tasks/{id}/output"
535
+ )
536
+ assert response.status_code == 200
537
+ return TaskOutput(**response.json())
538
+
510
539
 
511
540
  @dataclass
512
541
  class Integration:
@@ -711,6 +740,12 @@ class Project:
711
740
  self.id, template_id, name, cron_format, active
712
741
  )
713
742
 
743
+ def tasks(self) -> typing.List["Task"]:
744
+ return self.client.get_project_tasks(self.id)
745
+
746
+ def get_task(self, task_id: int) -> "Task":
747
+ return self.client.get_project_task(self.id, task_id)
748
+
714
749
 
715
750
  @dataclass
716
751
  class Permissions:
@@ -897,3 +932,38 @@ class Schedule:
897
932
 
898
933
  def delete(self) -> None:
899
934
  self.client.delete_project_schedule(self.project_id, self.id)
935
+
936
+
937
+ @dataclass
938
+ class Task:
939
+ id: int
940
+ template_id: int
941
+ status: str
942
+ debug: bool
943
+ playbook: str
944
+ environment: str
945
+ secret: str
946
+ limit: str
947
+ git_branch: str
948
+ message: str
949
+
950
+ # Project id isn't included in the api type, but is required
951
+ # to perform operations.
952
+ project_id: int
953
+ client: SemaphoreUIClient
954
+
955
+ def stop(self) -> None:
956
+ self.client.stop_project_task(self.project_id, self.id)
957
+
958
+ def delete(self) -> None:
959
+ self.client.delete_project_task(self.project_id, self.id)
960
+
961
+ def output(self) -> "TaskOutput":
962
+ return self.client.get_project_task_output(self.project_id, self.id)
963
+
964
+
965
+ @dataclass
966
+ class TaskOutput:
967
+ task_id: int
968
+ time: str
969
+ output: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semaphoreui-client
3
- Version: 0.1.7
3
+ Version: 0.1.9
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=XIaxbMbyiP-L3kguR1GhxirFblTXiHR1lMfDVITvHUI,22
2
+ semaphoreui_client/__init__.py,sha256=VpeJavEFhs5gyfih7CoRTR4K4IGXGY3UYUkgAWj_f2U,56
3
+ semaphoreui_client/client.py,sha256=HQ89kvCNVqwzxxi0sIwYaekbVSaRlK1yDu87IbKCixM,29890
4
+ semaphoreui_client-0.1.9.dist-info/METADATA,sha256=odl0WZvWO_uUxrU1ZIk6AFoRvGgIwimGDV6z8pagxEQ,1632
5
+ semaphoreui_client-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ semaphoreui_client-0.1.9.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- semaphoreui_client/__about__.py,sha256=YpKDcdV7CqL8n45u267wKtyloM13FSVbOdrqgNZnSLM,22
2
- semaphoreui_client/__init__.py,sha256=VpeJavEFhs5gyfih7CoRTR4K4IGXGY3UYUkgAWj_f2U,56
3
- semaphoreui_client/client.py,sha256=9m_6KJsUHXdSOpE2azhvoaHc0C5uMy-FLuBuyu-oqUM,27663
4
- semaphoreui_client-0.1.7.dist-info/METADATA,sha256=_9tNJyKkj5dsvStjtth6Q4hHnobaoxCyEfbxkHVHaCc,1632
5
- semaphoreui_client-0.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- semaphoreui_client-0.1.7.dist-info/RECORD,,