def create()

in docker/services/recommendation_history_service.py [0:0]


    def create(self, instance_id: str, job_id: str, customer: str, tenant: str,
               region: str, current_instance_type: str, savings: dict,
               schedule: list,
               recommended_shapes: list,
               actions: list,
               instance_meta: dict) -> List[RecommendationHistory]:
        if ACTION_EMPTY in actions or ACTION_ERROR in actions:
            _LOG.debug(f'Skipping saving result to history collection. '
                       f'Actions: \'{actions}\'')
            return []
        result = []
        current_month_price_usd = self._get_current_month_price(
            savings=savings
        )
        if ACTION_SCHEDULE in actions:
            schedule_savings = self._filter_savings_usd(
                savings=savings,
                action=ACTION_SCHEDULE
            )
            recommendation_item = self._create_or_update_recent(
                instance_id=instance_id,
                job_id=job_id,
                customer=customer,
                tenant=tenant,
                region=region,
                current_instance_type=current_instance_type,
                current_month_price_usd=current_month_price_usd,
                recommendation_type=ACTION_SCHEDULE,
                recommendation=schedule,
                savings=schedule_savings,
                instance_meta=instance_meta
            )
            result.append(recommendation_item)

        resize_action = self._get_resize_action(actions=actions)
        if resize_action:
            resize_savings = self._filter_savings_usd(
                savings=savings,
                action=resize_action
            )
            recommendation_item = self._create_or_update_recent(
                instance_id=instance_id,
                job_id=job_id,
                customer=customer,
                tenant=tenant,
                region=region,
                current_instance_type=current_instance_type,
                current_month_price_usd=current_month_price_usd,
                recommendation_type=resize_action,
                recommendation=recommended_shapes,
                savings=resize_savings,
                instance_meta=instance_meta
            )
            result.append(recommendation_item)
        if ACTION_SHUTDOWN in actions:
            shutdown_savings = self._filter_savings_usd(
                savings=savings,
                action=ACTION_SHUTDOWN
            )
            recommendation_item = self._create_or_update_recent(
                instance_id=instance_id,
                job_id=job_id,
                customer=customer,
                tenant=tenant,
                region=region,
                current_instance_type=current_instance_type,
                current_month_price_usd=current_month_price_usd,
                recommendation_type=ACTION_SHUTDOWN,
                recommendation=None,
                savings=shutdown_savings,
                instance_meta=instance_meta
            )
            result.append(recommendation_item)
        return result