1
1
# coding: utf-8
2
2
3
- # (C) Copyright IBM Corp. 2023 .
3
+ # (C) Copyright IBM Corp. 2024 .
4
4
#
5
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
6
# you may not use this file except in compliance with the License.
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
- # IBM OpenAPI SDK Code Generator Version: 3.82.1-2082d402-20231115-195014
17
+ # IBM OpenAPI SDK Code Generator Version: 3.86.0-bc6f14b3-20240221-193958
18
18
19
19
"""
20
20
Manage your tags with the Tagging API in IBM Cloud. You can attach, detach, delete, or
@@ -480,6 +480,7 @@ def attach_tag(
480
480
transaction_id : Optional [str ] = None ,
481
481
account_id : Optional [str ] = None ,
482
482
tag_type : Optional [str ] = None ,
483
+ replace : Optional [bool ] = None ,
483
484
** kwargs ,
484
485
) -> DetailedResponse :
485
486
"""
@@ -519,6 +520,9 @@ def attach_tag(
519
520
:param str tag_type: (optional) The type of the tag. Supported values are
520
521
`user`, `service` and `access`. `service` and `access` are not supported
521
522
for IMS resources.
523
+ :param bool replace: (optional) Flag to request replacement of all attached
524
+ tags. Set 'true' if you want to replace all the list of tags attached to
525
+ the resource. Default value is false.
522
526
:param dict headers: A `dict` containing the request headers
523
527
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
524
528
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
@@ -542,6 +546,7 @@ def attach_tag(
542
546
params = {
543
547
'account_id' : account_id ,
544
548
'tag_type' : tag_type ,
549
+ 'replace' : replace ,
545
550
}
546
551
547
552
data = {
@@ -831,8 +836,8 @@ def __init__(
831
836
def from_dict (cls , _dict : Dict ) -> 'CreateTagResults' :
832
837
"""Initialize a CreateTagResults object from a json dictionary."""
833
838
args = {}
834
- if 'results' in _dict :
835
- args ['results' ] = [CreateTagResultsResultsItem .from_dict (v ) for v in _dict . get ( ' results' ) ]
839
+ if ( results := _dict . get ( 'results' )) is not None :
840
+ args ['results' ] = [CreateTagResultsResultsItem .from_dict (v ) for v in results ]
836
841
return cls (** args )
837
842
838
843
@classmethod
@@ -901,10 +906,10 @@ def __init__(
901
906
def from_dict (cls , _dict : Dict ) -> 'CreateTagResultsResultsItem' :
902
907
"""Initialize a CreateTagResultsResultsItem object from a json dictionary."""
903
908
args = {}
904
- if 'tag_name' in _dict :
905
- args ['tag_name' ] = _dict . get ( ' tag_name' )
906
- if 'is_error' in _dict :
907
- args ['is_error' ] = _dict . get ( ' is_error' )
909
+ if ( tag_name := _dict . get ( 'tag_name' )) is not None :
910
+ args ['tag_name' ] = tag_name
911
+ if ( is_error := _dict . get ( 'is_error' )) is not None :
912
+ args ['is_error' ] = is_error
908
913
return cls (** args )
909
914
910
915
@classmethod
@@ -965,8 +970,8 @@ def __init__(
965
970
def from_dict (cls , _dict : Dict ) -> 'DeleteTagResults' :
966
971
"""Initialize a DeleteTagResults object from a json dictionary."""
967
972
args = {}
968
- if 'results' in _dict :
969
- args ['results' ] = [DeleteTagResultsItem .from_dict (v ) for v in _dict . get ( ' results' ) ]
973
+ if ( results := _dict . get ( 'results' )) is not None :
974
+ args ['results' ] = [DeleteTagResultsItem .from_dict (v ) for v in results ]
970
975
return cls (** args )
971
976
972
977
@classmethod
@@ -1042,10 +1047,10 @@ def __init__(
1042
1047
def from_dict (cls , _dict : Dict ) -> 'DeleteTagResultsItem' :
1043
1048
"""Initialize a DeleteTagResultsItem object from a json dictionary."""
1044
1049
args = {}
1045
- if 'provider' in _dict :
1046
- args ['provider' ] = _dict . get ( ' provider' )
1047
- if 'is_error' in _dict :
1048
- args ['is_error' ] = _dict . get ( ' is_error' )
1050
+ if ( provider := _dict . get ( 'provider' )) is not None :
1051
+ args ['provider' ] = provider
1052
+ if ( is_error := _dict . get ( 'is_error' )) is not None :
1053
+ args ['is_error' ] = is_error
1049
1054
args .update ({k : v for (k , v ) in _dict .items () if k not in cls ._properties })
1050
1055
return cls (** args )
1051
1056
@@ -1145,12 +1150,12 @@ def __init__(
1145
1150
def from_dict (cls , _dict : Dict ) -> 'DeleteTagsResult' :
1146
1151
"""Initialize a DeleteTagsResult object from a json dictionary."""
1147
1152
args = {}
1148
- if 'total_count' in _dict :
1149
- args ['total_count' ] = _dict . get ( ' total_count' )
1150
- if 'errors' in _dict :
1151
- args ['errors' ] = _dict . get ( ' errors' )
1152
- if 'items' in _dict :
1153
- args ['items' ] = [DeleteTagsResultItem .from_dict (v ) for v in _dict . get ( ' items' ) ]
1153
+ if ( total_count := _dict . get ( 'total_count' )) is not None :
1154
+ args ['total_count' ] = total_count
1155
+ if ( errors := _dict . get ( 'errors' )) is not None :
1156
+ args ['errors' ] = errors
1157
+ if ( items := _dict . get ( 'items' )) is not None :
1158
+ args ['items' ] = [DeleteTagsResultItem .from_dict (v ) for v in items ]
1154
1159
return cls (** args )
1155
1160
1156
1161
@classmethod
@@ -1221,10 +1226,10 @@ def __init__(
1221
1226
def from_dict (cls , _dict : Dict ) -> 'DeleteTagsResultItem' :
1222
1227
"""Initialize a DeleteTagsResultItem object from a json dictionary."""
1223
1228
args = {}
1224
- if 'tag_name' in _dict :
1225
- args ['tag_name' ] = _dict . get ( ' tag_name' )
1226
- if 'is_error' in _dict :
1227
- args ['is_error' ] = _dict . get ( ' is_error' )
1229
+ if ( tag_name := _dict . get ( 'tag_name' )) is not None :
1230
+ args ['tag_name' ] = tag_name
1231
+ if ( is_error := _dict . get ( 'is_error' )) is not None :
1232
+ args ['is_error' ] = is_error
1228
1233
return cls (** args )
1229
1234
1230
1235
@classmethod
@@ -1287,12 +1292,12 @@ def __init__(
1287
1292
def from_dict (cls , _dict : Dict ) -> 'Resource' :
1288
1293
"""Initialize a Resource object from a json dictionary."""
1289
1294
args = {}
1290
- if 'resource_id' in _dict :
1291
- args ['resource_id' ] = _dict . get ( ' resource_id' )
1295
+ if ( resource_id := _dict . get ( 'resource_id' )) is not None :
1296
+ args ['resource_id' ] = resource_id
1292
1297
else :
1293
1298
raise ValueError ('Required property \' resource_id\' not present in Resource JSON' )
1294
- if 'resource_type' in _dict :
1295
- args ['resource_type' ] = _dict . get ( ' resource_type' )
1299
+ if ( resource_type := _dict . get ( 'resource_type' )) is not None :
1300
+ args ['resource_type' ] = resource_type
1296
1301
return cls (** args )
1297
1302
1298
1303
@classmethod
@@ -1350,8 +1355,8 @@ def __init__(
1350
1355
def from_dict (cls , _dict : Dict ) -> 'Tag' :
1351
1356
"""Initialize a Tag object from a json dictionary."""
1352
1357
args = {}
1353
- if 'name' in _dict :
1354
- args ['name' ] = _dict . get ( ' name' )
1358
+ if ( name := _dict . get ( 'name' )) is not None :
1359
+ args ['name' ] = name
1355
1360
else :
1356
1361
raise ValueError ('Required property \' name\' not present in Tag JSON' )
1357
1362
return cls (** args )
@@ -1424,14 +1429,14 @@ def __init__(
1424
1429
def from_dict (cls , _dict : Dict ) -> 'TagList' :
1425
1430
"""Initialize a TagList object from a json dictionary."""
1426
1431
args = {}
1427
- if 'total_count' in _dict :
1428
- args ['total_count' ] = _dict . get ( ' total_count' )
1429
- if 'offset' in _dict :
1430
- args ['offset' ] = _dict . get ( ' offset' )
1431
- if 'limit' in _dict :
1432
- args ['limit' ] = _dict . get ( ' limit' )
1433
- if 'items' in _dict :
1434
- args ['items' ] = [Tag .from_dict (v ) for v in _dict . get ( ' items' ) ]
1432
+ if ( total_count := _dict . get ( 'total_count' )) is not None :
1433
+ args ['total_count' ] = total_count
1434
+ if ( offset := _dict . get ( 'offset' )) is not None :
1435
+ args ['offset' ] = offset
1436
+ if ( limit := _dict . get ( 'limit' )) is not None :
1437
+ args ['limit' ] = limit
1438
+ if ( items := _dict . get ( 'items' )) is not None :
1439
+ args ['items' ] = [Tag .from_dict (v ) for v in items ]
1435
1440
return cls (** args )
1436
1441
1437
1442
@classmethod
@@ -1502,8 +1507,8 @@ def __init__(
1502
1507
def from_dict (cls , _dict : Dict ) -> 'TagResults' :
1503
1508
"""Initialize a TagResults object from a json dictionary."""
1504
1509
args = {}
1505
- if 'results' in _dict :
1506
- args ['results' ] = [TagResultsItem .from_dict (v ) for v in _dict . get ( ' results' ) ]
1510
+ if ( results := _dict . get ( 'results' )) is not None :
1511
+ args ['results' ] = [TagResultsItem .from_dict (v ) for v in results ]
1507
1512
return cls (** args )
1508
1513
1509
1514
@classmethod
@@ -1572,12 +1577,12 @@ def __init__(
1572
1577
def from_dict (cls , _dict : Dict ) -> 'TagResultsItem' :
1573
1578
"""Initialize a TagResultsItem object from a json dictionary."""
1574
1579
args = {}
1575
- if 'resource_id' in _dict :
1576
- args ['resource_id' ] = _dict . get ( ' resource_id' )
1580
+ if ( resource_id := _dict . get ( 'resource_id' )) is not None :
1581
+ args ['resource_id' ] = resource_id
1577
1582
else :
1578
1583
raise ValueError ('Required property \' resource_id\' not present in TagResultsItem JSON' )
1579
- if 'is_error' in _dict :
1580
- args ['is_error' ] = _dict . get ( ' is_error' )
1584
+ if ( is_error := _dict . get ( 'is_error' )) is not None :
1585
+ args ['is_error' ] = is_error
1581
1586
return cls (** args )
1582
1587
1583
1588
@classmethod
0 commit comments