datacrunch 1.11.0__py3-none-any.whl → 1.12.0__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.
datacrunch/__version__.py CHANGED
@@ -1 +1 @@
1
- VERSION = '1.11.0'
1
+ VERSION = '1.12.0'
@@ -4,6 +4,8 @@ This module provides functionality for managing container deployments, including
4
4
  creation, updates, deletion, and monitoring of containerized applications.
5
5
  """
6
6
 
7
+ import base64
8
+ import os
7
9
  from dataclasses import dataclass, field
8
10
  from dataclasses_json import dataclass_json, Undefined # type: ignore
9
11
  from typing import List, Optional, Dict, Any
@@ -18,6 +20,7 @@ CONTAINER_DEPLOYMENTS_ENDPOINT = '/container-deployments'
18
20
  SERVERLESS_COMPUTE_RESOURCES_ENDPOINT = '/serverless-compute-resources'
19
21
  CONTAINER_REGISTRY_CREDENTIALS_ENDPOINT = '/container-registry-credentials'
20
22
  SECRETS_ENDPOINT = '/secrets'
23
+ FILESET_SECRETS_ENDPOINT = '/file-secrets'
21
24
 
22
25
 
23
26
  class EnvVarType(str, Enum):
@@ -27,6 +30,13 @@ class EnvVarType(str, Enum):
27
30
  SECRET = "secret"
28
31
 
29
32
 
33
+ class SecretType(str, Enum):
34
+ """Types of secrets that can be set in containers."""
35
+
36
+ GENERIC = "generic" # Regular secret, can be used in env vars
37
+ FILESET = "file-secret" # A file secret that can be mounted into the container
38
+
39
+
30
40
  class VolumeMountType(str, Enum):
31
41
  """Types of volume mounts that can be configured for containers."""
32
42
 
@@ -446,10 +456,12 @@ class Secret:
446
456
  Attributes:
447
457
  name: Name of the secret.
448
458
  created_at: Timestamp when the secret was created.
459
+ secret_type: Type of the secret.
449
460
  """
450
461
 
451
462
  name: str
452
463
  created_at: str
464
+ secret_type: SecretType
453
465
 
454
466
 
455
467
  @dataclass_json
@@ -909,6 +921,7 @@ class ContainersService:
909
921
  List[Secret]: List of all secrets.
910
922
  """
911
923
  response = self.client.get(SECRETS_ENDPOINT)
924
+ print(response.json())
912
925
  return [Secret.from_dict(secret) for secret in response.json()]
913
926
 
914
927
  def create_secret(self, name: str, value: str) -> None:
@@ -956,3 +969,42 @@ class ContainersService:
956
969
  """
957
970
  self.client.delete(
958
971
  f"{CONTAINER_REGISTRY_CREDENTIALS_ENDPOINT}/{credentials_name}")
972
+
973
+ def get_fileset_secrets(self) -> List[Secret]:
974
+ """Retrieves all fileset secrets.
975
+
976
+ Returns:
977
+ List of all fileset secrets.
978
+ """
979
+ response = self.client.get(FILESET_SECRETS_ENDPOINT)
980
+ return [Secret.from_dict(secret) for secret in response.json()]
981
+
982
+ def delete_fileset_secret(self, secret_name: str) -> None:
983
+ """Deletes a fileset secret.
984
+
985
+ Args:
986
+ secret_name: Name of the secret to delete.
987
+ """
988
+ self.client.delete(f"{FILESET_SECRETS_ENDPOINT}/{secret_name}")
989
+
990
+ def create_fileset_secret_from_file_paths(self, secret_name: str, file_paths: List[str]) -> None:
991
+ """Creates a new fileset secret.
992
+ A fileset secret is a secret that contains several files,
993
+ and can be used to mount a directory with the files in a container.
994
+
995
+ Args:
996
+ secret_name: Name of the secret.
997
+ file_paths: List of file paths to include in the secret.
998
+ """
999
+ processed_files = []
1000
+ for file_path in file_paths:
1001
+ with open(file_path, "rb") as f:
1002
+ base64_content = base64.b64encode(f.read()).decode("utf-8")
1003
+ processed_files.append({
1004
+ "file_name": os.path.basename(file_path),
1005
+ "base64_content": base64_content
1006
+ })
1007
+ self.client.post(FILESET_SECRETS_ENDPOINT, {
1008
+ "name": secret_name,
1009
+ "files": processed_files
1010
+ })
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datacrunch
3
- Version: 1.11.0
3
+ Version: 1.12.0
4
4
  Summary: Official Python SDK for DataCrunch Public API
5
5
  Home-page: https://github.com/DataCrunch-io
6
6
  Author: DataCrunch Oy
@@ -1,5 +1,5 @@
1
1
  datacrunch/__init__.py,sha256=OG-5Avmuq3NXyBs_66GMwyzscUi0c-T6vWW5sRIfnZg,51
2
- datacrunch/__version__.py,sha256=PZXNp6jInd8yQ1-bKHKA0wcJLwj4YpA4waxO3RnKNa0,19
2
+ datacrunch/__version__.py,sha256=o_CvBCGiCiaIWFGapX_FcRb3zCO9gmamKVsYWQWdAmY,19
3
3
  datacrunch/constants.py,sha256=i0jCX91H2lKp1Uvk4GDsaTeXk0WmjyeSGpMfPs69BB4,2378
4
4
  datacrunch/datacrunch.py,sha256=2IqrTY39sLuwtuQ_QP3jCI1d5AaCwriYgAUEFoZZzPU,3488
5
5
  datacrunch/exceptions.py,sha256=uOP_YU2HEUi_mcMxQ9WYrIjqWUuUrwdube-RdL1C4Ps,781
@@ -11,7 +11,7 @@ datacrunch/authentication/authentication.py,sha256=CThTxA99jseh7TKIdUR1M9RErIJoX
11
11
  datacrunch/balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  datacrunch/balance/balance.py,sha256=rkqqXC3MLVxk6ym9Hlp9tsLbLWJculIn8q3BYbsme28,1240
13
13
  datacrunch/containers/__init__.py,sha256=T9ROCN-a3rQfboTk3mol4OUhi6FMo5wUqahJZOBg0uw,675
14
- datacrunch/containers/containers.py,sha256=6KXt3OFvcagXlgL7peWTVgqcFwVRsfrEAFQXtsqX64U,31283
14
+ datacrunch/containers/containers.py,sha256=xGDlHi8nAbYZyP039_VbNba_Z0Mk-RI1N3XlHISM3Ao,33167
15
15
  datacrunch/http_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  datacrunch/http_client/http_client.py,sha256=tmpVd3p7-NAIaTM4E13inFZWUetdVEFZnRE38p5eVk0,8285
17
17
  datacrunch/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -30,7 +30,7 @@ datacrunch/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
30
30
  datacrunch/volume_types/volume_types.py,sha256=CNJ8kfd_nxmF99x-UAJeku-uN4Gdh-yg15Aa8WGLgWU,1828
31
31
  datacrunch/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  datacrunch/volumes/volumes.py,sha256=aAH4UIVG-7NehjHu-a_4MGSdZ1jmeApV-kKh-X6TB-s,11908
33
- datacrunch-1.11.0.dist-info/licenses/LICENSE,sha256=LkdhbR2MArjDfV8M0dySL5mG_kfzxF2ntMgbJvWGyUQ,1069
33
+ datacrunch-1.12.0.dist-info/licenses/LICENSE,sha256=LkdhbR2MArjDfV8M0dySL5mG_kfzxF2ntMgbJvWGyUQ,1069
34
34
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  tests/integration_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  tests/integration_tests/conftest.py,sha256=PWf6K1G3NoddebmDIy_Pk02dHQrEKfrNxpWwqE8Eqrk,546
@@ -46,7 +46,7 @@ tests/unit_tests/authentication/test_authentication.py,sha256=P84VnD9utk8y3ZPhUf
46
46
  tests/unit_tests/balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  tests/unit_tests/balance/test_balance.py,sha256=Cojbjd7wc9-8eRQb_fR0xLXEX7fGqobdQICH3O7WAx4,651
48
48
  tests/unit_tests/containers/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
49
- tests/unit_tests/containers/test_containers.py,sha256=T23I-Sb0VbCJAeIYwFniW9XELrNvL06A7lycU2MyL84,30977
49
+ tests/unit_tests/containers/test_containers.py,sha256=lr7Thrpl5hC6iBG91YjBUEpkv6t6CVnXjIzkXmvXg0U,31011
50
50
  tests/unit_tests/http_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  tests/unit_tests/http_client/test_http_client.py,sha256=JfEy7pADx0gS9KNNwVLVeG-bG4DRRXxze4dQkP_WIvw,6776
52
52
  tests/unit_tests/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -63,7 +63,7 @@ tests/unit_tests/volume_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
63
63
  tests/unit_tests/volume_types/test_volume_types.py,sha256=vGuC3dWjhQLD8bTYgw_we3dZ6vlUKRmKZbb9yCfhe0w,1386
64
64
  tests/unit_tests/volumes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
65
  tests/unit_tests/volumes/test_volumes.py,sha256=p53eSIHddWKL7U9oLLTnxo849LrJSoi6A5lpWF6ydHs,20672
66
- datacrunch-1.11.0.dist-info/METADATA,sha256=G2A9RigmIn__-clRNM6vUd-J3A7uM_mwaDBjR0_SI3U,6261
67
- datacrunch-1.11.0.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
68
- datacrunch-1.11.0.dist-info/top_level.txt,sha256=FvH4EZJkbUxNm-aKx0RjmWwnduAMpfRT13Fo123i7yE,17
69
- datacrunch-1.11.0.dist-info/RECORD,,
66
+ datacrunch-1.12.0.dist-info/METADATA,sha256=EoUDXb19WnnqRmbjakFTxgSlC_BAThYyCWLMfHuqz3I,6261
67
+ datacrunch-1.12.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
68
+ datacrunch-1.12.0.dist-info/top_level.txt,sha256=FvH4EZJkbUxNm-aKx0RjmWwnduAMpfRT13Fo123i7yE,17
69
+ datacrunch-1.12.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.0.0)
2
+ Generator: setuptools (80.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -134,7 +134,8 @@ COMPUTE_RESOURCES_DATA = [
134
134
  SECRETS_DATA = [
135
135
  {
136
136
  "name": SECRET_NAME,
137
- "created_at": "2023-01-01T00:00:00+00:00"
137
+ "created_at": "2023-01-01T00:00:00+00:00",
138
+ "secret_type": "generic"
138
139
  }
139
140
  ]
140
141