Skip to content
Open
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
13 changes: 11 additions & 2 deletions ibm_platform_services/global_tagging_v1.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -1628,23 +1628,28 @@ 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__(
self,
resource_id: str,
*,
is_error: Optional[bool] = None,
message: Optional[str] = None,
) -> None:
"""
Initialize a TagResultsItem object.

: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':
Expand All @@ -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
Expand All @@ -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):
Expand Down
12 changes: 7 additions & 5 deletions test/unit/test_global_tagging_v1.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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)
Expand Down