semaphoreui-client 0.1.0__py3-none-any.whl → 0.1.2__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.0"
1
+ __version__ = "0.1.2"
@@ -187,28 +187,43 @@ class SemaphoreUIClient:
187
187
  ) -> "Key":
188
188
  if key_type not in ("ssh", "login_password"):
189
189
  raise ValueError(f"Invalid key_type: {key_type}. Acceptable values are: ssh, login_password")
190
- if key_type == "ssh" and ssh is None:
191
- raise ValueError("ssh parameter must be set on key_type: ssh")
192
- elif key_type == "login_password" and login_password is None:
193
- raise ValueError("login_password parameter must be set on key_type: login_password")
194
- response = self.http.post(
195
- f"{self.api_endpoint}/project/{project_id}/keys",
196
- json={
190
+ if key_type == "ssh":
191
+ if ssh is None:
192
+ raise ValueError("ssh parameter must be set on key_type: ssh")
193
+ json_data = json={
197
194
  "id": 0,
198
195
  "project_id": project_id,
199
196
  "name": name,
200
197
  "type": key_type,
201
198
  "override_secret": override_secret,
202
199
  "login_password": {
203
- "login": login_password[0],
204
- "password": login_password[1],
200
+ "login": "",
201
+ "password": "",
205
202
  },
206
203
  "ssh": {
207
204
  "login": ssh[0],
208
205
  "passphrase": ssh[1],
209
206
  "private_key": ssh[2],
210
207
  },
211
- },
208
+ }
209
+ elif key_type == "login_password":
210
+ if login_password is None:
211
+ raise ValueError("login_password parameter must be set on key_type: login_password")
212
+ json_data = {
213
+ "id": 0,
214
+ "project_id": project_id,
215
+ "name": name,
216
+ "type": key_type,
217
+ "override_secret": override_secret,
218
+ "login_password": {
219
+ "login": login_password[0],
220
+ "password": login_password[1],
221
+ },
222
+ "ssh": {"login": "", "passphrase": "", "private_key": ""}
223
+ }
224
+ response = self.http.post(
225
+ f"{self.api_endpoint}/project/{project_id}/keys",
226
+ json=json_data
212
227
  )
213
228
  assert response.status_code == 204
214
229
 
@@ -374,7 +389,7 @@ class SemaphoreUIClient:
374
389
  inventory_id: int,
375
390
  environment_id: int,
376
391
  view_id: int,
377
- vaults: typing.List[typing.Dict[str, typing.Any]],
392
+ vault_id: int,
378
393
  playbook: str,
379
394
  arguments: str,
380
395
  description: str,
@@ -398,7 +413,7 @@ class SemaphoreUIClient:
398
413
  "repository_id": repository_id,
399
414
  "environment_id": environment_id,
400
415
  "view_id": view_id,
401
- "vaults": vaults,
416
+ "vault_key_id": vault_id,
402
417
  "name": name,
403
418
  "playbook": playbook,
404
419
  "arguments": arguments,
@@ -517,10 +532,9 @@ class Project:
517
532
  self,
518
533
  name: str,
519
534
  key_type: str,
520
- override_secret: bool,
521
- string: str,
522
- login_password: typing.Optional[typing.Tuple[str, str]],
523
- ssh: typing.Optional[typing.Tuple[str, str, str]],
535
+ override_secret: bool=False,
536
+ login_password: typing.Optional[typing.Tuple[str, str]]=None,
537
+ ssh: typing.Optional[typing.Tuple[str, str, str]]=None,
524
538
  ):
525
539
  return self.client.create_project_key(
526
540
  self.id, name, key_type, override_secret, login_password, ssh
@@ -583,7 +597,7 @@ class Project:
583
597
  inventory_id: int,
584
598
  environment_id: int,
585
599
  view_id: int,
586
- vaults: typing.List[typing.Dict[str, typing.Any]],
600
+ vault_id: int,
587
601
  playbook: str,
588
602
  arguments: str,
589
603
  description: str,
@@ -605,7 +619,7 @@ class Project:
605
619
  inventory_id,
606
620
  environment_id,
607
621
  view_id,
608
- vaults,
622
+ vault_id,
609
623
  playbook,
610
624
  arguments,
611
625
  description,
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: semaphoreui-client
3
+ Version: 0.1.2
4
+ Summary: An api client for interacting with Semaphore UI
5
+ Project-URL: Documentation, https://github.com/rockstar/semaphoreui-client#readme
6
+ Project-URL: Issues, https://github.com/rockstar/semaphoreui-client/issues
7
+ Project-URL: Source, https://github.com/rockstar/semaphoreui-client
8
+ Author-email: Paul Hummer <paul@eventuallyanyway.com>
9
+ License-Expression: MIT
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: Implementation :: CPython
17
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
18
+ Requires-Python: >=3.9
19
+ Requires-Dist: dataclasses-json>=0.6.7
20
+ Requires-Dist: requests>=2.32.3
21
+ Description-Content-Type: text/markdown
22
+
23
+ A python client for SemaphoreUI
24
+ ==
25
+
26
+ This library provides an api client for the SemaphoreUI api. Its purpose is to provide an ergonomic and python interface, both in api and behavior.
27
+
28
+ To install,
29
+
30
+ ```shell
31
+ $ pip install semaphoreui-client
32
+ ```
33
+
34
+ To use,
35
+
36
+ ```python
37
+ from semaphoreui_client import Client
38
+
39
+ client = Client("https://path.to/your/semaphore")
40
+ client.login("username", "myPassW0rd")
41
+
42
+ for project in client.projects():
43
+ print(project.name)
44
+ ```
45
+
46
+ This library is being used in production environments, but is still early in its development. As such, caution should be exercised when using this library--its api is still heavily in flux.
@@ -0,0 +1,6 @@
1
+ semaphoreui_client/__about__.py,sha256=K5SiDdEGYMpdqXThrqwTqECJJBOQNTQDrnpc2K5mzKs,21
2
+ semaphoreui_client/__init__.py,sha256=r2j1tTgwFzp3AKAktr8izDIXllRf-Y0SdHAjInYDTP0,55
3
+ semaphoreui_client/client.py,sha256=CBw2BUELSuwguRGt1hczE0yEUMTG63uHkWvh9VO4_4Y,24716
4
+ semaphoreui_client-0.1.2.dist-info/METADATA,sha256=D7_PSIOOZichIN1JmhIMxuwiuv0HbV7z6wGoDsoeJj8,1632
5
+ semaphoreui_client-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ semaphoreui_client-0.1.2.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"
@@ -1,20 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: semaphoreui-client
3
- Version: 0.1.0
4
- Summary: An api client for interacting with Semaphore UI
5
- Project-URL: Documentation, https://github.com/Paul Hummer/semaphoreui-client#readme
6
- Project-URL: Issues, https://github.com/Paul Hummer/semaphoreui-client/issues
7
- Project-URL: Source, https://github.com/Paul Hummer/semaphoreui-client
8
- Author-email: Paul Hummer <paul@eventuallyanyway.com>
9
- License-Expression: MIT
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Programming Language :: Python
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: Implementation :: CPython
17
- Classifier: Programming Language :: Python :: Implementation :: PyPy
18
- Requires-Python: >=3.9
19
- Requires-Dist: dataclasses-json>=0.6.7
20
- Requires-Dist: requests>=2.32.3
@@ -1,7 +0,0 @@
1
- semaphoreui_client/__about__.py,sha256=Pru0BlFBASFCFo7McHdohtKkUtgMPDwbGfyUZlE2_Vw,21
2
- semaphoreui_client/__about__.py.backup,sha256=Pru0BlFBASFCFo7McHdohtKkUtgMPDwbGfyUZlE2_Vw,21
3
- semaphoreui_client/__init__.py,sha256=r2j1tTgwFzp3AKAktr8izDIXllRf-Y0SdHAjInYDTP0,55
4
- semaphoreui_client/client.py,sha256=dTR1ExrXwGOtPXTqmQZx5iia7uZ8zlDAkFZC_5t-3Bo,24280
5
- semaphoreui_client-0.1.0.dist-info/METADATA,sha256=HgH0R8iNzgUhehXqm3xX3cLanj_ZHypl5J34IEq4TBE,955
6
- semaphoreui_client-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- semaphoreui_client-0.1.0.dist-info/RECORD,,