Skip to content

Commit 0c4e4d8

Browse files
committed
feat: add message field to TagResultsItem
Add optional message field to TagResultsItem class to expose error messages returned by the GhoST Tags API when tagging operations fail. Changes: - Add message parameter to class docstring - Add message parameter to __init__ method - Add message field assignment in __init__ - Add message extraction in from_dict method Related to task #29830 Signed-off-by: Stefano Roberto Mollica <stefano.mollica@it.ibm.com>
1 parent b9c87e6 commit 0c4e4d8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ibm_platform_services/global_tagging_v1.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,23 +1628,27 @@ class TagResultsItem:
16281628
:param str resource_id: The CRN or IMS ID of the resource.
16291629
:param bool is_error: (optional) It is `true` if the operation exits with an
16301630
error.
1631+
:param str message: (optional) Error message returned when the operation fails.
16311632
"""
16321633

16331634
def __init__(
16341635
self,
16351636
resource_id: str,
16361637
*,
16371638
is_error: Optional[bool] = None,
1639+
message: Optional[str] = None,
16381640
) -> None:
16391641
"""
16401642
Initialize a TagResultsItem object.
16411643
16421644
:param str resource_id: The CRN or IMS ID of the resource.
16431645
:param bool is_error: (optional) It is `true` if the operation exits with
16441646
an error.
1647+
:param str message: (optional) Error message returned when the operation fails.
16451648
"""
16461649
self.resource_id = resource_id
16471650
self.is_error = is_error
1651+
self.message = message
16481652

16491653
@classmethod
16501654
def from_dict(cls, _dict: Dict) -> 'TagResultsItem':
@@ -1656,6 +1660,8 @@ def from_dict(cls, _dict: Dict) -> 'TagResultsItem':
16561660
raise ValueError('Required property \'resource_id\' not present in TagResultsItem JSON')
16571661
if (is_error := _dict.get('is_error')) is not None:
16581662
args['is_error'] = is_error
1663+
if (message := _dict.get('message')) is not None:
1664+
args['message'] = message
16591665
return cls(**args)
16601666

16611667
@classmethod

0 commit comments

Comments
 (0)