def delete_delivery_channel(self, channel_name): if not self.delivery_channels.get(channel_name): raise NoSuchDeliveryChannelException(channel_name) # Check if a channel is recording -- if so, bad -- (there can only be 1 recorder): for recorder in self.recorders.values(): if recorder.status.recording: raise LastDeliveryChannelDeleteFailedException(channel_name) del self.delivery_channels[channel_name]
def describe_delivery_channels(self, channel_names): channels = [] if channel_names: for cn in channel_names: if not self.delivery_channels.get(cn): raise NoSuchDeliveryChannelException(cn) # Format the delivery channel: channels.append(self.delivery_channels[cn].to_dict()) else: for channel in self.delivery_channels.values(): channels.append(channel.to_dict()) return channels