Exemple #1
0
 def list_servers(self):
     """List all servers."""
     endpoint = 'application/servers'
     response = base.parse_response(self._api_request(endpoint=endpoint),
                                    detail=False)
     return PaginatedResponse(self, endpoint, response)
Exemple #2
0
 def test_parse_response_without_detail(self):
     expected = {'id': 12}
     response = {'object': 'server', 'attributes': {'id': 12}}
     self.assertEqual(expected, base.parse_response(response, detail=False))
Exemple #3
0
 def test_parse_response_list_object_without_detail(self):
     expected = [{'id': 5}, {'id': 6}]
     response = {'object': 'list',
                 'data': [{'object': 'server', 'attributes': {'id': 5}},
                          {'object': 'server', 'attributes': {'id': 6}}]}
     self.assertEqual(expected, base.parse_response(response, detail=False))
Exemple #4
0
 def api_key_list(self):
     """List client's API keys."""
     endpoint = 'client/account/api-keys'
     response = self._api_request(endpoint=endpoint)
     return base.parse_response(response, detail=False)