Пример #1
0
    def get_stream(self, stream):
        """
        Gets a single stream.

        :param str stream: The name of the stream.
        :rtype: .Stream
        """
        path = '/archive/{}/streams/{}'.format(self._instance, stream)
        response = self._client.get_proto(path=path)
        message = table_pb2.StreamInfo()
        message.ParseFromString(response.content)
        return Stream(message)
Пример #2
0
    def list_streams(self):
        """
        Returns the existing streams.

        Streams are returned in lexicographical order.

        :rtype: ~collections.Iterable[.Stream]
        """
        # Server does not do pagination on listings of this resource.
        # Return an iterator anyway for similarity with other API methods
        path = '/archive/{}/streams'.format(self._instance)
        response = self._client.get_proto(path=path)
        message = table_pb2.ListStreamsResponse()
        message.ParseFromString(response.content)
        streams = getattr(message, 'streams')
        return iter([Stream(stream) for stream in streams])