Ejemplo n.º 1
0
    def take_action(self, parsed_args):
        client = get_client(parsed_args)

        marker = parsed_args.marker if parsed_args.marker else None
        limit = parsed_args.limit if parsed_args.limit else None

        kwargs = {'marker': marker, 'limit': limit}

        if parsed_args.tag:
            result = client.services.list_for_tag(parsed_args.tag, **kwargs)
        else:
            result = client.services.list(**kwargs)

        values = result['values']
        metadata = result['metadata']

        parsed_args.returned_metadata = metadata

        service_tuples = [(value['id'],
                          value['heartbeat_timeout'],
                          format_timestamp(value['last_seen']),
                          ', '.join(value['tags']),
                          format_metadata(value['metadata']))
                          for value in values]
        return (('Service ID', 'Heartbeat Timeout', 'Last Seen', 'Tags',
                 'Metadata'), service_tuples)
Ejemplo n.º 2
0
    def take_action(self, parsed_args):
        client = get_client(parsed_args)
        marker = parsed_args.marker if parsed_args.marker else None
        limit = parsed_args.limit if parsed_args.limit else None

        result = client.events.list(marker=marker, limit=limit)
        values = reversed(result['values'])
        metadata = result['metadata']

        parsed_args.returned_metadata = metadata

        event_tuples = [(value['id'],
                        format_timestamp(value['timestamp']),
                        value['type'],
                        format_event_payload(value))
                        for value in values]

        return (('Event ID', 'Timestamp', 'Event Type', 'Payload'),
                event_tuples)