Updates failover eligibility for one or more Live Slicer(s).
Request
Request syntax:
PUT /failover-groups/Failover Group ID/slicers
Request URL variable:
Define the following variable when submitting the above request:
VariableA variable represents a value that must be replaced. A variable consists of either a URL segment (e.g., "0001" in /0001/) or a query string value (e.g., "3" in mediaTypes=3). | Description |
---|---|
Failover Group ID Required | Replace this variable with the system-defined ID assigned to the desired failover group. Use the Get All Failover Groups endpoint to retrieve a list of failover groups and their system-defined ID. |
Request body parameter:
Pass the following request body parameter:
Name | Data Type | Description |
---|---|---|
slicers Required | List of Dictionaries | Contains the set of Live Slicers whose failover eligibility status will be updated. |
slicers List
The slicers list updates one or more Live Slicer's failover eligibility via the following properties:
Name | Data Type | Description |
---|---|---|
enabled | Boolean | Determines whether our system can failover to this Live Slicer. Valid values are: True: Eligible False: Ineligible |
order | Integer | Determines the order, starting from 1, in which our system will choose Live Slicers upon failover. Set this property to 1 If the failover group uses flat mode (i.e., random Live Slicer selection). |
slicer_id | String | Identifies a Live Slicer by its ID. A Live Slicer's ID is determined by the slicerID setting in its configuration file This property only accepts Live Slicers that already belong to this failover group. All other Live Slicers are ignored. |
Response
The response for a successful request is a 204 No Content.
Sample Request/Response
Call the update_live_slicer_failover_eligibility module (Python 3) to update Live Slicer failover eligibility. This module imports names from the api_auth module.
import json
import requests
from api_auth import APICredentials, APIParams
class FailoverGroup:
def __init__(self):
self.host = "https://services.uplynk.com"
def run(self):
self._update_live_slicer_failover_availability()
def _update_live_slicer_failover_availability(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, "/slicers")
payload = {
'slicers': [{
'slicer_id': 'myslicer01',
'order': 1,
'enabled': True
}, {
'slicer_id': 'myslicer02',
'order': 2,
'enabled': False
}]
}
headers = {'Content-Type': 'application/json'}
response = requests.put(
url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers
)
print(response.status_code)
FailoverGroup().run()