Bin
2025-12-16 7423b0c6e1959f30a7e8e453e953310f32ce13c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
"""
from django.conf import settings
from django.urls import include, path, re_path
from io_storages import proxy_api
from io_storages.all_api import (
    AllExportStorageListAPI,
    AllExportStorageTypesAPI,
    AllImportStorageListAPI,
    AllImportStorageTypesAPI,
)
from io_storages.api import ImportStorageListFilesAPI
from io_storages.azure_blob.api import (
    AzureBlobExportStorageDetailAPI,
    AzureBlobExportStorageFormLayoutAPI,
    AzureBlobExportStorageListAPI,
    AzureBlobExportStorageSyncAPI,
    AzureBlobExportStorageValidateAPI,
    AzureBlobImportStorageDetailAPI,
    AzureBlobImportStorageFormLayoutAPI,
    AzureBlobImportStorageListAPI,
    AzureBlobImportStorageSerializer,
    AzureBlobImportStorageSyncAPI,
    AzureBlobImportStorageValidateAPI,
)
from io_storages.gcs.api import (
    GCSExportStorageDetailAPI,
    GCSExportStorageFormLayoutAPI,
    GCSExportStorageListAPI,
    GCSExportStorageSyncAPI,
    GCSExportStorageValidateAPI,
    GCSImportStorageDetailAPI,
    GCSImportStorageFormLayoutAPI,
    GCSImportStorageListAPI,
    GCSImportStorageSerializer,
    GCSImportStorageSyncAPI,
    GCSImportStorageValidateAPI,
)
from io_storages.localfiles.api import (
    LocalFilesExportStorageDetailAPI,
    LocalFilesExportStorageFormLayoutAPI,
    LocalFilesExportStorageListAPI,
    LocalFilesExportStorageSyncAPI,
    LocalFilesExportStorageValidateAPI,
    LocalFilesImportStorageDetailAPI,
    LocalFilesImportStorageFormLayoutAPI,
    LocalFilesImportStorageListAPI,
    LocalFilesImportStorageSerializer,
    LocalFilesImportStorageSyncAPI,
    LocalFilesImportStorageValidateAPI,
)
from io_storages.localfiles.views import localfiles_data
from io_storages.redis.api import (
    RedisExportStorageDetailAPI,
    RedisExportStorageFormLayoutAPI,
    RedisExportStorageListAPI,
    RedisExportStorageSyncAPI,
    RedisExportStorageValidateAPI,
    RedisImportStorageDetailAPI,
    RedisImportStorageFormLayoutAPI,
    RedisImportStorageListAPI,
    RedisImportStorageSerializer,
    RedisImportStorageSyncAPI,
    RedisImportStorageValidateAPI,
)
from io_storages.s3.api import (
    S3ExportStorageDetailAPI,
    S3ExportStorageFormLayoutAPI,
    S3ExportStorageListAPI,
    S3ExportStorageSyncAPI,
    S3ExportStorageValidateAPI,
    S3ImportStorageDetailAPI,
    S3ImportStorageFormLayoutAPI,
    S3ImportStorageListAPI,
    S3ImportStorageSerializer,
    S3ImportStorageSyncAPI,
    S3ImportStorageValidateAPI,
)
 
app_name = 'storages'
 
# IO Storages CRUD
_api_urlpatterns = [
    # All storages
    path('', AllImportStorageListAPI.as_view(), name='storage-list'),
    path('export', AllExportStorageListAPI.as_view(), name='export-storage-list'),
    path('types', AllImportStorageTypesAPI.as_view(), name='storage-types'),
    path('export/types', AllExportStorageTypesAPI.as_view(), name='export-storage-types'),
    # Amazon S3
    path('s3/', S3ImportStorageListAPI.as_view(), name='storage-s3-list'),
    path('s3/<int:pk>', S3ImportStorageDetailAPI.as_view(), name='storage-s3-detail'),
    path('s3/<int:pk>/sync', S3ImportStorageSyncAPI.as_view(), name='storage-s3-sync'),
    path('s3/validate', S3ImportStorageValidateAPI.as_view(), name='storage-s3-validate'),
    path('s3/form', S3ImportStorageFormLayoutAPI.as_view(), name='storage-s3-form'),
    path(
        's3/files',
        ImportStorageListFilesAPI().as_view(serializer_class=S3ImportStorageSerializer),
        name='storage-s3-list-files',
    ),
    path('export/s3', S3ExportStorageListAPI.as_view(), name='export-storage-s3-list'),
    path('export/s3/<int:pk>', S3ExportStorageDetailAPI.as_view(), name='export-storage-s3-detail'),
    path('export/s3/<int:pk>/sync', S3ExportStorageSyncAPI.as_view(), name='export-storage-s3-sync'),
    path('export/s3/validate', S3ExportStorageValidateAPI.as_view(), name='export-storage-s3-validate'),
    path('export/s3/form', S3ExportStorageFormLayoutAPI.as_view(), name='export-storage-s3-form'),
    # Microsoft Azure
    path('azure/', AzureBlobImportStorageListAPI.as_view(), name='storage-azure-list'),
    path('azure/<int:pk>', AzureBlobImportStorageDetailAPI.as_view(), name='storage-azure-detail'),
    path('azure/<int:pk>/sync', AzureBlobImportStorageSyncAPI.as_view(), name='storage-azure-sync'),
    path('azure/validate', AzureBlobImportStorageValidateAPI.as_view(), name='storage-azure-validate'),
    path('azure/form', AzureBlobImportStorageFormLayoutAPI.as_view(), name='storage-azure-form'),
    path(
        'azure/files',
        ImportStorageListFilesAPI().as_view(serializer_class=AzureBlobImportStorageSerializer),
        name='storage-azure-list-files',
    ),
    path('export/azure', AzureBlobExportStorageListAPI.as_view(), name='export-storage-azure-list'),
    path('export/azure/<int:pk>', AzureBlobExportStorageDetailAPI.as_view(), name='export-storage-azure-detail'),
    path('export/azure/<int:pk>/sync', AzureBlobExportStorageSyncAPI.as_view(), name='export-storage-azure-sync'),
    path('export/azure/validate', AzureBlobExportStorageValidateAPI.as_view(), name='export-storage-azure-validate'),
    path('export/azure/form', AzureBlobExportStorageFormLayoutAPI.as_view(), name='export-storage-azure-form'),
    # Google Cloud Storage
    path('gcs/', GCSImportStorageListAPI.as_view(), name='storage-gcs-list'),
    path('gcs/<int:pk>', GCSImportStorageDetailAPI.as_view(), name='storage-gcs-detail'),
    path('gcs/<int:pk>/sync', GCSImportStorageSyncAPI.as_view(), name='storage-gcs-sync'),
    path('gcs/validate', GCSImportStorageValidateAPI.as_view(), name='storage-gcs-validate'),
    path('gcs/form', GCSImportStorageFormLayoutAPI.as_view(), name='storage-gcs-form'),
    path(
        'gcs/files',
        ImportStorageListFilesAPI().as_view(serializer_class=GCSImportStorageSerializer),
        name='storage-gcs-list-files',
    ),
    path('export/gcs', GCSExportStorageListAPI.as_view(), name='export-storage-gcs-list'),
    path('export/gcs/<int:pk>', GCSExportStorageDetailAPI.as_view(), name='export-storage-gcs-detail'),
    path('export/gcs/<int:pk>/sync', GCSExportStorageSyncAPI.as_view(), name='export-storage-gcs-sync'),
    path('export/gcs/validate', GCSExportStorageValidateAPI.as_view(), name='export-storage-gcs-validate'),
    path('export/gcs/form', GCSExportStorageFormLayoutAPI.as_view(), name='export-storage-gcs-form'),
    # Redis DB
    path('redis/', RedisImportStorageListAPI.as_view(), name='storage-redis-list'),
    path('redis/<int:pk>', RedisImportStorageDetailAPI.as_view(), name='storage-redis-detail'),
    path('redis/<int:pk>/sync', RedisImportStorageSyncAPI.as_view(), name='storage-redis-sync'),
    path('redis/validate', RedisImportStorageValidateAPI.as_view(), name='storage-redis-validate'),
    path('redis/form', RedisImportStorageFormLayoutAPI.as_view(), name='storage-redis-form'),
    path(
        'redis/files',
        ImportStorageListFilesAPI().as_view(serializer_class=RedisImportStorageSerializer),
        name='storage-redis-list-files',
    ),
    path('export/redis', RedisExportStorageListAPI.as_view(), name='export-storage-redis-list'),
    path('export/redis/<int:pk>', RedisExportStorageDetailAPI.as_view(), name='export-storage-redis-detail'),
    path('export/redis/<int:pk>/sync', RedisExportStorageSyncAPI.as_view(), name='export-storage-redis-sync'),
    path('export/redis/validate', RedisExportStorageValidateAPI.as_view(), name='export-storage-redis-validate'),
    path('export/redis/form', RedisExportStorageFormLayoutAPI.as_view(), name='export-storage-redis-form'),
]
if settings.ENABLE_LOCAL_FILES_STORAGE:
    _api_urlpatterns += [
        # Local files
        path('localfiles/', LocalFilesImportStorageListAPI.as_view(), name='storage-localfiles-list'),
        path('localfiles/<int:pk>', LocalFilesImportStorageDetailAPI.as_view(), name='storage-localfiles-detail'),
        path('localfiles/<int:pk>/sync', LocalFilesImportStorageSyncAPI.as_view(), name='storage-localfiles-sync'),
        path('localfiles/validate', LocalFilesImportStorageValidateAPI.as_view(), name='storage-localfiles-validate'),
        path('localfiles/form', LocalFilesImportStorageFormLayoutAPI.as_view(), name='storage-localfiles-form'),
        path(
            'localfiles/files',
            ImportStorageListFilesAPI().as_view(serializer_class=LocalFilesImportStorageSerializer),
            name='storage-localfiles-list-files',
        ),
        path('export/localfiles', LocalFilesExportStorageListAPI.as_view(), name='export-storage-localfiles-list'),
        path(
            'export/localfiles/<int:pk>',
            LocalFilesExportStorageDetailAPI.as_view(),
            name='export-storage-localfiles-detail',
        ),
        path(
            'export/localfiles/<int:pk>/sync',
            LocalFilesExportStorageSyncAPI.as_view(),
            name='export-storage-localfiles-sync',
        ),
        path(
            'export/localfiles/validate',
            LocalFilesExportStorageValidateAPI.as_view(),
            name='export-storage-localfiles-validate',
        ),
        path(
            'export/localfiles/form',
            LocalFilesExportStorageFormLayoutAPI.as_view(),
            name='export-storage-localfiles-form',
        ),
    ]
 
urlpatterns = [
    path('api/storages/', include((_api_urlpatterns, app_name), namespace='api')),
]
 
# URI Resolving: proxy or redirect to presigned URLs
urlpatterns += [
    # resolving storage URIs endpoints: proxy or redirect to presigned URLs
    path('tasks/<int:task_id>/resolve/', proxy_api.TaskResolveStorageUri.as_view(), name='task-storage-data-resolve'),
    path(
        'projects/<int:project_id>/resolve/',
        proxy_api.ProjectResolveStorageUri.as_view(),
        name='project-storage-data-resolve',
    ),
    # keep /presign/ for backwards compatibility
    path('tasks/<int:task_id>/presign/', proxy_api.TaskResolveStorageUri.as_view(), name='task-storage-data-presign'),
    path(
        'projects/<int:project_id>/presign/',
        proxy_api.ProjectResolveStorageUri.as_view(),
        name='project-storage-data-presign',
    ),
]
 
urlpatterns += [
    re_path(r'data/local-files/', localfiles_data, name='localfiles_data'),
]