2015-06-04 09:49:53 -04:00
|
|
|
"""
|
|
|
|
Copyright 2015 Cisco Systems
|
|
|
|
|
|
|
|
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.
|
|
|
|
"""
|
|
|
|
|
2016-08-18 11:50:58 +07:00
|
|
|
from functionaltests.api.v1.models import base_models
|
2015-06-04 09:49:53 -04:00
|
|
|
|
|
|
|
|
2016-08-18 11:50:58 +07:00
|
|
|
class QuotasModel(base_models.BaseModel):
|
2015-07-18 09:10:50 -05:00
|
|
|
|
|
|
|
def __init__(self, secrets=None, orders=None, containers=None,
|
2015-09-08 20:55:29 -04:00
|
|
|
consumers=None, cas=None):
|
2015-07-18 09:10:50 -05:00
|
|
|
super(QuotasModel, self).__init__()
|
|
|
|
self.secrets = secrets
|
|
|
|
self.orders = orders
|
|
|
|
self.containers = containers
|
|
|
|
self.consumers = consumers
|
2015-09-08 20:55:29 -04:00
|
|
|
self.cas = cas
|
2015-07-18 09:10:50 -05:00
|
|
|
|
|
|
|
|
2016-08-18 11:50:58 +07:00
|
|
|
class QuotasResponseModel(base_models.BaseModel):
|
2015-06-04 09:49:53 -04:00
|
|
|
|
|
|
|
def __init__(self, quotas=None):
|
2015-07-18 09:10:50 -05:00
|
|
|
super(QuotasResponseModel, self).__init__()
|
2015-06-04 09:49:53 -04:00
|
|
|
self.quotas = quotas
|
|
|
|
|
2015-07-18 09:10:50 -05:00
|
|
|
@classmethod
|
|
|
|
def dict_to_obj(cls, input_dict):
|
|
|
|
quotas = QuotasModel(**input_dict.get('quotas'))
|
|
|
|
return cls(quotas=quotas)
|
2015-06-04 09:49:53 -04:00
|
|
|
|
|
|
|
|
2016-08-18 11:50:58 +07:00
|
|
|
class ProjectQuotaRequestModel(base_models.BaseModel):
|
2015-07-18 09:10:50 -05:00
|
|
|
|
|
|
|
def __init__(self, project_quotas=None):
|
|
|
|
super(ProjectQuotaRequestModel, self).__init__()
|
2015-06-04 09:49:53 -04:00
|
|
|
self.project_quotas = project_quotas
|
2015-07-18 09:10:50 -05:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def dict_to_obj(cls, input_dict):
|
|
|
|
project_quotas = QuotasModel(**input_dict.get('project_quotas'))
|
|
|
|
return cls(project_quotas=project_quotas)
|
|
|
|
|
|
|
|
|
2016-08-18 11:50:58 +07:00
|
|
|
class ProjectQuotaOneModel(base_models.BaseModel):
|
2015-07-18 09:10:50 -05:00
|
|
|
|
|
|
|
def __init__(self, project_quotas=None):
|
|
|
|
super(ProjectQuotaOneModel, self).__init__()
|
|
|
|
self.project_quotas = QuotasModel(**project_quotas)
|
|
|
|
|
|
|
|
|
2016-08-18 11:50:58 +07:00
|
|
|
class ProjectQuotaListItemModel(base_models.BaseModel):
|
2015-07-18 09:10:50 -05:00
|
|
|
|
|
|
|
def __init__(self, project_id=None, project_quotas=None):
|
|
|
|
super(ProjectQuotaListItemModel, self).__init__()
|
2015-06-04 09:49:53 -04:00
|
|
|
self.project_id = project_id
|
2015-07-18 09:10:50 -05:00
|
|
|
self.project_quotas = QuotasModel(**project_quotas)
|
2015-06-04 09:49:53 -04:00
|
|
|
|
|
|
|
|
2016-08-18 11:50:58 +07:00
|
|
|
class ProjectQuotaListModel(base_models.BaseModel):
|
2015-06-04 09:49:53 -04:00
|
|
|
|
|
|
|
def __init__(self, project_quotas=None):
|
2015-07-18 09:10:50 -05:00
|
|
|
super(ProjectQuotaListModel, self).__init__()
|
2015-06-04 09:49:53 -04:00
|
|
|
self.project_quotas = project_quotas
|
2015-07-18 09:10:50 -05:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def dict_to_obj(cls, input_dict):
|
|
|
|
project_quotas = [ProjectQuotaListItemModel(**project_quotas_item)
|
|
|
|
for project_quotas_item in
|
|
|
|
input_dict.get('project_quotas', [])]
|
|
|
|
return cls(project_quotas=project_quotas)
|