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.
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.100 .0-2ad7a784-20250212-162551
1818
1919"""
2020Search for resources with the global and shared resource properties repository that is
@@ -61,7 +61,9 @@ def new_instance(
6161 parameters and external configuration.
6262 """
6363 authenticator = get_authenticator_from_environment (service_name )
64- service = cls (authenticator )
64+ service = cls (
65+ authenticator
66+ )
6567 service .configure_service (service_name )
6668 return service
6769
@@ -96,7 +98,6 @@ def search(
9698 sort : Optional [List [str ]] = None ,
9799 is_deleted : Optional [str ] = None ,
98100 is_reclaimed : Optional [str ] = None ,
99- is_public : Optional [str ] = None ,
100101 impersonate_user : Optional [str ] = None ,
101102 can_tag : Optional [str ] = None ,
102103 is_project_resource : Optional [str ] = None ,
@@ -106,21 +107,17 @@ def search(
106107 Find instances of resources (v3).
107108
108109 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.
116111 You must use `/v3/resources/search` when you need to fetch more than `10000`
117112 resource items. On the first call, the operation returns a live cursor on the data
118113 that you must use on all the subsequent calls to get the next batch of results
119114 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.
124121
125122 :param str query: (optional) The Lucene-formatted query string. Default to
126123 '*' if not set.
@@ -132,7 +129,8 @@ def search(
132129 :param str search_cursor: (optional) An opaque cursor that is returned on
133130 each call and that must be set on the subsequent call to get the next batch
134131 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.
136134 :param str x_request_id: (optional) An alphanumeric string that is used to
137135 trace the request. The value may include ASCII alphanumerics and any of
138136 following segment separators: space ( ), comma (,), hyphen, (-), and
@@ -169,10 +167,6 @@ def search(
169167 (default), true or any. If false, only not reclaimed documents are
170168 returned; if true, only reclaimed documents are returned; If any, both
171169 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.
176170 :param str impersonate_user: (optional) The user on whose behalf the search
177171 must be performed. Only a GhoST admin can impersonate a user, so be sure
178172 you set a GhoST admin IAM token in the Authorization header if you set this
@@ -212,7 +206,6 @@ def search(
212206 'sort' : convert_list (sort ),
213207 'is_deleted' : is_deleted ,
214208 'is_reclaimed' : is_reclaimed ,
215- 'is_public' : is_public ,
216209 'impersonate_user' : impersonate_user ,
217210 'can_tag' : can_tag ,
218211 'is_project_resource' : is_project_resource ,
@@ -261,7 +254,6 @@ class IsDeleted(str, Enum):
261254 TRUE = 'true'
262255 FALSE = 'false'
263256 ANY = 'any'
264-
265257 class IsReclaimed (str , Enum ):
266258 """
267259 Determines if reclaimed documents should be included in result set or not.
@@ -273,18 +265,6 @@ class IsReclaimed(str, Enum):
273265 TRUE = 'true'
274266 FALSE = 'false'
275267 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-
288268 class CanTag (str , Enum ):
289269 """
290270 Determines if the result set must return the resources that the user can tag or
@@ -296,7 +276,6 @@ class CanTag(str, Enum):
296276
297277 TRUE = 'true'
298278 FALSE = 'false'
299-
300279 class IsProjectResource (str , Enum ):
301280 """
302281 Determines if documents belonging to Project family should be included in result
@@ -322,6 +301,8 @@ class ResultItem:
322301 other properties that depend on the resource type.
323302
324303 :param str crn: Resource identifier in CRN format.
304+
305+ This type supports additional properties of type object.
325306 """
326307
327308 # The set of defined properties for the class
@@ -330,17 +311,22 @@ class ResultItem:
330311 def __init__ (
331312 self ,
332313 crn : str ,
333- ** kwargs ,
314+ ** kwargs : Optional [ object ] ,
334315 ) -> None :
335316 """
336317 Initialize a ResultItem object.
337318
338319 :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
340321 """
341322 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 ))
344330
345331 @classmethod
346332 def from_dict (cls , _dict : Dict ) -> 'ResultItem' :
@@ -350,7 +336,11 @@ def from_dict(cls, _dict: Dict) -> 'ResultItem':
350336 args ['crn' ] = crn
351337 else :
352338 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
354344 return cls (** args )
355345
356346 @classmethod
@@ -363,30 +353,32 @@ def to_dict(self) -> Dict:
363353 _dict = {}
364354 if hasattr (self , 'crn' ) and self .crn is not None :
365355 _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 )
368358 return _dict
369359
370360 def _to_dict (self ):
371361 """Return a json dictionary representing this model."""
372362 return self .to_dict ()
373363
374364 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. """
376366 _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 )
380369 return _dict
381370
382371 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 ))
390382
391383 def __str__ (self ) -> str :
392384 """Return a `str` version of this ResultItem object."""
0 commit comments