Skip to content

Commit c611b41

Browse files
fix(Global Search/Tagging): regenerated services with latest API definition
Signed-off-by: francescadecicco <[email protected]>
1 parent dccc02e commit c611b41

File tree

2 files changed

+213
-167
lines changed

2 files changed

+213
-167
lines changed

ibm_platform_services/global_tagging_v1.py

Lines changed: 133 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
22

3-
# (C) Copyright IBM Corp. 2024.
3+
# (C) Copyright IBM Corp. 2025.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# IBM OpenAPI SDK Code Generator Version: 3.87.0-91c7c775-20240320-213027
17+
# IBM OpenAPI SDK Code Generator Version: 3.105.0-3c13b041-20250605-193116
1818

1919
"""
2020
Manage your tags with the Tagging API in IBM Cloud. You can attach, detach, delete, or
@@ -23,10 +23,10 @@
2323
`label`. The tagging API supports three types of tag: `user` `service`, and `access` tags.
2424
`service` tags cannot be attached to IMS resources. `service` tags must be in the form
2525
`service_prefix:tag_label` where `service_prefix` identifies the Service owning the tag.
26-
`access` tags cannot be attached to IMS and Cloud Foundry resources. They must be in the
27-
form `key:value`. You can replace all resource's tags using the `replace` query parameter
28-
in the attach operation. You can update the `value` of a resource's tag in the format
29-
`key:value`, using the `update` query parameter in the attach operation.
26+
`access` tags cannot be attached to IMS resources. They must be in the form `key:value`.
27+
You can replace all resource's tags using the `replace` query parameter in the attach
28+
operation. You can update the `value` of a resource's tag in the format `key:value`, using
29+
the `update` query parameter in the attach operation.
3030
3131
API Version: 1.2.0
3232
"""
@@ -63,7 +63,9 @@ def new_instance(
6363
parameters and external configuration.
6464
"""
6565
authenticator = get_authenticator_from_environment(service_name)
66-
service = cls(authenticator)
66+
service = cls(
67+
authenticator
68+
)
6769
service.configure_service(service_name)
6870
return service
6971

@@ -453,10 +455,11 @@ def delete_tag(
453455

454456
def attach_tag(
455457
self,
456-
resources: List['Resource'],
457458
*,
458459
tag_name: Optional[str] = None,
459460
tag_names: Optional[List[str]] = None,
461+
resources: Optional[List['Resource']] = None,
462+
query: Optional['QueryString'] = None,
460463
x_request_id: Optional[str] = None,
461464
x_correlation_id: Optional[str] = None,
462465
account_id: Optional[str] = None,
@@ -472,10 +475,11 @@ def attach_tag(
472475
than 1000 tags per each 'user' and 'service' type, and no more than 250 'access'
473476
tags (which is the account limit).
474477
475-
:param List[Resource] resources: List of resources on which the tag or tags
476-
are attached.
477478
:param str tag_name: (optional) The name of the tag to attach.
478479
:param List[str] tag_names: (optional) An array of tag names to attach.
480+
:param List[Resource] resources: (optional) List of resources on which the
481+
tagging operation operates on.
482+
:param QueryString query: (optional) A valid Global Search string.
479483
:param str x_request_id: (optional) An alphanumeric string that is used to
480484
trace the request. The value may include ASCII alphanumerics and any of
481485
following segment separators: space ( ), comma (,), hyphen, (-), and
@@ -516,9 +520,10 @@ def attach_tag(
516520
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
517521
"""
518522

519-
if resources is None:
520-
raise ValueError('resources must be provided')
521-
resources = [convert_model(x) for x in resources]
523+
if resources is not None:
524+
resources = [convert_model(x) for x in resources]
525+
if query is not None:
526+
query = convert_model(query)
522527
headers = {
523528
'x-request-id': x_request_id,
524529
'x-correlation-id': x_correlation_id,
@@ -538,9 +543,10 @@ def attach_tag(
538543
}
539544

540545
data = {
541-
'resources': resources,
542546
'tag_name': tag_name,
543547
'tag_names': tag_names,
548+
'resources': resources,
549+
'query': query,
544550
}
545551
data = {k: v for (k, v) in data.items() if v is not None}
546552
data = json.dumps(data)
@@ -565,10 +571,11 @@ def attach_tag(
565571

566572
def detach_tag(
567573
self,
568-
resources: List['Resource'],
569574
*,
570575
tag_name: Optional[str] = None,
571576
tag_names: Optional[List[str]] = None,
577+
resources: Optional[List['Resource']] = None,
578+
query: Optional['QueryString'] = None,
572579
x_request_id: Optional[str] = None,
573580
x_correlation_id: Optional[str] = None,
574581
account_id: Optional[str] = None,
@@ -580,10 +587,11 @@ def detach_tag(
580587
581588
Detaches one or more tags from one or more resources.
582589
583-
:param List[Resource] resources: List of resources on which the tag or tags
584-
are detached.
585590
:param str tag_name: (optional) The name of the tag to detach.
586591
:param List[str] tag_names: (optional) An array of tag names to detach.
592+
:param List[Resource] resources: (optional) List of resources on which the
593+
tagging operation operates on.
594+
:param QueryString query: (optional) A valid Global Search string.
587595
:param str x_request_id: (optional) An alphanumeric string that is used to
588596
trace the request. The value may include ASCII alphanumerics and any of
589597
following segment separators: space ( ), comma (,), hyphen, (-), and
@@ -612,9 +620,10 @@ def detach_tag(
612620
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
613621
"""
614622

615-
if resources is None:
616-
raise ValueError('resources must be provided')
617-
resources = [convert_model(x) for x in resources]
623+
if resources is not None:
624+
resources = [convert_model(x) for x in resources]
625+
if query is not None:
626+
query = convert_model(query)
618627
headers = {
619628
'x-request-id': x_request_id,
620629
'x-correlation-id': x_correlation_id,
@@ -632,9 +641,10 @@ def detach_tag(
632641
}
633642

634643
data = {
635-
'resources': resources,
636644
'tag_name': tag_name,
637645
'tag_names': tag_names,
646+
'resources': resources,
647+
'query': query,
638648
}
639649
data = {k: v for (k, v) in data.items() if v is not None}
640650
data = json.dumps(data)
@@ -672,7 +682,6 @@ class TagType(str, Enum):
672682
USER = 'user'
673683
SERVICE = 'service'
674684
ACCESS = 'access'
675-
676685
class Providers(str, Enum):
677686
"""
678687
Select a provider. Supported values are `ghost` and `ims`. To list both Global
@@ -683,7 +692,6 @@ class Providers(str, Enum):
683692

684693
GHOST = 'ghost'
685694
IMS = 'ims'
686-
687695
class OrderByName(str, Enum):
688696
"""
689697
Order the output by tag name.
@@ -718,7 +726,6 @@ class Providers(str, Enum):
718726

719727
GHOST = 'ghost'
720728
IMS = 'ims'
721-
722729
class TagType(str, Enum):
723730
"""
724731
The type of the tag. Supported values are `user`, `service` and `access`.
@@ -744,7 +751,6 @@ class Providers(str, Enum):
744751

745752
GHOST = 'ghost'
746753
IMS = 'ims'
747-
748754
class TagType(str, Enum):
749755
"""
750756
The type of the tag. Supported values are `user`, `service` and `access`.
@@ -1001,6 +1007,8 @@ class DeleteTagResultsItem:
10011007
:param str provider: (optional) The provider of the tag.
10021008
:param bool is_error: (optional) It is `true` if the operation exits with an
10031009
error (for example, the tag does not exist).
1010+
1011+
This type supports additional properties of type object.
10041012
"""
10051013

10061014
# The set of defined properties for the class
@@ -1011,20 +1019,25 @@ def __init__(
10111019
*,
10121020
provider: Optional[str] = None,
10131021
is_error: Optional[bool] = None,
1014-
**kwargs,
1022+
**kwargs: Optional[object],
10151023
) -> None:
10161024
"""
10171025
Initialize a DeleteTagResultsItem object.
10181026
10191027
:param str provider: (optional) The provider of the tag.
10201028
:param bool is_error: (optional) It is `true` if the operation exits with
10211029
an error (for example, the tag does not exist).
1022-
:param **kwargs: (optional) Any additional properties.
1030+
:param object **kwargs: (optional) Additional properties of type object
10231031
"""
10241032
self.provider = provider
10251033
self.is_error = is_error
1026-
for _key, _value in kwargs.items():
1027-
setattr(self, _key, _value)
1034+
for k, v in kwargs.items():
1035+
if k not in DeleteTagResultsItem._properties:
1036+
if not isinstance(v, object):
1037+
raise ValueError('Value for additional property {} must be of type object'.format(k))
1038+
setattr(self, k, v)
1039+
else:
1040+
raise ValueError('Property {} cannot be specified as an additional property'.format(k))
10281041

10291042
@classmethod
10301043
def from_dict(cls, _dict: Dict) -> 'DeleteTagResultsItem':
@@ -1034,7 +1047,11 @@ def from_dict(cls, _dict: Dict) -> 'DeleteTagResultsItem':
10341047
args['provider'] = provider
10351048
if (is_error := _dict.get('is_error')) is not None:
10361049
args['is_error'] = is_error
1037-
args.update({k: v for (k, v) in _dict.items() if k not in cls._properties})
1050+
for k, v in _dict.items():
1051+
if k not in cls._properties:
1052+
if not isinstance(v, object):
1053+
raise ValueError('Value for additional property {} must be of type object'.format(k))
1054+
args[k] = v
10381055
return cls(**args)
10391056

10401057
@classmethod
@@ -1049,30 +1066,32 @@ def to_dict(self) -> Dict:
10491066
_dict['provider'] = self.provider
10501067
if hasattr(self, 'is_error') and self.is_error is not None:
10511068
_dict['is_error'] = self.is_error
1052-
for _key in [k for k in vars(self).keys() if k not in DeleteTagResultsItem._properties]:
1053-
_dict[_key] = getattr(self, _key)
1069+
for k in [_k for _k in vars(self).keys() if _k not in DeleteTagResultsItem._properties]:
1070+
_dict[k] = getattr(self, k)
10541071
return _dict
10551072

10561073
def _to_dict(self):
10571074
"""Return a json dictionary representing this model."""
10581075
return self.to_dict()
10591076

10601077
def get_properties(self) -> Dict:
1061-
"""Return a dictionary of arbitrary properties from this instance of DeleteTagResultsItem"""
1078+
"""Return the additional properties from this instance of DeleteTagResultsItem in the form of a dict."""
10621079
_dict = {}
1063-
1064-
for _key in [k for k in vars(self).keys() if k not in DeleteTagResultsItem._properties]:
1065-
_dict[_key] = getattr(self, _key)
1080+
for k in [_k for _k in vars(self).keys() if _k not in DeleteTagResultsItem._properties]:
1081+
_dict[k] = getattr(self, k)
10661082
return _dict
10671083

10681084
def set_properties(self, _dict: dict):
1069-
"""Set a dictionary of arbitrary properties to this instance of DeleteTagResultsItem"""
1070-
for _key in [k for k in vars(self).keys() if k not in DeleteTagResultsItem._properties]:
1071-
delattr(self, _key)
1072-
1073-
for _key, _value in _dict.items():
1074-
if _key not in DeleteTagResultsItem._properties:
1075-
setattr(self, _key, _value)
1085+
"""Set a dictionary of additional properties in this instance of DeleteTagResultsItem"""
1086+
for k in [_k for _k in vars(self).keys() if _k not in DeleteTagResultsItem._properties]:
1087+
delattr(self, k)
1088+
for k, v in _dict.items():
1089+
if k not in DeleteTagResultsItem._properties:
1090+
if not isinstance(v, object):
1091+
raise ValueError('Value for additional property {} must be of type object'.format(k))
1092+
setattr(self, k, v)
1093+
else:
1094+
raise ValueError('Property {} cannot be specified as an additional property'.format(k))
10761095

10771096
def __str__(self) -> str:
10781097
"""Return a `str` version of this DeleteTagResultsItem object."""
@@ -1097,6 +1116,7 @@ class ProviderEnum(str, Enum):
10971116
IMS = 'ims'
10981117

10991118

1119+
11001120
class DeleteTagsResult:
11011121
"""
11021122
Results of deleting unattatched tags.
@@ -1248,12 +1268,76 @@ def __ne__(self, other: 'DeleteTagsResultItem') -> bool:
12481268
return not self == other
12491269

12501270

1271+
class QueryString:
1272+
"""
1273+
A valid Global Search string.
1274+
1275+
:param str query_string: The Lucene-formatted query string.
1276+
"""
1277+
1278+
def __init__(
1279+
self,
1280+
query_string: str,
1281+
) -> None:
1282+
"""
1283+
Initialize a QueryString object.
1284+
1285+
:param str query_string: The Lucene-formatted query string.
1286+
"""
1287+
self.query_string = query_string
1288+
1289+
@classmethod
1290+
def from_dict(cls, _dict: Dict) -> 'QueryString':
1291+
"""Initialize a QueryString object from a json dictionary."""
1292+
args = {}
1293+
if (query_string := _dict.get('query_string')) is not None:
1294+
args['query_string'] = query_string
1295+
else:
1296+
raise ValueError('Required property \'query_string\' not present in QueryString JSON')
1297+
return cls(**args)
1298+
1299+
@classmethod
1300+
def _from_dict(cls, _dict):
1301+
"""Initialize a QueryString object from a json dictionary."""
1302+
return cls.from_dict(_dict)
1303+
1304+
def to_dict(self) -> Dict:
1305+
"""Return a json dictionary representing this model."""
1306+
_dict = {}
1307+
if hasattr(self, 'query_string') and self.query_string is not None:
1308+
_dict['query_string'] = self.query_string
1309+
return _dict
1310+
1311+
def _to_dict(self):
1312+
"""Return a json dictionary representing this model."""
1313+
return self.to_dict()
1314+
1315+
def __str__(self) -> str:
1316+
"""Return a `str` version of this QueryString object."""
1317+
return json.dumps(self.to_dict(), indent=2)
1318+
1319+
def __eq__(self, other: 'QueryString') -> bool:
1320+
"""Return `true` when self and other are equal, false otherwise."""
1321+
if not isinstance(other, self.__class__):
1322+
return False
1323+
return self.__dict__ == other.__dict__
1324+
1325+
def __ne__(self, other: 'QueryString') -> bool:
1326+
"""Return `true` when self and other are not equal, false otherwise."""
1327+
return not self == other
1328+
1329+
12511330
class Resource:
12521331
"""
12531332
A resource that might have tags that are attached.
12541333
12551334
:param str resource_id: The CRN or IMS ID of the resource.
1256-
:param str resource_type: (optional) The IMS resource type of the resource.
1335+
:param str resource_type: (optional) The IMS resource type of the resource. It
1336+
can be one of SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware,
1337+
SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller,
1338+
SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall,
1339+
SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context,
1340+
SoftLayer_Virtual_Guest.
12571341
"""
12581342

12591343
def __init__(
@@ -1267,6 +1351,11 @@ def __init__(
12671351
12681352
:param str resource_id: The CRN or IMS ID of the resource.
12691353
:param str resource_type: (optional) The IMS resource type of the resource.
1354+
It can be one of SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware,
1355+
SoftLayer_Hardware_Server,
1356+
SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan,
1357+
SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall,
1358+
SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest.
12701359
"""
12711360
self.resource_id = resource_id
12721361
self.resource_type = resource_type

0 commit comments

Comments
 (0)