Add Stats List method

This patch adds a new StatsManager. This manager
allow to get a list of stats for all servers via list method.

Change-Id: Ic7bf3aaee11534542df6ca95f675da6585dc2638
Partly-Implements: blueprint api-request-stats
This commit is contained in:
Georgy Okrokvertskhov 2014-03-14 22:25:52 -07:00
parent a35e2c6ac1
commit 4bbeb5488e
2 changed files with 32 additions and 0 deletions

View File

@ -14,6 +14,7 @@
from muranoclient.common import http
from muranoclient.v1 import environments, sessions, services, deployments
from muranoclient.v1 import statistics
class Client(http.HTTPClient):
@ -32,3 +33,4 @@ class Client(http.HTTPClient):
self.sessions = sessions.SessionManager(self)
self.services = services.ServiceManager(self)
self.deployments = deployments.DeploymentManager(self)
self.statistics = statistics.StatisticsManager(self)

View File

@ -0,0 +1,30 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from muranoclient.common import base
class Statistic(base.Resource):
def __repr__(self):
return "<Statistics %s>" % self._info
def data(self, **kwargs):
return self.manager.data(self, **kwargs)
class StatisticsManager(base.Manager):
resource_class = Statistic
def list(self):
return self._list('/stats', 'stats')