def control_hub_get(self, endpoint):
        """
        Handles a Control Hub GET operation

        :param endpoint: the Control Hub endpoint to be appended to the base URL
        :return: JSON formatted Control Hub API response
        :raises: ControlHubApiException
        """
        response = session.get(sch_url + endpoint)
        if response.status_code != 200:
            print_helper.print_message(props.API_GET_ERROR.format(endpoint), 1)
            raise ControlHubApiException(response)
        return response.json()
    def control_hub_post(self, endpoint, payload):
        """
        Handles a Control Hub POST operation

        :param endpoint: the Control Hub endpoint to be appended to the base URL
        :return: Control Hub API response (callers may choose to ignore the response)
        :raises: ControlHubApiException
        """
        response = session.post(url=sch_url + endpoint, json=payload)
        if response.status_code != 200:
            print_helper.print_message(
                props.API_POST_ERROR.format(endpoint, payload))
            raise ControlHubApiException(response)
        return response
Exemple #3
0
    def sync_jobs(self):
        """ Calls the Control Hub API to Synchronize the set of Jobs to be migrated """
        print_helper.print_banner(props.SYNCING_JOBS_MESSAGE)

        # Get the list of Job IDs for the Jobs to be migrated
        job_ids = []
        for job in jobs:
            job_ids.append(job['id'])
            print_helper.print_message(
                props.SYNCING_JOB_MESSAGE.format(job['name']))

        # Call the Control Hub API to Sync the jobs
        control_hub_api.sync_jobs(job_ids)

        # Refresh the cached Job info
        self.get_jobs()

        print_helper.print_banner(props.SYNCING_JOBS_COMPLETE_MESSAGE, 0, 0)
 def print_sdcs(self):
     print_helper.print_message(props.SDC_LIST_MESSAGE, 1)
     print_helper.print_sdcs_with_label(active_label, active_sdcs)
     print_helper.print_sdcs_with_label(standby_label, standby_sdcs)
Exemple #5
0
 def print_jobs_after(self):
     print_helper.print_message(
         props.JOBS_AFTER_MIGRATION_MESSAGE.format(active_label), 2, 0)
     print_helper.print_pipelines_for_jobs(active_label, jobs,
                                           sdc_helper.sdcs)
Exemple #6
0
 def print_jobs_before(self):
     print_helper.print_message(
         props.JOBS_TO_BE_MIGRATED_MESSAGE.format(active_label), 2, 0)
     print_helper.print_pipelines_for_jobs(active_label, jobs,
                                           sdc_helper.sdcs)