class Quotas(quotas_models.QuotaModelMixin.Quotas): regular_quota = fields.QuotaField() usage_aggregator_quota = fields.QuotaField( ) # this quota is aggregated by parent and grandparent limit_aggregator_quota = fields.QuotaField( default_limit=0 ) # this quota is aggregated by parent and grandparent
class Quotas(quotas_models.QuotaModelMixin.Quotas): regular_quota = fields.QuotaField() quota_with_default_limit = fields.QuotaField(default_limit=100) usage_aggregator_quota = fields.UsageAggregatorQuotaField( get_children=lambda scope: ChildModel.objects.filter(parent__parent =scope), ) limit_aggregator_quota = fields.LimitAggregatorQuotaField( get_children=lambda scope: ChildModel.objects.filter(parent__parent =scope), )
def add_quota_field(): structure_models.Project.add_quota_field( name=QUOTA_NAME, quota_field=quota_fields.QuotaField() ) structure_models.Customer.add_quota_field( name=QUOTA_NAME, quota_field=quota_fields.QuotaField() )
class Quotas(quotas_models.QuotaModelMixin.Quotas): enable_fields_caching = False nc_project_count = quotas_fields.CounterQuotaField( target_models=lambda: [Project], path_to_scope='customer', ) nc_user_count = quotas_fields.QuotaField() nc_resource_count = quotas_fields.CounterQuotaField( target_models=lambda: BaseResource.get_all_models(), path_to_scope='project.customer', )
class Quotas(quotas_models.QuotaModelMixin.Quotas): enable_fields_caching = False nc_project_count = quotas_fields.CounterQuotaField( target_models=lambda: [Project], path_to_scope='customer', ) nc_service_count = quotas_fields.CounterQuotaField( target_models=lambda: Service.get_all_models(), path_to_scope='customer', ) nc_service_project_link_count = quotas_fields.CounterQuotaField( target_models=lambda: ServiceProjectLink.get_all_models(), path_to_scope='project.customer', ) nc_user_count = quotas_fields.QuotaField() nc_resource_count = quotas_fields.CounterQuotaField( target_models=lambda: ResourceMixin.get_all_models(), path_to_scope='project.customer', ) nc_app_count = quotas_fields.CounterQuotaField( target_models=lambda: ApplicationMixin.get_all_models(), path_to_scope='project.customer', ) nc_vm_count = quotas_fields.CounterQuotaField( target_models=lambda: VirtualMachine.get_all_models(), path_to_scope='project.customer', ) nc_private_cloud_count = quotas_fields.CounterQuotaField( target_models=lambda: PrivateCloud.get_all_models(), path_to_scope='project.customer', ) nc_storage_count = quotas_fields.CounterQuotaField( target_models=lambda: Storage.get_all_models(), path_to_scope='project.customer', ) nc_volume_size = quotas_fields.TotalQuotaField( target_models=lambda: Volume.get_all_models(), path_to_scope='customer', target_field='size', ) nc_snapshot_size = quotas_fields.TotalQuotaField( target_models=lambda: Snapshot.get_all_models(), path_to_scope='customer', target_field='size', )
class Quotas(quotas_models.QuotaModelMixin.Quotas): vcpu = quotas_fields.QuotaField() ram = quotas_fields.QuotaField() storage = quotas_fields.QuotaField()
class Quotas(quotas_models.QuotaModelMixin.Quotas): offering_count = quotas_fields.QuotaField(is_backend=True)