nucliadb-utils 6.7.0.post4742__py3-none-any.whl → 6.7.0.post4752__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.
Potentially problematic release.
This version of nucliadb-utils might be problematic. Click here for more details.
- nucliadb_utils/settings.py +1 -0
- nucliadb_utils/storages/s3.py +21 -1
- nucliadb_utils/tests/s3.py +2 -0
- {nucliadb_utils-6.7.0.post4742.dist-info → nucliadb_utils-6.7.0.post4752.dist-info}/METADATA +3 -3
- {nucliadb_utils-6.7.0.post4742.dist-info → nucliadb_utils-6.7.0.post4752.dist-info}/RECORD +7 -7
- {nucliadb_utils-6.7.0.post4742.dist-info → nucliadb_utils-6.7.0.post4752.dist-info}/WHEEL +0 -0
- {nucliadb_utils-6.7.0.post4742.dist-info → nucliadb_utils-6.7.0.post4752.dist-info}/top_level.txt +0 -0
nucliadb_utils/settings.py
CHANGED
@@ -99,6 +99,7 @@ class StorageSettings(BaseSettings):
|
|
99
99
|
s3_max_pool_connections: int = 30
|
100
100
|
s3_endpoint: Optional[str] = None
|
101
101
|
s3_region_name: Optional[str] = None
|
102
|
+
s3_kms_key_id: Optional[str] = None
|
102
103
|
s3_bucket: Optional[str] = Field(default=None, description="KnowledgeBox S3 bucket name template")
|
103
104
|
s3_bucket_tags: Dict[str, str] = Field(
|
104
105
|
default={},
|
nucliadb_utils/storages/s3.py
CHANGED
@@ -356,6 +356,7 @@ class S3Storage(Storage):
|
|
356
356
|
verify_ssl: bool = True,
|
357
357
|
use_ssl: bool = True,
|
358
358
|
region_name: Optional[str] = None,
|
359
|
+
kms_key_id: Optional[str] = None,
|
359
360
|
max_pool_connections: int = 30,
|
360
361
|
bucket: Optional[str] = None,
|
361
362
|
bucket_tags: Optional[dict[str, str]] = None,
|
@@ -380,6 +381,7 @@ class S3Storage(Storage):
|
|
380
381
|
)
|
381
382
|
self._exit_stack = AsyncExitStack()
|
382
383
|
self.bucket = bucket
|
384
|
+
self._kms_key_id = kms_key_id
|
383
385
|
|
384
386
|
def get_bucket_name(self, kbid: str):
|
385
387
|
if self.bucket is None:
|
@@ -440,7 +442,9 @@ class S3Storage(Storage):
|
|
440
442
|
return await bucket_exists(self._s3aioclient, bucket_name)
|
441
443
|
|
442
444
|
async def create_bucket(self, bucket_name: str):
|
443
|
-
await create_bucket(
|
445
|
+
await create_bucket(
|
446
|
+
self._s3aioclient, bucket_name, self._bucket_tags, self._region_name, self._kms_key_id
|
447
|
+
)
|
444
448
|
|
445
449
|
async def schedule_delete_kb(self, kbid: str):
|
446
450
|
bucket_name = self.get_bucket_name(kbid)
|
@@ -523,6 +527,7 @@ async def create_bucket(
|
|
523
527
|
bucket_name: str,
|
524
528
|
bucket_tags: Optional[dict[str, str]] = None,
|
525
529
|
region_name: Optional[str] = None,
|
530
|
+
kms_key_id: Optional[str] = None,
|
526
531
|
):
|
527
532
|
bucket_creation_options = {}
|
528
533
|
if region_name is not None:
|
@@ -540,6 +545,21 @@ async def create_bucket(
|
|
540
545
|
]
|
541
546
|
},
|
542
547
|
)
|
548
|
+
if kms_key_id is not None:
|
549
|
+
await client.put_bucket_encryption(
|
550
|
+
Bucket=bucket_name,
|
551
|
+
ServerSideEncryptionConfiguration={
|
552
|
+
"Rules": [
|
553
|
+
{
|
554
|
+
"ApplyServerSideEncryptionByDefault": {
|
555
|
+
"SSEAlgorithm": "aws:kms",
|
556
|
+
"KMSMasterKeyID": kms_key_id,
|
557
|
+
},
|
558
|
+
"BucketKeyEnabled": True,
|
559
|
+
}
|
560
|
+
]
|
561
|
+
},
|
562
|
+
)
|
543
563
|
|
544
564
|
|
545
565
|
def parse_status_code(error: botocore.exceptions.ClientError) -> int:
|
nucliadb_utils/tests/s3.py
CHANGED
@@ -72,6 +72,7 @@ async def s3_storage_settings(s3) -> AsyncIterator[dict[str, Any]]:
|
|
72
72
|
"s3_verify_ssl": False,
|
73
73
|
"s3_region_name": None,
|
74
74
|
"s3_bucket": "test-{kbid}",
|
75
|
+
"s3_kms_key_id": "fake-kms-key-id",
|
75
76
|
"s3_bucket_tags": {
|
76
77
|
"testTag": "test",
|
77
78
|
},
|
@@ -104,6 +105,7 @@ async def s3_storage(s3, s3_storage_settings: dict[str, Any]):
|
|
104
105
|
region_name=storage_settings.s3_region_name,
|
105
106
|
bucket=storage_settings.s3_bucket,
|
106
107
|
bucket_tags=storage_settings.s3_bucket_tags,
|
108
|
+
kms_key_id=storage_settings.s3_kms_key_id,
|
107
109
|
)
|
108
110
|
await storage.initialize()
|
109
111
|
await storage.create_bucket("nidx")
|
{nucliadb_utils-6.7.0.post4742.dist-info → nucliadb_utils-6.7.0.post4752.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nucliadb_utils
|
3
|
-
Version: 6.7.0.
|
3
|
+
Version: 6.7.0.post4752
|
4
4
|
Summary: NucliaDB util library
|
5
5
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
@@ -27,8 +27,8 @@ Requires-Dist: nats-py[nkeys]>=2.6.0
|
|
27
27
|
Requires-Dist: PyNaCl
|
28
28
|
Requires-Dist: pyjwt>=2.4.0
|
29
29
|
Requires-Dist: mrflagly>=0.2.9
|
30
|
-
Requires-Dist: nucliadb-protos>=6.7.0.
|
31
|
-
Requires-Dist: nucliadb-telemetry>=6.7.0.
|
30
|
+
Requires-Dist: nucliadb-protos>=6.7.0.post4752
|
31
|
+
Requires-Dist: nucliadb-telemetry>=6.7.0.post4752
|
32
32
|
Provides-Extra: cache
|
33
33
|
Requires-Dist: redis>=4.3.4; extra == "cache"
|
34
34
|
Requires-Dist: orjson>=3.6.7; extra == "cache"
|
@@ -11,7 +11,7 @@ nucliadb_utils/nats.py,sha256=U21Cfg36_IHd3ZLXEC4eZ7nZ1Soh_ZNFFwjryNyd2-8,15248
|
|
11
11
|
nucliadb_utils/partition.py,sha256=jBgy4Hu5Iwn4gjbPPcthSykwf-qNx-GcLAIwbzPd1d0,1157
|
12
12
|
nucliadb_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
nucliadb_utils/run.py,sha256=Es0_Bu5Yc-LWczvwL6gzWqSwC85RjDCk-0oFQAJi9g4,1827
|
14
|
-
nucliadb_utils/settings.py,sha256=
|
14
|
+
nucliadb_utils/settings.py,sha256=lZUCliwNKYfk_Tt0KiYeHsT4jRBG0gLAompuHWu9fBI,8233
|
15
15
|
nucliadb_utils/signals.py,sha256=lo_Mk12NIX5Au--3H3WObvDOXq_OMurql2qiC2TnAao,2676
|
16
16
|
nucliadb_utils/store.py,sha256=kQ35HemE0v4_Qg6xVqNIJi8vSFAYQtwI3rDtMsNy62Y,890
|
17
17
|
nucliadb_utils/transaction.py,sha256=l3ZvrITYMnAs_fv1OOC-1nDZxWPG5qmbBhzvuC3DUzQ,8039
|
@@ -45,7 +45,7 @@ nucliadb_utils/storages/gcs.py,sha256=XbtX0Lt3GO7kzuJ1E5CdazlpSqjU46Bhhezq32VQUo
|
|
45
45
|
nucliadb_utils/storages/local.py,sha256=2aCHpZymORG_dUc1FDq0VFcgQulu0w2pZiUaj9dphFs,11686
|
46
46
|
nucliadb_utils/storages/nuclia.py,sha256=vEv94xAT7QM2g80S25QyrOw2pzvP2BAX-ADgZLtuCVc,2097
|
47
47
|
nucliadb_utils/storages/object_store.py,sha256=2PueRP5Q3XOuWgKhj6B9Kp2fyBql5np0T400YRUbqn4,4535
|
48
|
-
nucliadb_utils/storages/s3.py,sha256=
|
48
|
+
nucliadb_utils/storages/s3.py,sha256=1mMXfC0hCJLlVnw-B_WWPWZrNyeYzW3bqQm3u-EE9T8,21707
|
49
49
|
nucliadb_utils/storages/settings.py,sha256=ugCPy1zxBOmA2KosT-4tsjpvP002kg5iQyi42yCGCJA,1285
|
50
50
|
nucliadb_utils/storages/storage.py,sha256=4pHkxjwhBpupklp-vFtRCUazlTsGF13LHuF-c2ooYNA,21852
|
51
51
|
nucliadb_utils/storages/utils.py,sha256=8g2rIwJeYIumQLOB47Yw1rx3twlhRB_cJxer65QfZmk,1479
|
@@ -56,8 +56,8 @@ nucliadb_utils/tests/fixtures.py,sha256=uNiZ8qaOz2bSmSn-2ZMXxhQcHVh3tCyr5A-e0Xao
|
|
56
56
|
nucliadb_utils/tests/gcs.py,sha256=MBMzn_UHU5SU6iILuCsB5zU4umhNcaCw_MKrxZhwvOc,4705
|
57
57
|
nucliadb_utils/tests/local.py,sha256=cxIfPrKuqs5Ef0nbrVYQQAH2mwc4E0iD9bC2sWegS-c,1934
|
58
58
|
nucliadb_utils/tests/nats.py,sha256=RWHjwqq5esuO7OFbP24yYX1cXnpPLcWJwDUdmwCpH28,1897
|
59
|
-
nucliadb_utils/tests/s3.py,sha256=
|
60
|
-
nucliadb_utils-6.7.0.
|
61
|
-
nucliadb_utils-6.7.0.
|
62
|
-
nucliadb_utils-6.7.0.
|
63
|
-
nucliadb_utils-6.7.0.
|
59
|
+
nucliadb_utils/tests/s3.py,sha256=kz9ULxrAYLVslZ59I8dtweZ9DJz5R8Ioy2XYrveZzHw,3829
|
60
|
+
nucliadb_utils-6.7.0.post4752.dist-info/METADATA,sha256=qIHLd3fJ5g8Qghl-Y6q06FP2qp9DRX27QwkzQTWpZ6o,2180
|
61
|
+
nucliadb_utils-6.7.0.post4752.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
62
|
+
nucliadb_utils-6.7.0.post4752.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
|
63
|
+
nucliadb_utils-6.7.0.post4752.dist-info/RECORD,,
|
File without changes
|
{nucliadb_utils-6.7.0.post4742.dist-info → nucliadb_utils-6.7.0.post4752.dist-info}/top_level.txt
RENAMED
File without changes
|