in serverless/ivs_moderation/lambdas/lfuncprocessimage/lib/rekognition_service.py [0:0]
def suspend_channel(self, arn):
""" Function to suspend the channel """
try:
ivs_client = boto3.client('ivs')
# Get the stream key
stream_key = ivs_client.list_stream_keys(
channelArn=arn)['streamKeys'][0]['arn']
# Stopping the channel
ivs_client.stop_stream(channelArn = arn)
# Delete the streamkey
ivs_client.delete_stream_key(arn=stream_key)
status = {
'status': 'suspended',
'time': datetime.utcnow().isoformat()
}
except ClientError as error:
self.log.error("Internal error: %s", error)
status = "Channel suspension failed"
return status