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
25 changes: 25 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,31 @@ Breaking Changes

- Updated MappedCollectionDoc and GuestCollectionDoc with MissingType. (:pr:`1189`)

.. _changelog-3.64.0:

v3.64.0 (2025-09-24)
====================

Added
-----

- Added ``SearchClient.update_index`` as a method for modifying index names and
descriptions. (:pr:`1310`)

Deprecated
----------

- The following Transfer features have been deprecated: (:pr:`1308`, :pr:`1309`)

- The ``add_symlink_item`` method of ``TransferData``.
This is not supported by any collections.

- The ``recursive_symlinks`` parameter to ``TransferData``.
This is not supported by any collections.

- The ``skip_activation_check`` parameter to ``TransferData`` and ``DeleteData``.
This no longer has any effect when set.

.. _changelog-3.63.0:

v3.63.0 (2025-09-04)
Expand Down
46 changes: 46 additions & 0 deletions src/globus_sdk/services/search/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,52 @@ def create_index(
"/v1/index", data={"display_name": display_name, "description": description}
)

def update_index(
self,
index_id: uuid.UUID | str,
*,
display_name: str | MissingType = MISSING,
description: str | MissingType = MISSING,
) -> response.GlobusHTTPResponse:
"""
Update index metadata.

:param index_id: the ID of the index
:param display_name: the name of the index
:param description: a description of the index

.. tab-set::

.. tab-item:: Example Usage

.. code-block:: python

sc = globus_sdk.SearchClient(...)
MY_INDEX_ID = ...
r = sc.update_index(
MY_INDEX_ID,
display_name="My Awesome Index",
description="Very awesome searchable data",
)
print(f"index ID: {r['id']}")

.. tab-item:: Example Response Data

.. expandtestfixture:: search.create_index

.. tab-item:: API Info

``PATCH /v1/index/<index_id>``

.. extdoclink:: Index Update
:ref: search/reference/index_update/
"""
log.debug(f"SearchClient.update_index({index_id!r}, ...)")
return self.patch(
f"/v1/index/{index_id}",
data={"display_name": display_name, "description": description},
)

def delete_index(self, index_id: uuid.UUID | str) -> response.GlobusHTTPResponse:
"""
Mark an index for deletion.
Expand Down
58 changes: 58 additions & 0 deletions src/globus_sdk/testing/data/search/update_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import uuid

from globus_sdk.testing.models import RegisteredResponse, ResponseSet

INDEX_ID = str(uuid.uuid4())

_default_display_name = "Awesome Index of Awesomeness"
_default_description = "An index so awesome that it simply cannot be described"

RESPONSES = ResponseSet(
default=RegisteredResponse(
service="search",
method="PATCH",
path=f"/v1/index/{INDEX_ID}",
json={
"@datatype": "GSearchIndex",
"@version": "2017-09-01",
"creation_date": "2021-04-05 15:05:18",
"display_name": _default_display_name,
"description": _default_description,
"id": INDEX_ID,
"is_trial": True,
"subscription_id": None,
"max_size_in_mb": 1,
"num_entries": 0,
"num_subjects": 0,
"size_in_mb": 0,
"status": "open",
},
metadata={"index_id": INDEX_ID, "display_name": _default_display_name},
),
forbidden=RegisteredResponse(
service="search",
method="PATCH",
path=f"/v1/index/{INDEX_ID}",
status=403,
json={
"@datatype": "GError",
"@version": "2017-09-01",
"status": 403,
"code": "Forbidden.Generic",
"message": "index_update request denied by service",
"request_id": "0e73b6a61e53468684f86c7993336a72",
"error_data": {
"cause": (
"You do not have the proper roles "
"to perform the index_update operation."
),
"recommended_resolution": (
"Ensure you are making a call authenticated with "
"a valid Search token and that you have been granted "
"the required roles for this operation"
),
},
},
metadata={"index_id": INDEX_ID},
),
)
24 changes: 24 additions & 0 deletions tests/functional/services/search/test_update_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest

import globus_sdk
from globus_sdk.testing import load_response


def test_update_index(client):
meta = load_response(client.update_index).metadata

res = client.update_index(meta["index_id"], display_name="foo")
assert res.http_status == 200
assert res["display_name"] == meta["display_name"]


def test_update_index_forbidden_error(client):
meta = load_response(client.update_index, case="forbidden").metadata

with pytest.raises(globus_sdk.SearchAPIError) as excinfo:
client.update_index(meta["index_id"])

err = excinfo.value

assert err.http_status == 403
assert err.code == "Forbidden.Generic"
Loading