hirundo 0.1.8__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.
hirundo/enum.py CHANGED
@@ -1,14 +1,15 @@
1
1
  from enum import Enum
2
2
 
3
3
 
4
- class LabellingType(str, Enum):
4
+ class LabelingType(str, Enum):
5
5
  """
6
- Enum indicate what type of labelling is used for the given dataset.
6
+ Enum indicate what type of labeling is used for the given dataset.
7
7
  Supported types are:
8
8
  """
9
9
 
10
- SingleLabelClassification = "SingleLabelClassification"
11
- ObjectDetection = "ObjectDetection"
10
+ SINGLE_LABEL_CLASSIFICATION = "SingleLabelClassification"
11
+ OBJECT_DETECTION = "ObjectDetection"
12
+ SPEECH_TO_TEXT = "SpeechToText"
12
13
 
13
14
 
14
15
  class DatasetMetadataType(str, Enum):
@@ -17,4 +18,6 @@ class DatasetMetadataType(str, Enum):
17
18
  Supported types are:
18
19
  """
19
20
 
20
- HirundoCSV = "HirundoCSV"
21
+ HIRUNDO_CSV = "HirundoCSV"
22
+ COCO = "COCO"
23
+ YOLO = "YOLO"
hirundo/git.py CHANGED
@@ -1,12 +1,13 @@
1
+ import datetime
1
2
  import re
2
3
  import typing
3
- from typing import Annotated
4
4
 
5
5
  import pydantic
6
6
  import requests
7
7
  from pydantic import BaseModel, field_validator
8
8
  from pydantic_core import Url
9
9
 
10
+ from hirundo._constraints import RepoUrl
10
11
  from hirundo._env import API_HOST
11
12
  from hirundo._headers import get_auth_headers, json_headers
12
13
  from hirundo._http import raise_for_status_with_reason
@@ -48,7 +49,7 @@ class GitRepo(BaseModel):
48
49
  """
49
50
  A name to identify the Git repository in the Hirundo system.
50
51
  """
51
- repository_url: Annotated[str, Url]
52
+ repository_url: typing.Union[str, RepoUrl]
52
53
  """
53
54
  The URL of the Git repository, it should start with `ssh://` or `https://` or be in the form `user@host:path`.
54
55
  If it is in the form `user@host:path`, it will be rewritten to `ssh://user@host:path`.
@@ -84,30 +85,45 @@ class GitRepo(BaseModel):
84
85
 
85
86
  @field_validator("repository_url", mode="before", check_fields=True)
86
87
  @classmethod
87
- def check_valid_repository_url(cls, repository_url: str):
88
- # Check if the URL already has a protocol
89
- if not re.match(r"^[a-z]+://", repository_url):
90
- # Check if the URL has the `@` and `:` pattern with a non-numeric section before the next slash
91
- match = re.match(r"([^@]+@[^:]+):([^0-9/][^/]*)/(.+)", repository_url)
92
- if match:
93
- user_host = match.group(1)
94
- path = match.group(2) + "/" + match.group(3)
95
- rewritten_url = f"ssh://{user_host}/{path}"
96
- logger.info("Modified Git repo to add SSH protocol", rewritten_url)
97
- return rewritten_url
98
- if not repository_url.startswith("ssh://") and not repository_url.startswith(
99
- "https://"
100
- ):
88
+ def check_valid_repository_url(cls, repository_url: typing.Union[str, RepoUrl]):
89
+ # Check if the URL has the `@` and `:` pattern with a non-numeric section before the next slash
90
+ match = re.match("([^@]+@[^:]+):([^0-9/][^/]*)/(.+)", str(repository_url))
91
+ if match:
92
+ user_host = match.group(1)
93
+ path = match.group(2) + "/" + match.group(3)
94
+ rewritten_url = Url(f"ssh://{user_host}/{path}")
95
+ # Check if the URL already has a protocol
96
+ url_scheme = rewritten_url.scheme
97
+ logger.info(
98
+ "Modified Git repo to replace %s@%s:%s/%s with %s",
99
+ url_scheme,
100
+ match.group(1),
101
+ match.group(2),
102
+ match.group(3),
103
+ rewritten_url,
104
+ )
105
+ return rewritten_url
106
+ if not str(repository_url).startswith("ssh://") and not str(
107
+ repository_url
108
+ ).startswith("https://"):
101
109
  raise ValueError("Repository URL must start with 'ssh://' or 'https://'")
110
+ if not isinstance(repository_url, Url):
111
+ repository_url = Url(repository_url)
102
112
  return repository_url
103
113
 
104
- def create(self):
114
+ def create(self, replace_if_exists: bool = False) -> int:
105
115
  """
106
116
  Create a Git repository in the Hirundo system.
117
+
118
+ Args:
119
+ replace_if_exists: If a Git repository with the same name already exists, replace it.
107
120
  """
108
121
  git_repo = requests.post(
109
122
  f"{API_HOST}/git-repo/",
110
- json=self.model_dump(),
123
+ json={
124
+ **self.model_dump(mode="json"),
125
+ "replace_if_exists": replace_if_exists,
126
+ },
111
127
  headers={
112
128
  **json_headers,
113
129
  **get_auth_headers(),
@@ -120,7 +136,41 @@ class GitRepo(BaseModel):
120
136
  return git_repo_id
121
137
 
122
138
  @staticmethod
123
- def list():
139
+ def get_by_id(git_repo_id: int) -> "GitRepoOut":
140
+ """
141
+ Retrieves a `GitRepo` instance from the server by its ID
142
+
143
+ Args:
144
+ git_repo_id: The ID of the `GitRepo` to retrieve
145
+ """
146
+ git_repo = requests.get(
147
+ f"{API_HOST}/git-repo/{git_repo_id}",
148
+ headers=get_auth_headers(),
149
+ timeout=READ_TIMEOUT,
150
+ )
151
+ raise_for_status_with_reason(git_repo)
152
+ return GitRepoOut(**git_repo.json())
153
+
154
+ @staticmethod
155
+ def get_by_name(
156
+ name: str,
157
+ ) -> "GitRepoOut":
158
+ """
159
+ Retrieves a `GitRepo` instance from the server by its name
160
+
161
+ Args:
162
+ name: The name of the `GitRepo` to retrieve
163
+ """
164
+ git_repo = requests.get(
165
+ f"{API_HOST}/git-repo/by-name/{name}",
166
+ headers=get_auth_headers(),
167
+ timeout=READ_TIMEOUT,
168
+ )
169
+ raise_for_status_with_reason(git_repo)
170
+ return GitRepoOut(**git_repo.json())
171
+
172
+ @staticmethod
173
+ def list() -> list["GitRepoOut"]:
124
174
  """
125
175
  List all Git repositories in the Hirundo system.
126
176
  """
@@ -132,7 +182,13 @@ class GitRepo(BaseModel):
132
182
  timeout=READ_TIMEOUT,
133
183
  )
134
184
  raise_for_status_with_reason(git_repos)
135
- return git_repos.json()
185
+ git_repo_json = git_repos.json()
186
+ return [
187
+ GitRepoOut(
188
+ **git_repo,
189
+ )
190
+ for git_repo in git_repo_json
191
+ ]
136
192
 
137
193
  @staticmethod
138
194
  def delete_by_id(git_repo_id: int):
@@ -158,3 +214,12 @@ class GitRepo(BaseModel):
158
214
  if not self.id:
159
215
  raise ValueError("No GitRepo has been created")
160
216
  GitRepo.delete_by_id(self.id)
217
+
218
+
219
+ class GitRepoOut(BaseModel):
220
+ id: int
221
+ name: str
222
+ repository_url: RepoUrl
223
+
224
+ created_at: datetime.datetime
225
+ updated_at: datetime.datetime
hirundo/storage.py CHANGED
@@ -1,42 +1,130 @@
1
1
  import typing
2
2
  from enum import Enum
3
+ from pathlib import Path
3
4
 
4
5
  import pydantic
5
6
  import requests
6
7
  from pydantic import BaseModel, model_validator
7
8
  from pydantic_core import Url
8
9
 
9
- from hirundo._constraints import S3BucketUrl, StorageIntegrationName
10
+ from hirundo._constraints import S3BucketUrl, StorageConfigName
10
11
  from hirundo._env import API_HOST
11
12
  from hirundo._headers import get_auth_headers, json_headers
12
13
  from hirundo._http import raise_for_status_with_reason
13
14
  from hirundo._timeouts import MODIFY_TIMEOUT, READ_TIMEOUT
14
- from hirundo.git import GitRepo
15
+ from hirundo.git import GitRepo, GitRepoOut
15
16
  from hirundo.logger import get_logger
16
17
 
17
18
  logger = get_logger(__name__)
18
19
 
20
+ S3_PREFIX = "s3://"
19
21
 
20
- class StorageS3(BaseModel):
22
+
23
+ class StorageS3Base(BaseModel):
21
24
  endpoint_url: typing.Optional[Url] = None
22
25
  bucket_url: S3BucketUrl
23
26
  region_name: str
24
27
  # ⬆️ We could restrict this, but if we're allowing custom endpoints then the validation may be wrong
25
28
  access_key_id: typing.Optional[str] = None
29
+
30
+ def get_url(self, path: typing.Union[str, Path]) -> Url:
31
+ """
32
+ Get the full URL for a file in the S3 bucket
33
+
34
+ Chains the bucket URL with the path, ensuring that the path is formatted correctly
35
+
36
+ Args:
37
+ - path: The path to the file in the S3 bucket, e.g. `my-file.txt` or `/my-folder/my-file.txt`
38
+
39
+ Returns:
40
+ The full URL to the file in the S3 bucket, e.g. `s3://my-bucket/my-file.txt` or `s3://my-bucket/my-folder/my-file.txt`,
41
+ where `s3://my-bucket` is the bucket URL provided in the S3 storage config
42
+ """
43
+ return Url(
44
+ f"{S3_PREFIX}{self.bucket_url.removeprefix(S3_PREFIX).removesuffix('/')}/{str(path).removeprefix('/')}"
45
+ )
46
+
47
+
48
+ class StorageS3(StorageS3Base):
26
49
  secret_access_key: typing.Optional[str] = None
27
50
 
28
51
 
29
- class StorageGCP(BaseModel):
52
+ class StorageS3Out(StorageS3Base):
53
+ pass
54
+
55
+
56
+ class StorageGCPBase(BaseModel):
30
57
  bucket_name: str
31
58
  project: str
59
+
60
+ def get_url(self, path: typing.Union[str, Path]) -> Url:
61
+ """
62
+ Get the full URL for a file in the GCP bucket
63
+
64
+ Chains the bucket URL with the path, ensuring that the path is formatted correctly
65
+
66
+ Args:
67
+ - path: The path to the file in the GCP bucket, e.g. `my-file.txt` or `/my-folder/my-file.txt`
68
+
69
+ Returns:
70
+ The full URL to the file in the GCP bucket, e.g. `gs://my-bucket/my-file.txt` or `gs://my-bucket/my-folder/my-file.txt`,
71
+ where `my-bucket` is the bucket name provided in the GCP storage config
72
+ """
73
+ return Url(f"gs://{self.bucket_name}/{str(path).removeprefix('/')}")
74
+
75
+
76
+ class StorageGCP(StorageGCPBase):
32
77
  credentials_json: typing.Optional[dict] = None
33
78
 
34
79
 
35
- # TODO: Azure storage integration is coming soon
80
+ class StorageGCPOut(StorageGCPBase):
81
+ pass
82
+
83
+
84
+ # TODO: Azure storage config is coming soon
36
85
  # class StorageAzure(BaseModel):
86
+ # account_url: HttpUrl
87
+ # container_name: str
88
+ # tenant_id: str
89
+
90
+ # def get_url(self, path: typing.Union[str, Path]) -> Url:
91
+ # """
92
+ # Get the full URL for a file in the Azure container
93
+
94
+ # Chains the container URL with the path, ensuring that the path is formatted correctly
95
+
96
+ # Args:
97
+ # - path: The path to the file in the Azure container, e.g. `my-file.txt` or `/my-folder/my-file.txt`
98
+
99
+ # Returns:
100
+ # The full URL to the file in the Azure container
101
+ # """
102
+ # return Url(f"{str(self.account_url)}/{self.container_name}/{str(path).removeprefix('/')}")
103
+ # class StorageAzureOut(BaseModel):
37
104
  # container: str
38
- # account_name: str
39
- # account_key: str
105
+ # account_url: str
106
+
107
+
108
+ def get_git_repo_url(
109
+ repo_url: typing.Union[str, Url], path: typing.Union[str, Path]
110
+ ) -> Url:
111
+ """
112
+ Get the full URL for a file in the git repository
113
+
114
+ Chains the repository URL with the path, ensuring that the path is formatted correctly
115
+
116
+ Args:
117
+ - repo_url: The URL of the git repository, e.g. `https://my-git-repository.com`
118
+ - path: The path to the file in the git repository, e.g. `my-file.txt` or `/my-folder/my-file.txt`
119
+
120
+ Returns:
121
+ The full URL to the file in the git repository, e.g. `https://my-git-repository.com/my-file.txt` or `https://my-git-repository.com/my-folder/my-file.txt`
122
+ """
123
+ if not isinstance(repo_url, Url):
124
+ repo_url = Url(repo_url)
125
+ return Url(
126
+ f"{repo_url.scheme}{str(repo_url).removeprefix(repo_url.scheme)}/{str(path).removeprefix('/')}"
127
+ )
40
128
 
41
129
 
42
130
  class StorageGit(BaseModel):
@@ -61,46 +149,88 @@ class StorageGit(BaseModel):
61
149
  raise ValueError("Either repo_id or repo must be provided")
62
150
  return self
63
151
 
152
+ def get_url(self, path: typing.Union[str, Path]) -> Url:
153
+ """
154
+ Get the full URL for a file in the git repository
155
+
156
+ Chains the repository URL with the path, ensuring that the path is formatted correctly
157
+
158
+ Args:
159
+ - path: The path to the file in the git repository, e.g. `my-file.txt` or `/my-folder/my-file.txt`
160
+
161
+ Returns:
162
+ The full URL to the file in the git repository, e.g. `https://my-git-repository.com/my-file.txt` or `https://my-git-repository.com/my-folder/my-file.txt`,
163
+ where `https://my-git-repository.com` is the repository URL provided in the git storage config's git repo
164
+ """
165
+ if not self.repo:
166
+ raise ValueError("Repo must be provided to use `get_url`")
167
+ repo_url = self.repo.repository_url
168
+ return get_git_repo_url(repo_url, path)
169
+
170
+
171
+ class StorageGitOut(BaseModel):
172
+ repo: GitRepoOut
173
+ branch: str
174
+
175
+ def get_url(self, path: typing.Union[str, Path]) -> Url:
176
+ """
177
+ Get the full URL for a file in the git repository
178
+
179
+ Chains the repository URL with the path, ensuring that the path is formatted correctly
180
+
181
+ Args:
182
+ - path: The path to the file in the git repository, e.g. `my-file.txt` or `/my-folder/my-file.txt`
183
+
184
+ Returns:
185
+ The full URL to the file in the git repository, e.g. `https://my-git-repository.com/my-file.txt` or `https://my-git-repository.com/my-folder/my-file.txt`,
186
+ where `https://my-git-repository.com` is the repository URL provided in the git storage config's git repo
187
+ """
188
+ repo_url = self.repo.repository_url
189
+ return get_git_repo_url(repo_url, path)
190
+
64
191
 
65
192
  class StorageTypes(str, Enum):
66
193
  """
67
- Enum for the different types of storage integrations.
194
+ Enum for the different types of storage configs.
68
195
  Supported types are:
69
196
  """
70
197
 
71
198
  S3 = "S3"
72
199
  GCP = "GCP"
73
- # AZURE = "Azure" TODO: Azure storage integration is coming soon
200
+ # AZURE = "Azure" TODO: Azure storage config is coming soon
74
201
  GIT = "Git"
75
202
  LOCAL = "Local"
76
203
  """
77
- Local storage integration is only supported for on-premises installations.
204
+ Local storage config is only supported for on-premises installations.
78
205
  """
79
206
 
80
207
 
81
- class StorageIntegration(BaseModel):
208
+ class StorageConfig(BaseModel):
82
209
  id: typing.Optional[int] = None
210
+ """
211
+ The ID of the `StorageConfig` in the Hirundo system.
212
+ """
83
213
 
84
214
  organization_id: typing.Optional[int] = None
85
215
  """
86
- The ID of the organization that the `StorageIntegration` belongs to.
216
+ The ID of the organization that the `StorageConfig` belongs to.
87
217
  If not provided, it will be assigned to your default organization.
88
218
  """
89
219
 
90
- name: StorageIntegrationName
220
+ name: StorageConfigName
91
221
  """
92
- A name to identify the `StorageIntegration` in the Hirundo system.
222
+ A name to identify the `StorageConfig` in the Hirundo system.
93
223
  """
94
224
  type: typing.Optional[StorageTypes] = pydantic.Field(
95
225
  examples=[
96
226
  StorageTypes.S3,
97
227
  StorageTypes.GCP,
98
- # StorageTypes.AZURE, TODO: Azure storage integration is coming soon
228
+ # StorageTypes.AZURE, TODO: Azure storage is coming soon
99
229
  StorageTypes.GIT,
100
230
  ]
101
231
  )
102
232
  """
103
- The type of the `StorageIntegration`.
233
+ The type of the `StorageConfig`.
104
234
  Supported types are:
105
235
  - `S3`
106
236
  - `GCP`
@@ -122,7 +252,7 @@ class StorageIntegration(BaseModel):
122
252
  ],
123
253
  )
124
254
  """
125
- The Amazon Web Services (AWS) S3 storage integration details.
255
+ The Amazon Web Services (AWS) S3 storage config details.
126
256
  Use this if you want to link to an S3 bucket.
127
257
  """
128
258
  gcp: typing.Optional[StorageGCP] = pydantic.Field(
@@ -151,7 +281,7 @@ class StorageIntegration(BaseModel):
151
281
  ],
152
282
  )
153
283
  """
154
- The Google Cloud (GCP) Storage integration details.
284
+ The Google Cloud (GCP) Storage config details.
155
285
  Use this if you want to link to an GCS bucket.
156
286
  """
157
287
  azure: None = None
@@ -167,7 +297,7 @@ class StorageIntegration(BaseModel):
167
297
  # },
168
298
  # None,
169
299
  # ],
170
- # ) TODO: Azure storage integration is coming soon
300
+ # ) TODO: Azure storage config is coming soon
171
301
  git: typing.Optional[StorageGit] = pydantic.Field(
172
302
  default=None,
173
303
  examples=[
@@ -186,73 +316,116 @@ class StorageIntegration(BaseModel):
186
316
  ],
187
317
  )
188
318
  """
189
- The Git storage integration details.
319
+ The Git storage config details.
190
320
  Use this if you want to link to a Git repository.
191
321
  """
192
322
 
193
323
  @staticmethod
194
- def list(organization_id: typing.Optional[int] = None) -> list[dict]:
324
+ def get_by_id(storage_config_id: int) -> "ResponseStorageConfig":
195
325
  """
196
- Lists all the `StorageIntegration`'s created by user's default organization
197
- Note: The return type is `list[dict]` and not `list[StorageIntegration]`
326
+ Retrieves a `StorageConfig` instance from the server by its ID
198
327
 
199
328
  Args:
200
- organization_id: The ID of the organization to list `StorageIntegration`'s for.
201
- If not provided, it will list `StorageIntegration`'s for the default organization.
329
+ storage_config_id: The ID of the `StorageConfig` to retrieve
202
330
  """
203
- storage_integrations = requests.get(
204
- f"{API_HOST}/storage-integration/",
205
- params={"storage_integration_organization_id": organization_id},
331
+ storage_config = requests.get(
332
+ f"{API_HOST}/storage-config/{storage_config_id}",
206
333
  headers=get_auth_headers(),
207
334
  timeout=READ_TIMEOUT,
208
335
  )
209
- raise_for_status_with_reason(storage_integrations)
210
- return storage_integrations.json()
336
+ raise_for_status_with_reason(storage_config)
337
+ return ResponseStorageConfig(**storage_config.json())
211
338
 
212
339
  @staticmethod
213
- def delete_by_id(storage_integration_id) -> None:
340
+ def get_by_name(name: str, storage_type: StorageTypes) -> "ResponseStorageConfig":
214
341
  """
215
- Deletes a `StorageIntegration` instance from the server by its ID
342
+ Retrieves a `StorageConfig` instance from the server by its name
216
343
 
217
344
  Args:
218
- storage_integration_id: The ID of the `StorageIntegration` to delete
345
+ name: The name of the `StorageConfig` to retrieve
346
+ storage_type: The type of the `StorageConfig` to retrieve
347
+
348
+ Note: The type is required because the name is not unique across different storage types
219
349
  """
220
- storage_integration = requests.delete(
221
- f"{API_HOST}/storage-integration/{storage_integration_id}",
350
+ storage_config = requests.get(
351
+ f"{API_HOST}/storage-config/by-name/{name}?storage_type={storage_type.value}",
352
+ headers=get_auth_headers(),
353
+ timeout=READ_TIMEOUT,
354
+ )
355
+ raise_for_status_with_reason(storage_config)
356
+ return ResponseStorageConfig(**storage_config.json())
357
+
358
+ @staticmethod
359
+ def list(
360
+ organization_id: typing.Optional[int] = None,
361
+ ) -> list["ResponseStorageConfig"]:
362
+ """
363
+ Lists all the `StorageConfig`'s created by user's default organization
364
+ Note: The return type is `list[dict]` and not `list[StorageConfig]`
365
+
366
+ Args:
367
+ organization_id: The ID of the organization to list `StorageConfig`'s for.
368
+ If not provided, it will list `StorageConfig`'s for the default organization.
369
+ """
370
+ storage_configs = requests.get(
371
+ f"{API_HOST}/storage-config/",
372
+ params={"storage_config_organization_id": organization_id},
373
+ headers=get_auth_headers(),
374
+ timeout=READ_TIMEOUT,
375
+ )
376
+ raise_for_status_with_reason(storage_configs)
377
+ return [ResponseStorageConfig(**si) for si in storage_configs.json()]
378
+
379
+ @staticmethod
380
+ def delete_by_id(storage_config_id) -> None:
381
+ """
382
+ Deletes a `StorageConfig` instance from the server by its ID
383
+
384
+ Args:
385
+ storage_config_id: The ID of the `StorageConfig` to delete
386
+ """
387
+ storage_config = requests.delete(
388
+ f"{API_HOST}/storage-config/{storage_config_id}",
222
389
  headers=get_auth_headers(),
223
390
  timeout=MODIFY_TIMEOUT,
224
391
  )
225
- raise_for_status_with_reason(storage_integration)
226
- logger.info("Deleted storage integration with ID: %s", storage_integration_id)
392
+ raise_for_status_with_reason(storage_config)
393
+ logger.info("Deleted storage config with ID: %s", storage_config_id)
227
394
 
228
395
  def delete(self) -> None:
229
396
  """
230
- Deletes the `StorageIntegration` instance from the server
397
+ Deletes the `StorageConfig` instance from the server
231
398
  """
232
399
  if not self.id:
233
- raise ValueError("No StorageIntegration has been created")
400
+ raise ValueError("No StorageConfig has been created")
234
401
  self.delete_by_id(self.id)
235
402
 
236
- def create(self) -> int:
403
+ def create(self, replace_if_exists: bool = False) -> int:
237
404
  """
238
- Create a `StorageIntegration` instance on the server
405
+ Create a `StorageConfig` instance on the server
406
+
407
+ Args:
408
+ replace_if_exists: If a `StorageConfig` with the same name and type already exists, replace it.
239
409
  """
240
410
  if self.git and self.git.repo:
241
- self.git.repo_id = self.git.repo.create()
242
- storage_integration = requests.post(
243
- f"{API_HOST}/storage-integration/",
244
- json=self.model_dump(),
411
+ self.git.repo_id = self.git.repo.create(replace_if_exists=replace_if_exists)
412
+ storage_config = requests.post(
413
+ f"{API_HOST}/storage-config/",
414
+ json={
415
+ **self.model_dump(mode="json"),
416
+ "replace_if_exists": replace_if_exists,
417
+ },
245
418
  headers={
246
419
  **json_headers,
247
420
  **get_auth_headers(),
248
421
  },
249
422
  timeout=MODIFY_TIMEOUT,
250
423
  )
251
- raise_for_status_with_reason(storage_integration)
252
- storage_integration_id = storage_integration.json()["id"]
253
- self.id = storage_integration_id
254
- logger.info("Created storage integration with ID: %s", storage_integration_id)
255
- return storage_integration_id
424
+ raise_for_status_with_reason(storage_config)
425
+ storage_config_id = storage_config.json()["id"]
426
+ self.id = storage_config_id
427
+ logger.info("Created storage config with ID: %s", storage_config_id)
428
+ return storage_config_id
256
429
 
257
430
  @model_validator(mode="after")
258
431
  def validate_storage_type(self):
@@ -281,15 +454,13 @@ class StorageIntegration(BaseModel):
281
454
  return self
282
455
 
283
456
 
284
- class StorageLink(BaseModel):
285
- storage_integration: StorageIntegration
286
- """
287
- The `StorageIntegration` instance to link to.
288
- """
289
- path: str = "/"
290
- """
291
- Path for the `root` to link to within the `StorageIntegration` instance,
292
- e.g. a prefix path/folder within an S3 Bucket / GCP Bucket / Azure Blob storage / Git repo.
293
-
294
- Note: Only files in this path will be retrieved and it will be used as the root for paths in the CSV.
295
- """
457
+ class ResponseStorageConfig(BaseModel):
458
+ id: int
459
+ name: StorageConfigName
460
+ type: StorageTypes
461
+ organization_name: str
462
+ creator_name: str
463
+ s3: typing.Optional[StorageS3Out]
464
+ gcp: typing.Optional[StorageGCPOut]
465
+ # azure: typing.Optional[StorageAzureOut]
466
+ git: typing.Optional[StorageGitOut]