Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions components/renku_data_services/storage/api.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ components:
minLength: 1
maxLength: 99
value:
$ref: "#/components/schemas/SecretValue"
$ref: "#/components/schemas/SecretValueNullable"
required:
- name
- value
Expand Down Expand Up @@ -543,11 +543,12 @@ components:
required:
- name
- secret_id
SecretValue:
description: Secret value that can be any text
type: string
minLength: 1
maxLength: 5000
SecretValueNullable:
description: Secret value that can be any text
type: string
minLength: 1
maxLength: 5000
nullable: true
RCloneSchema:
description: List of RClone schemas for different storage types
type: array
Expand Down
4 changes: 2 additions & 2 deletions components/renku_data_services/storage/apispec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.spec.yaml
# timestamp: 2024-08-13T13:29:46+00:00
# timestamp: 2024-10-07T08:21:24+00:00

from __future__ import annotations

Expand Down Expand Up @@ -242,7 +242,7 @@ class CloudStorageSecretPost(BaseAPISpec):
max_length=99,
min_length=1,
)
value: str = Field(
value: Optional[str] = Field(
...,
description="Secret value that can be any text",
max_length=5000,
Expand Down
10 changes: 10 additions & 0 deletions components/renku_data_services/storage/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ async def upsert_storage_secrets(
stored_secrets = []

for name, value in secret_names_values.items():
if value is None:
# delete the secret
storage_secret_orm = existing_secrets.get(name)
if storage_secret_orm is None:
continue
await session.delete(storage_secret_orm)
await session.delete(storage_secret_orm.secret)
del existing_secrets[name]
continue

encrypted_value, encrypted_key = await encrypt_user_secret(
user_repo=self.user_repo,
requested_by=user,
Expand Down
2 changes: 1 addition & 1 deletion components/renku_data_services/storage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,4 @@ class CloudStorageSecretUpsert(BaseModel):
"""Insert/update storage secret data."""

name: str = Field()
value: str = Field()
value: str | None = Field()