import json
import requests
from api_auth import APICredentials, APIParams

class ActivateLiveSlicer:
    def __init__(self):
        self.host = "https://services.uplynk.com"

    def run(self):
        self._activate_live_slicer()

    def _activate_live_slicer(self):
        failover_group_id = 'e8d6b5cb940c40cc9ec6ad081a38f3f0' # Replace with the ID for the desired failover group.
        url = "{}{}{}{}".format(self.host, "/api/v4/failover-groups/", failover_group_id, "/activate_slicer")

        payload = {
            'slicer_id': 'myslicer01'
        }

        headers = {'Content-Type': 'application/json'}
  
        response = requests.put(
            url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers
        )
  
        print(response.status_code)
  
ActivateLiveSlicer().run()