def update_bq_settings()

in src/dfcx_scrapi/core/agents.py [0:0]


    def update_bq_settings(
        self,
        agent_id: str = None,
        bq_settings: Dict[str, str] = None,
        enable_stackdriver_logging: bool = None,
        enable_interaction_logging: bool = None,
        bigquery_enabled: bool = None,
        bigquery_table: str = None,
        **kwargs
        ) -> types.Agent:
        """Update BigQuery Interaction Logging settings for an agent.

        Args:
          agent_id: CX Agent ID string in the following format
            projects/<PROJECT ID>/locations/<LOCATION ID>/agents/<AGENT ID>
          bq_settings: (Optional) The BQ interaction logging settings for the
            agent. Use `get_bq_settings` to get the proper input format for
            this option.
          enable_stackdriver_logging: (Optional) Boolean indicating whether
            Stackdriver logging is enabled.
          enable_interaction_logging: (Optional) Boolean indicating whether
            interaction logging is enabled.
          biqquery_enabled: (Optional) Boolean indicating whether BigQuery
            export is enabled.
          bigquery_table: (Optional) The name of the BigQuery table to export
            interaction logs to. Provide only the table name, the full path
            will be built automatically.

        Returns:
          Agent object with updated settings.
        """
        BIGQUERY_INPUTS = [
            enable_stackdriver_logging,
            enable_interaction_logging,
            bigquery_enabled,
            bigquery_table
            ]

        if not agent_id:
            agent_id = self.agent_id

        if not bq_settings and not any(BIGQUERY_INPUTS):
            raise ValueError(
                "At least one setting must be provided if 'bq_settings' is"\
                " not used.")

        # If the user doesn't provide the full bq_settings payload, we'll get
        # the existing payload
        elif not bq_settings:
           bq_settings = self.get_bq_settings(agent_id)
           bq_settings = self.modify_bq_settings_kwargs(
               agent_id=agent_id,
               bq_settings=bq_settings,
               enable_stackdriver_logging=enable_stackdriver_logging,
               enable_interaction_logging=enable_interaction_logging,
               bigquery_enabled=bigquery_enabled,
               bigquery_table=bigquery_table
               )

        agent = self.update_agent(
            agent_id,
            advanced_settings = bq_settings["advanced_settings"],
            bigquery_export_settings = bq_settings["bigquery_export_settings"]
            )

        return agent