diff --git a/examples/test_global_tagging_v1_examples.py b/examples/test_global_tagging_v1_examples.py index 52499ab..8633764 100644 --- a/examples/test_global_tagging_v1_examples.py +++ b/examples/test_global_tagging_v1_examples.py @@ -128,8 +128,10 @@ def test_attach_tag_example(self): print('\nattach_tag() result:') # begin-attach_tag + resource_model = {'resource_id': resource_crn} + tag_results = global_tagging_service.attach_tag( - tag_names=['tag_test_1', 'tag_test_2'], tag_type='user' + resources=[resource_model], tag_names=['tag_test_1', 'tag_test_2'], tag_type='user' ).get_result() print(json.dumps(tag_results, indent=2)) @@ -148,8 +150,10 @@ def test_detach_tag_example(self): print('\ndetach_tag() result:') # begin-detach_tag + resource_model = {'resource_id': resource_crn} + tag_results = global_tagging_service.detach_tag( - tag_names=['tag_test_1', 'tag_test_2'], tag_type='user' + resources=[resource_model], tag_names=['tag_test_1', 'tag_test_2'], tag_type='user' ).get_result() print(json.dumps(tag_results, indent=2)) diff --git a/ibm_platform_services/global_tagging_v1.py b/ibm_platform_services/global_tagging_v1.py index dd18ed6..6b23097 100644 --- a/ibm_platform_services/global_tagging_v1.py +++ b/ibm_platform_services/global_tagging_v1.py @@ -1,6 +1,6 @@ # coding: utf-8 -# (C) Copyright IBM Corp. 2025. +# (C) Copyright IBM Corp. 2026. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# IBM OpenAPI SDK Code Generator Version: 3.105.0-3c13b041-20250605-193116 +# IBM OpenAPI SDK Code Generator Version: 3.111.0-1bfb72c2-20260206-185521 """ Manage your tags with the Tagging API in IBM Cloud. You can attach, detach, delete, or @@ -1628,6 +1628,7 @@ class TagResultsItem: :param str resource_id: The CRN or IMS ID of the resource. :param bool is_error: (optional) It is `true` if the operation exits with an error. + :param str message: (optional) Error message returned when the operation fails. """ def __init__( @@ -1635,6 +1636,7 @@ def __init__( resource_id: str, *, is_error: Optional[bool] = None, + message: Optional[str] = None, ) -> None: """ Initialize a TagResultsItem object. @@ -1642,9 +1644,12 @@ def __init__( :param str resource_id: The CRN or IMS ID of the resource. :param bool is_error: (optional) It is `true` if the operation exits with an error. + :param str message: (optional) Error message returned when the operation + fails. """ self.resource_id = resource_id self.is_error = is_error + self.message = message @classmethod def from_dict(cls, _dict: Dict) -> 'TagResultsItem': @@ -1656,6 +1661,8 @@ def from_dict(cls, _dict: Dict) -> 'TagResultsItem': raise ValueError('Required property \'resource_id\' not present in TagResultsItem JSON') if (is_error := _dict.get('is_error')) is not None: args['is_error'] = is_error + if (message := _dict.get('message')) is not None: + args['message'] = message return cls(**args) @classmethod @@ -1670,6 +1677,8 @@ def to_dict(self) -> Dict: _dict['resource_id'] = self.resource_id if hasattr(self, 'is_error') and self.is_error is not None: _dict['is_error'] = self.is_error + if hasattr(self, 'message') and self.message is not None: + _dict['message'] = self.message return _dict def _to_dict(self): diff --git a/test/integration/test_global_tagging_v1.py b/test/integration/test_global_tagging_v1.py index f2bb8af..3c3cc64 100644 --- a/test/integration/test_global_tagging_v1.py +++ b/test/integration/test_global_tagging_v1.py @@ -329,7 +329,7 @@ def test_delete_tag_user(self): print('\ndelete_tag(user) result: ', json.dumps(delete_tag_results.to_dict(), indent=2)) for item in delete_tag_results.results: - assert item.is_error is False + assert item.is_error is True # tags are already deleted at detach time if not attached to any resource @needscredentials def test_delete_tag_access(self): diff --git a/test/unit/test_global_tagging_v1.py b/test/unit/test_global_tagging_v1.py index 2f34f5d..7a39e2c 100644 --- a/test/unit/test_global_tagging_v1.py +++ b/test/unit/test_global_tagging_v1.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# (C) Copyright IBM Corp. 2025. +# (C) Copyright IBM Corp. 2026. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -573,7 +573,7 @@ def test_attach_tag_all_params(self): """ # Set up mock url = preprocess_url('/v3/tags/attach') - mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true}]}' + mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true, "message": "message"}]}' responses.add( responses.POST, url, @@ -651,7 +651,7 @@ def test_attach_tag_required_params(self): """ # Set up mock url = preprocess_url('/v3/tags/attach') - mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true}]}' + mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true, "message": "message"}]}' responses.add( responses.POST, url, @@ -716,7 +716,7 @@ def test_detach_tag_all_params(self): """ # Set up mock url = preprocess_url('/v3/tags/detach') - mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true}]}' + mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true, "message": "message"}]}' responses.add( responses.POST, url, @@ -788,7 +788,7 @@ def test_detach_tag_required_params(self): """ # Set up mock url = preprocess_url('/v3/tags/detach') - mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true}]}' + mock_response = '{"results": [{"resource_id": "resource_id", "is_error": true, "message": "message"}]}' responses.add( responses.POST, url, @@ -1220,6 +1220,7 @@ def test_tag_results_serialization(self): 'crn:v1:staging:public:resource-controller::a/5c2ac0d93c69e82c6c9c7c78dc4beda3::resource-group:1c061f4485b34360a8f8ee049880dc13' ) tag_results_item_model['is_error'] = False + tag_results_item_model['message'] = 'testString' # Construct a json representation of a TagResults model tag_results_model_json = {} @@ -1255,6 +1256,7 @@ def test_tag_results_item_serialization(self): tag_results_item_model_json = {} tag_results_item_model_json['resource_id'] = 'testString' tag_results_item_model_json['is_error'] = True + tag_results_item_model_json['message'] = 'testString' # Construct a model instance of TagResultsItem by calling from_dict on the json representation tag_results_item_model = TagResultsItem.from_dict(tag_results_item_model_json)