"Fossies" - the Fresh Open Source Software Archive

Member "nova-18.2.3/nova/api/openstack/compute/schemas/flavors.py" (10 Oct 2019, 2092 Bytes) of package /linux/misc/openstack/nova-18.2.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "flavors.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 18.2.2_vs_18.2.3.

    1 # Copyright 2017 NEC Corporation.  All rights reserved.
    2 #
    3 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    4 #    not use this file except in compliance with the License. You may obtain
    5 #    a copy of the License at
    6 #
    7 #         http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 #    Unless required by applicable law or agreed to in writing, software
   10 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   11 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   12 #    License for the specific language governing permissions and limitations
   13 #    under the License.
   14 from nova.api.validation import parameter_types
   15 
   16 # NOTE(takashin): The following sort keys are defined for backward
   17 # compatibility. If they are changed, the API microversion should be bumped.
   18 VALID_SORT_KEYS = [
   19     'created_at', 'description', 'disabled', 'ephemeral_gb', 'flavorid', 'id',
   20     'is_public', 'memory_mb', 'name', 'root_gb', 'rxtx_factor', 'swap',
   21     'updated_at', 'vcpu_weight', 'vcpus'
   22 ]
   23 
   24 VALID_SORT_DIR = ['asc', 'desc']
   25 
   26 index_query = {
   27     'type': 'object',
   28     'properties': {
   29         'limit': parameter_types.multi_params(
   30              parameter_types.non_negative_integer),
   31         'marker': parameter_types.multi_params({'type': 'string'}),
   32         'is_public': parameter_types.multi_params({'type': 'string'}),
   33         'minRam': parameter_types.multi_params({'type': 'string'}),
   34         'minDisk': parameter_types.multi_params({'type': 'string'}),
   35         'sort_key': parameter_types.multi_params({'type': 'string',
   36                                                   'enum': VALID_SORT_KEYS}),
   37         'sort_dir': parameter_types.multi_params({'type': 'string',
   38                                                   'enum': VALID_SORT_DIR})
   39     },
   40     # NOTE(gmann): This is kept True to keep backward compatibility.
   41     # As of now Schema validation stripped out the additional parameters and
   42     # does not raise 400. In the future, we may block the additional parameters
   43     # by bump in Microversion.
   44     'additionalProperties': True
   45 }