Beispiel #1
0
 def inner(self, resource, *args, **kwargs):
     serialize_response = kwargs.pop('serialize', True)
     try:
         resp = func(self, resource, *args, **kwargs)
     except ApiException as e:
         raise api_exception(e)
     if serialize_response:
         return serialize(resource, resp)
     return resp
 def update_object(self, object_config, default_namespace=None):
     update_method, is_namespaced, is_custom_object = self.client_director.determine_api_method_for_update_object(
         object_config.api_version, object_config.kind)
     if default_namespace is None:
         default_namespace = self.default_namespace
     update_args = self.__build_update_arguments(object_config,
                                                 is_namespaced,
                                                 default_namespace,
                                                 is_custom_object)
     try:
         return update_method(**update_args)
     except ApiException as e:
         raise api_exception(e)
 def read_object(self, api_version, kind, name, namespace=None):
     read_method, is_namespaced, is_custom_object = self.client_director.determine_api_method_for_read_object(
         api_version, kind)
     if not is_namespaced:
         namespace = None
     elif namespace is None:
         namespace = self.default_namespace
     read_args = self.__build_read_arguments(api_version, kind, name,
                                             namespace, is_custom_object)
     try:
         return read_method(**read_args)
     except ApiException as e:
         raise api_exception(e)