"Fossies" - the Fresh Open Source Software Archive

Member "keystone-18.0.0/keystone/application_credential/schema.py" (14 Oct 2020, 2114 Bytes) of package /linux/misc/openstack/keystone-18.0.0.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. See also the latest Fossies "Diffs" side-by-side code changes report for "schema.py": 17.0.0_vs_18.0.0.

    1 # Copyright 2018 SUSE Linux GmbH
    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 
   15 from keystone.common import validation
   16 from keystone.common.validation import parameter_types
   17 
   18 _role_properties = {
   19     'type': 'array',
   20     'items': {
   21         'type': 'object',
   22         'properties': {
   23             'id': parameter_types.id_string,
   24             'name': parameter_types.name
   25         },
   26         'minProperties': 1,
   27         'maxProperties': 1,
   28         'additionalProperties': False
   29     }
   30 }
   31 
   32 _access_rules_properties = {
   33     'type': 'array',
   34     'items': {
   35         'type': 'object',
   36         'properties': {
   37             'path': {
   38                 'type': 'string',
   39                 'minLength': 0,
   40                 'maxLength': 225,
   41                 'pattern': r'^\/.*'
   42             },
   43             'method': {
   44                 'type': 'string',
   45                 'pattern': r'^(POST|GET|HEAD|PATCH|PUT|DELETE)$'
   46             },
   47             'service': parameter_types.id_string,
   48             'id': parameter_types.id_string,
   49         },
   50         'additionalProperties': False
   51     }
   52 }
   53 
   54 _application_credential_properties = {
   55     'name': parameter_types.name,
   56     'description': validation.nullable(parameter_types.description),
   57     'secret': {
   58         'type': ['null', 'string']
   59     },
   60     'expires_at': {
   61         'type': ['null', 'string']
   62     },
   63     'roles': _role_properties,
   64     'unrestricted': parameter_types.boolean,
   65     'access_rules': _access_rules_properties
   66 }
   67 
   68 application_credential_create = {
   69     'type': 'object',
   70     'properties': _application_credential_properties,
   71     'required': ['name'],
   72     'additionalProperties': True
   73 }