def process_workspace()

in source/ecs/workspaces_helper.py [0:0]


    def process_workspace(self, workspace):
        """
        This method processes the given workspace and returns an object with the result
        :param workspace:
        :return: Object with the results of optimization
        """
        workspace_id = workspace['WorkspaceId']
        log.debug('workspaceID: %s', workspace_id)
        workspace_running_mode = workspace['WorkspaceProperties']['RunningMode']
        log.debug('workspaceRunningMode: %s', workspace_running_mode)
        workspace_bundle_type = workspace['WorkspaceProperties']['ComputeTypeName']
        log.debug('workspaceBundleType: %s', workspace_bundle_type)
        billable_time = self.metrics_helper.get_billable_hours(self.settings['startTime'], self.settings['endTime'],
                                                               workspace)
        tags = self.get_tags(workspace_id)
        if self.check_for_skip_tag(tags):
            log.info('Skipping WorkSpace %s due to Skip_Convert tag', workspace_id)
            hourly_threshold = "n/a"
            workspace_terminated = ''
            optimization_result = {
                'resultCode': '-S-',
                'newMode': workspace_running_mode
            }
        else:
            hourly_threshold = self.get_hourly_threshold(workspace_bundle_type)
            workspace_terminated = self.get_termination_status(workspace_id, billable_time, tags)
            optimization_result = self.compare_usage_metrics(workspace_id, billable_time, hourly_threshold,
                                                             workspace_running_mode)

        return {
            'workspaceID': workspace_id,
            'billableTime': billable_time,
            'hourlyThreshold': hourly_threshold,
            'optimizationResult': optimization_result['resultCode'],
            'newMode': optimization_result['newMode'],
            'bundleType': workspace_bundle_type,
            'initialMode': workspace_running_mode,
            'userName': workspace.get('UserName', ''),
            'computerName': workspace.get('ComputerName', ''),
            'directoryId': workspace.get('DirectoryId', ''),
            'tags': tags,
            'workspaceTerminated': workspace_terminated
        }