Content-Length: 360743 | pFad | http://github.com/googleapis/python-aiplatform/commit/7740132c315b2f1e55504e5c5b462eb27bf89937

0A fix: add check for empty `encryption_spec_key_name` for MatchingEngin… · googleapis/python-aiplatform@7740132 · GitHub
Skip to content

Commit 7740132

Browse files
lingyinwcopybara-github
authored andcommitted
fix: add check for empty encryption_spec_key_name for MatchingEngineIndexEndpoint create.
PiperOrigin-RevId: 583056556
1 parent 6c1f2cc commit 7740132

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

google/cloud/aiplatform/matching_engine/matching_engine_index_endpoint.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -445,25 +445,17 @@ def _create(
445445
Returns:
446446
MatchingEngineIndexEndpoint - IndexEndpoint resource object
447447
"""
448-
# Public
448+
# public
449449
if public_endpoint_enabled:
450450
gapic_index_endpoint = gca_matching_engine_index_endpoint.IndexEndpoint(
451451
display_name=display_name,
452452
description=description,
453453
public_endpoint_enabled=public_endpoint_enabled,
454-
encryption_spec=gca_encryption_spec.EncryptionSpec(
455-
kms_key_name=encryption_spec_key_name
456-
),
457454
)
458455
# PSA
459456
elif network:
460457
gapic_index_endpoint = gca_matching_engine_index_endpoint.IndexEndpoint(
461-
display_name=display_name,
462-
description=description,
463-
network=network,
464-
encryption_spec=gca_encryption_spec.EncryptionSpec(
465-
kms_key_name=encryption_spec_key_name
466-
),
458+
display_name=display_name, description=description, network=network
467459
)
468460
# PSC
469461
else:
@@ -474,9 +466,11 @@ def _create(
474466
project_allowlist=project_allowlist,
475467
enable_private_service_connect=enable_private_service_connect,
476468
),
477-
encryption_spec=gca_encryption_spec.EncryptionSpec(
478-
kms_key_name=encryption_spec_key_name
479-
),
469+
)
470+
471+
if encryption_spec_key_name:
472+
gapic_index_endpoint.encryption_spec = gca_encryption_spec.EncryptionSpec(
473+
kms_key_name=encryption_spec_key_name
480474
)
481475

482476
if labels:

tests/unit/aiplatform/test_matching_engine_index_endpoint.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,6 @@ def test_create_index_endpoint(self, create_index_endpoint_mock, sync):
629629
network=_TEST_INDEX_ENDPOINT_VPC_NETWORK,
630630
description=_TEST_INDEX_ENDPOINT_DESCRIPTION,
631631
labels=_TEST_LABELS,
632-
encryption_spec_key_name=_TEST_ENCRYPTION_SPEC_KEY_NAME,
633632
)
634633

635634
if not sync:
@@ -640,9 +639,6 @@ def test_create_index_endpoint(self, create_index_endpoint_mock, sync):
640639
network=_TEST_INDEX_ENDPOINT_VPC_NETWORK,
641640
description=_TEST_INDEX_ENDPOINT_DESCRIPTION,
642641
labels=_TEST_LABELS,
643-
encryption_spec=gca_encryption_spec.EncryptionSpec(
644-
kms_key_name=_TEST_ENCRYPTION_SPEC_KEY_NAME
645-
),
646642
)
647643
create_index_endpoint_mock.assert_called_once_with(
648644
parent=_TEST_PARENT,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/python-aiplatform/commit/7740132c315b2f1e55504e5c5b462eb27bf89937

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy