def _format_operation(self, request, operation, scope): result_dict = { "name": operation["name"], "operationType": operation["type"], "insertTime": operation["insert_time"], "startTime": operation["start_time"], "status": operation["status"], "progress": operation["progress"], "user": operation["user"], } result_dict["targetLink"] = self._qualify( request, utils.get_collection_name(operation["target_type"]), operation["target_name"], scope) result_dict["targetId"] = self._get_id(result_dict["targetLink"]) if "end_time" in operation: result_dict["endTime"] = operation["end_time"] if "error_code" in operation: result_dict.update({ "httpErrorStatusCode": operation["error_code"], "httpErrorMessage": operation["error_message"], "error": {"errors": operation["errors"]}, }) type_name = self._operation_api._get_type() return self._add_item_header(request, result_dict, scope, utils.get_type_kind(type_name), utils.get_collection_name(type_name))
def _format_operation(self, request, operation, scope): result_dict = { "name": operation["name"], "operationType": operation["type"], "insertTime": operation["insert_time"], "startTime": operation["start_time"], "status": operation["status"], "progress": operation["progress"], "user": operation["user"], } result_dict["targetLink"] = self._qualify( request, utils.get_collection_name(operation["target_type"]), operation["target_name"], scope) result_dict["targetId"] = self._get_id(result_dict["targetLink"]) if "end_time" in operation: result_dict["endTime"] = operation["end_time"] if "error_code" in operation: result_dict.update({ "httpErrorStatusCode": operation["error_code"], "httpErrorMessage": operation["error_message"], "error": { "errors": operation["errors"] }, }) type_name = self._operation_api._get_type() return self._add_item_header(request, result_dict, scope, utils.get_type_kind(type_name), utils.get_collection_name(type_name))
def __init__(self, api): """Base initialization. Inherited classes should init _api and call super(). """ self._api = api self._type_name = self._api._get_type() self._collection_name = utils.get_collection_name(self._type_name) self._type_kind = utils.get_type_kind(self._type_name) self._list_kind = utils.get_list_kind(self._type_name) self._aggregated_kind = utils.get_aggregated_kind(self._type_name) self._operation_api = operation_api.API()