Interface to get instance statistics added
Change-Id: I6050a40fe0dd0ad66c134a612e39a1e59847d57b
This commit is contained in:
parent
b06d943e32
commit
383ced4ddc
|
@ -13,9 +13,14 @@
|
|||
# under the License.
|
||||
|
||||
from muranoclient.common import http
|
||||
from muranoclient.v1 import environments, sessions, services, deployments
|
||||
from muranoclient.v1 import statistics
|
||||
|
||||
from muranoclient.v1 import deployments
|
||||
from muranoclient.v1 import environments
|
||||
from muranoclient.v1 import instance_statistics
|
||||
from muranoclient.v1 import packages
|
||||
from muranoclient.v1 import request_statistics
|
||||
from muranoclient.v1 import services
|
||||
from muranoclient.v1 import sessions
|
||||
|
||||
|
||||
class Client(http.HTTPClient):
|
||||
|
@ -34,5 +39,8 @@ class Client(http.HTTPClient):
|
|||
self.sessions = sessions.SessionManager(self)
|
||||
self.services = services.ServiceManager(self)
|
||||
self.deployments = deployments.DeploymentManager(self)
|
||||
self.request_statistics = \
|
||||
request_statistics.RequestStatisticsManager(self)
|
||||
self.instance_statistics = \
|
||||
instance_statistics.InstanceStatisticsManager(self)
|
||||
self.packages = packages.PackageManager(self)
|
||||
self.statistics = statistics.StatisticsManager(self)
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# 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 InstanceStatistics(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Instance statistics %s>" % self._info
|
||||
|
||||
def data(self, **kwargs):
|
||||
return self.manager.data(self, **kwargs)
|
||||
|
||||
|
||||
class InstanceStatisticsManager(base.Manager):
|
||||
resource_class = InstanceStatistics
|
||||
|
||||
def get(self, environment_id, instance_id=None):
|
||||
if instance_id:
|
||||
path = '/v1/environments/{id}/statistics/{instance_id}'.format(
|
||||
id=environment_id, instance_id=instance_id)
|
||||
else:
|
||||
path = '/v1/environments/{id}/statistics'.format(id=environment_id)
|
||||
return self._list(path, None)
|
|
@ -15,16 +15,16 @@
|
|||
from muranoclient.common import base
|
||||
|
||||
|
||||
class Statistic(base.Resource):
|
||||
class RequestStatistics(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Statistics %s>" % self._info
|
||||
return "<Request statistics %s>" % self._info
|
||||
|
||||
def data(self, **kwargs):
|
||||
return self.manager.data(self, **kwargs)
|
||||
|
||||
|
||||
class StatisticsManager(base.Manager):
|
||||
resource_class = Statistic
|
||||
class RequestStatisticsManager(base.Manager):
|
||||
resource_class = RequestStatistics
|
||||
|
||||
def list(self):
|
||||
return self._list('/v1/stats', 'stats')
|
Loading…
Reference in New Issue