1
1
# coding: utf-8
2
2
3
- # (C) Copyright IBM Corp. 2024 .
3
+ # (C) Copyright IBM Corp. 2025 .
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.87 .0-91c7c775-20240320-213027
17
+ # IBM OpenAPI SDK Code Generator Version: 3.100 .0-2ad7a784-20250212-162551
18
18
19
19
"""
20
20
Search for resources with the global and shared resource properties repository that is
@@ -61,7 +61,9 @@ def new_instance(
61
61
parameters and external configuration.
62
62
"""
63
63
authenticator = get_authenticator_from_environment (service_name )
64
- service = cls (authenticator )
64
+ service = cls (
65
+ authenticator
66
+ )
65
67
service .configure_service (service_name )
66
68
return service
67
69
@@ -96,7 +98,6 @@ def search(
96
98
sort : Optional [List [str ]] = None ,
97
99
is_deleted : Optional [str ] = None ,
98
100
is_reclaimed : Optional [str ] = None ,
99
- is_public : Optional [str ] = None ,
100
101
impersonate_user : Optional [str ] = None ,
101
102
can_tag : Optional [str ] = None ,
102
103
is_project_resource : Optional [str ] = None ,
@@ -106,21 +107,17 @@ def search(
106
107
Find instances of resources (v3).
107
108
108
109
Find IAM-enabled resources or storage and network resources that run on classic
109
- infrastructure in a specific account ID. You can apply query strings if necessary.
110
- To filter results, you can insert a string by using the Lucene syntax and the
111
- query string is parsed into a series of terms and operators. A term can be a
112
- single word or a phrase, in which case the search is performed for all the words,
113
- in the same order. To filter for a specific value regardless of the property that
114
- contains it, type the search term without specifying a field. Only resources that
115
- belong to the account ID and that are accessible by the client are returned.
110
+ infrastructure in a specific account ID.
116
111
You must use `/v3/resources/search` when you need to fetch more than `10000`
117
112
resource items. On the first call, the operation returns a live cursor on the data
118
113
that you must use on all the subsequent calls to get the next batch of results
119
114
until you get the empty result set.
120
- By default, the fields that are returned for every resource are `crn`, `name`,
121
- `family`, `type`, and `account_id`. You can specify the subset of the fields you
122
- want in your request using the `fields` request body attribute. Set `"fields":
123
- ["*"]` to discover the set of fields which are available to request.
115
+ To filter results, you can apply query strings following the *Lucene* query
116
+ syntax.
117
+ By default, the fields that are returned for every resource are **crn**, **name**,
118
+ **family**, **type**, and **account_id**. You can specify the subset of the fields
119
+ you want in your request using the `fields` request body attribute. Set `"fields":
120
+ ["*"]` to discover the complete set of fields which are available to request.
124
121
125
122
:param str query: (optional) The Lucene-formatted query string. Default to
126
123
'*' if not set.
@@ -132,7 +129,8 @@ def search(
132
129
:param str search_cursor: (optional) An opaque cursor that is returned on
133
130
each call and that must be set on the subsequent call to get the next batch
134
131
of items. If the search returns no items, then the search_cursor is not
135
- present in the response.
132
+ present in the response. NOTE: any other properties present in the body
133
+ will be ignored.
136
134
:param str x_request_id: (optional) An alphanumeric string that is used to
137
135
trace the request. The value may include ASCII alphanumerics and any of
138
136
following segment separators: space ( ), comma (,), hyphen, (-), and
@@ -169,10 +167,6 @@ def search(
169
167
(default), true or any. If false, only not reclaimed documents are
170
168
returned; if true, only reclaimed documents are returned; If any, both
171
169
reclaimed and not reclaimed documents are returned.
172
- :param str is_public: (optional) Determines if public resources should be
173
- included in result set or not. Possible values are false (default), true or
174
- any. If false, do not search public resources; if true, search only public
175
- resources; If any, search also public resources.
176
170
:param str impersonate_user: (optional) The user on whose behalf the search
177
171
must be performed. Only a GhoST admin can impersonate a user, so be sure
178
172
you set a GhoST admin IAM token in the Authorization header if you set this
@@ -212,7 +206,6 @@ def search(
212
206
'sort' : convert_list (sort ),
213
207
'is_deleted' : is_deleted ,
214
208
'is_reclaimed' : is_reclaimed ,
215
- 'is_public' : is_public ,
216
209
'impersonate_user' : impersonate_user ,
217
210
'can_tag' : can_tag ,
218
211
'is_project_resource' : is_project_resource ,
@@ -261,7 +254,6 @@ class IsDeleted(str, Enum):
261
254
TRUE = 'true'
262
255
FALSE = 'false'
263
256
ANY = 'any'
264
-
265
257
class IsReclaimed (str , Enum ):
266
258
"""
267
259
Determines if reclaimed documents should be included in result set or not.
@@ -273,18 +265,6 @@ class IsReclaimed(str, Enum):
273
265
TRUE = 'true'
274
266
FALSE = 'false'
275
267
ANY = 'any'
276
-
277
- class IsPublic (str , Enum ):
278
- """
279
- Determines if public resources should be included in result set or not. Possible
280
- values are false (default), true or any. If false, do not search public resources;
281
- if true, search only public resources; If any, search also public resources.
282
- """
283
-
284
- TRUE = 'true'
285
- FALSE = 'false'
286
- ANY = 'any'
287
-
288
268
class CanTag (str , Enum ):
289
269
"""
290
270
Determines if the result set must return the resources that the user can tag or
@@ -296,7 +276,6 @@ class CanTag(str, Enum):
296
276
297
277
TRUE = 'true'
298
278
FALSE = 'false'
299
-
300
279
class IsProjectResource (str , Enum ):
301
280
"""
302
281
Determines if documents belonging to Project family should be included in result
@@ -322,6 +301,8 @@ class ResultItem:
322
301
other properties that depend on the resource type.
323
302
324
303
:param str crn: Resource identifier in CRN format.
304
+
305
+ This type supports additional properties of type object.
325
306
"""
326
307
327
308
# The set of defined properties for the class
@@ -330,17 +311,22 @@ class ResultItem:
330
311
def __init__ (
331
312
self ,
332
313
crn : str ,
333
- ** kwargs ,
314
+ ** kwargs : Optional [ object ] ,
334
315
) -> None :
335
316
"""
336
317
Initialize a ResultItem object.
337
318
338
319
:param str crn: Resource identifier in CRN format.
339
- :param **kwargs: (optional) Any additional properties.
320
+ :param object **kwargs: (optional) Additional properties of type object
340
321
"""
341
322
self .crn = crn
342
- for _key , _value in kwargs .items ():
343
- setattr (self , _key , _value )
323
+ for k , v in kwargs .items ():
324
+ if k not in ResultItem ._properties :
325
+ if not isinstance (v , object ):
326
+ raise ValueError ('Value for additional property {} must be of type object' .format (k ))
327
+ setattr (self , k , v )
328
+ else :
329
+ raise ValueError ('Property {} cannot be specified as an additional property' .format (k ))
344
330
345
331
@classmethod
346
332
def from_dict (cls , _dict : Dict ) -> 'ResultItem' :
@@ -350,7 +336,11 @@ def from_dict(cls, _dict: Dict) -> 'ResultItem':
350
336
args ['crn' ] = crn
351
337
else :
352
338
raise ValueError ('Required property \' crn\' not present in ResultItem JSON' )
353
- args .update ({k : v for (k , v ) in _dict .items () if k not in cls ._properties })
339
+ for k , v in _dict .items ():
340
+ if k not in cls ._properties :
341
+ if not isinstance (v , object ):
342
+ raise ValueError ('Value for additional property {} must be of type object' .format (k ))
343
+ args [k ] = v
354
344
return cls (** args )
355
345
356
346
@classmethod
@@ -363,30 +353,32 @@ def to_dict(self) -> Dict:
363
353
_dict = {}
364
354
if hasattr (self , 'crn' ) and self .crn is not None :
365
355
_dict ['crn' ] = self .crn
366
- for _key in [k for k in vars (self ).keys () if k not in ResultItem ._properties ]:
367
- _dict [_key ] = getattr (self , _key )
356
+ for k in [_k for _k in vars (self ).keys () if _k not in ResultItem ._properties ]:
357
+ _dict [k ] = getattr (self , k )
368
358
return _dict
369
359
370
360
def _to_dict (self ):
371
361
"""Return a json dictionary representing this model."""
372
362
return self .to_dict ()
373
363
374
364
def get_properties (self ) -> Dict :
375
- """Return a dictionary of arbitrary properties from this instance of ResultItem"""
365
+ """Return the additional properties from this instance of ResultItem in the form of a dict. """
376
366
_dict = {}
377
-
378
- for _key in [k for k in vars (self ).keys () if k not in ResultItem ._properties ]:
379
- _dict [_key ] = getattr (self , _key )
367
+ for k in [_k for _k in vars (self ).keys () if _k not in ResultItem ._properties ]:
368
+ _dict [k ] = getattr (self , k )
380
369
return _dict
381
370
382
371
def set_properties (self , _dict : dict ):
383
- """Set a dictionary of arbitrary properties to this instance of ResultItem"""
384
- for _key in [k for k in vars (self ).keys () if k not in ResultItem ._properties ]:
385
- delattr (self , _key )
386
-
387
- for _key , _value in _dict .items ():
388
- if _key not in ResultItem ._properties :
389
- setattr (self , _key , _value )
372
+ """Set a dictionary of additional properties in this instance of ResultItem"""
373
+ for k in [_k for _k in vars (self ).keys () if _k not in ResultItem ._properties ]:
374
+ delattr (self , k )
375
+ for k , v in _dict .items ():
376
+ if k not in ResultItem ._properties :
377
+ if not isinstance (v , object ):
378
+ raise ValueError ('Value for additional property {} must be of type object' .format (k ))
379
+ setattr (self , k , v )
380
+ else :
381
+ raise ValueError ('Property {} cannot be specified as an additional property' .format (k ))
390
382
391
383
def __str__ (self ) -> str :
392
384
"""Return a `str` version of this ResultItem object."""
0 commit comments