Goutham Pratapa f57144cfcb Implement quota show command for KB
kingbird quota show lists the global limits for a tenant.
Add test-case for the same

Change-Id: I7c3f809afcf65077701e320fc97135a3c21c7786
2017-01-02 10:00:13 +00:00

37 lines
1.2 KiB
Python

# Copyright (c) 2016 Ericsson AB.
# All Rights Reserved.
#
# 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 kingbirdclient.api import base
class Quota(base.Resource):
resource_name = 'os-quota-sets'
class quota_manager(base.ResourceManager):
resource_class = Quota
def list_defaults(self):
tenant = self.http_client.project_id
url = '/%s/os-quota-sets/defaults' % tenant
return self._list(url)
def global_limits(self, target_tenant_id=None):
tenant = self.http_client.project_id
if not target_tenant_id:
target_tenant_id = tenant
url = '/%s/os-quota-sets/%s' % (tenant, target_tenant_id)
return self._list(url)