Skip to content

Commit 825038e

Browse files
committed
update docstrings
1 parent 171194e commit 825038e

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

synapseclient/models/mixins/storage_location_mixin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ async def set_storage_location_async(
293293
To add a storage location without removing existing ones, first retrieve the
294294
current setting via `get_project_setting_async`, append to its `locations`
295295
list, and call `store_async` on the returned `ProjectSetting` directly.
296+
The first ID in the list is the default upload destination.
297+
To obtain a storage location ID, create a
298+
[StorageLocation][synapseclient.models.StorageLocation] and use its
299+
`storage_location_id`. See
300+
[StorageLocationType][synapseclient.models.StorageLocationType] for the
301+
available storage backend types.
296302
297303
Arguments:
298304
storage_location_id: The storage location ID(s) to set. Can be a single

synapseclient/models/project_setting.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,41 @@ class ProjectSetting(ProjectSettingSynchronousProtocol):
3737
is supported. Default: ``"upload"``.
3838
locations: The list of storage location IDs for upload. The first ID is the
3939
default upload destination. A project may have at most 10 storage locations.
40+
To obtain a storage location ID, create a
41+
[StorageLocation][synapseclient.models.StorageLocation] and use its
42+
`storage_location_id`. See
43+
[StorageLocationType][synapseclient.models.StorageLocationType] for the
44+
available storage backend types.
4045
concrete_type: (Read Only) The concrete type returned by the Synapse REST API.
4146
etag: (Read Only) Synapse employs an Optimistic Concurrency Control (OCC)
4247
scheme. The etag changes every time the setting is updated; it must be
4348
included on updates.
4449
50+
Example: Creating a project setting from a new storage location:
51+
Create a StorageLocation first, then use its ID when creating the
52+
project setting:
53+
54+
from synapseclient.models import (
55+
ProjectSetting,
56+
StorageLocation,
57+
StorageLocationType,
58+
)
59+
60+
import synapseclient
61+
synapseclient.login()
62+
63+
storage = StorageLocation(
64+
storage_type=StorageLocationType.EXTERNAL_S3,
65+
bucket="my-bucket",
66+
base_key="my/prefix",
67+
).store()
68+
69+
setting = ProjectSetting(
70+
project_id="syn123",
71+
locations=[storage.storage_location_id],
72+
).store()
73+
print(f"Created setting ID: {setting.id}")
74+
4575
Example: Creating a project setting:
4676
4777
from synapseclient.models import ProjectSetting
@@ -95,7 +125,11 @@ class ProjectSetting(ProjectSettingSynchronousProtocol):
95125

96126
locations: List[int] = field(default_factory=list)
97127
"""The list of storage location IDs for upload. The first ID is the default upload
98-
destination. A project may have at most 10 storage locations."""
128+
destination. A project may have at most 10 storage locations. To obtain a storage
129+
location ID, create a [StorageLocation][synapseclient.models.StorageLocation] and
130+
use its `storage_location_id`. See
131+
[StorageLocationType][synapseclient.models.StorageLocationType] for the available
132+
storage backend types."""
99133

100134
concrete_type: Optional[str] = field(default=None, compare=False)
101135
"""(Read Only) The concrete type returned by the Synapse REST API."""

0 commit comments

Comments
 (0)