@@ -411,9 +411,10 @@ def properties_from_model_class(cls, model_class):
411411 return result
412412
413413 def candidate_apis (self ):
414+ api_match = self .api_version .replace ('/' , '_' ).lower ()
414415 return [
415416 api for api in self .available_apis ()
416- if self . api_version in self .attribute_to_snake (api )
417+ if api_match in self .attribute_to_snake (api )
417418 or not VERSION_RX .match (api )
418419 ]
419420
@@ -433,7 +434,6 @@ def lookup_method(self, operation=None, namespace=None, method_name=None):
433434 method = None
434435 for api in self .candidate_apis ():
435436 api_class = self .api_class_from_name (api )
436-
437437 method = getattr (api_class (self .api_client ), method_name , None )
438438 if method is not None :
439439 break
@@ -487,8 +487,13 @@ def get_model(self, api_version, kind):
487487 :param kind: The name of object type (i.e. Service, Route, Container, etc.)
488488 :return: class
489489 """
490+
491+ # Handle API paths. In the case of 'batch/', remove it completely, otherwise, replace '/' with '_'.
492+ api = re .sub (r'batch/' , '' , api_version , count = 0 , flags = re .IGNORECASE ).replace ('/' , '_' )
493+
490494 camel_kind = string_utils .snake_case_to_camel (kind )
491- camel_api_version = string_utils .snake_case_to_camel (api_version )
495+ camel_api_version = string_utils .snake_case_to_camel (api )
496+
492497 # capitalize the first letter of the string without lower-casing the remainder
493498 name = (camel_kind [:1 ].capitalize () + camel_kind [1 :]).replace ("Api" , "API" )
494499 api = camel_api_version [:1 ].capitalize () + camel_api_version [1 :]
0 commit comments