def take_action(self, parsed_args):
        client = get_client(parsed_args)
        value = client.account.get_limits()

        rate_tuples = [(k, v) for k, v in value['resource'].iteritems()]

        return (('Resource', 'Limit'), rate_tuples)
예제 #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

        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)
    def take_action(self, parsed_args):
        client = get_client(parsed_args)
        value = client.account.get_limits()

        rate_tuples = [
            (k, value["rate"][k]["window"], value["rate"][k]["used"], value["rate"][k]["limit"])
            for k in value["rate"].keys()
        ]

        return (("Rate", "Window", "Used", "Limit"), rate_tuples)
예제 #4
0
 def take_action(self, parsed_args):
     client = get_client(parsed_args)
     value = client.services.get(parsed_args.object_id)
     metadata_str = format_metadata(value['metadata'])
     service_tuple = (value['id'],
                      value['heartbeat_timeout'],
                      value['last_seen'],
                      ', '.join(value['tags']),
                      metadata_str)
     return (('Service ID', 'Heartbeat Timeout', 'Last Seen', 'Tags',
              'Metadata'), service_tuple)
예제 #5
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)
예제 #6
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.namespace:
            kwargs['namespace'] = parsed_args.namespace
            result = client.configuration.list_for_namespace(**kwargs)
        else:
            result = client.configuration.list(**kwargs)

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

        parsed_args.returned_metadata = metadata

        result = [(value['id'], value['value'])
                  for value in values]
        return (('ID', 'Value'), result)
예제 #7
0
 def take_action(self, parsed_args):
     client = get_client(parsed_args)
     configuration_id = parsed_args.id
     client.configuration.remove(configuration_id=configuration_id)
     self.app.stdout.write('Configuration value "%s" has been removed\n' %
                           (configuration_id))
예제 #8
0
 def take_action(self, parsed_args):
     client = get_client(parsed_args)
     value = client.configuration.get(parsed_args.object_id)
     result = (value['id'], value['value'])
     return (('ID', 'Value'), result)
예제 #9
0
 def take_action(self, parsed_args):
     client = get_client(parsed_args)
     id, value = parsed_args.id, parsed_args.value
     client.configuration.set(id, value)
     self.app.stdout.write('Value for key "%s" set to "%s"\n' % (id, value))