"Fossies" - the Fresh Open Source Software Archive

Member "magnum-8.1.0/magnum/common/policies/cluster_template.py" (1 Oct 2019, 4782 Bytes) of package /linux/misc/openstack/magnum-8.1.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. For more information about "cluster_template.py" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 8.1.0_vs_9.0.0.

    1 # 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 oslo_policy import policy
   15 
   16 from magnum.common.policies import base
   17 
   18 CLUSTER_TEMPLATE = 'clustertemplate:%s'
   19 
   20 rules = [
   21     policy.DocumentedRuleDefault(
   22         name=CLUSTER_TEMPLATE % 'create',
   23         check_str=base.RULE_DENY_CLUSTER_USER,
   24         description='Create a new cluster template.',
   25         operations=[
   26             {
   27                 'path': '/v1/clustertemplates',
   28                 'method': 'POST'
   29             }
   30         ]
   31     ),
   32     policy.DocumentedRuleDefault(
   33         name=CLUSTER_TEMPLATE % 'delete',
   34         check_str=base.RULE_DENY_CLUSTER_USER,
   35         description='Delete a cluster template.',
   36         operations=[
   37             {
   38                 'path': '/v1/clustertemplate/{clustertemplate_ident}',
   39                 'method': 'DELETE'
   40             }
   41         ]
   42     ),
   43     policy.DocumentedRuleDefault(
   44         name=CLUSTER_TEMPLATE % 'delete_all_projects',
   45         check_str=base.RULE_ADMIN_API,
   46         description='Delete a cluster template from any project.',
   47         operations=[
   48             {
   49                 'path': '/v1/clustertemplate/{clustertemplate_ident}',
   50                 'method': 'DELETE'
   51             }
   52         ]
   53     ),
   54     policy.DocumentedRuleDefault(
   55         name=CLUSTER_TEMPLATE % 'detail_all_projects',
   56         check_str=base.RULE_ADMIN_API,
   57         description=('Retrieve a list of cluster templates with detail across '
   58                      'projects.'),
   59         operations=[
   60             {
   61                 'path': '/v1/clustertemplates',
   62                 'method': 'GET'
   63             }
   64         ]
   65     ),
   66     policy.DocumentedRuleDefault(
   67         name=CLUSTER_TEMPLATE % 'detail',
   68         check_str=base.RULE_DENY_CLUSTER_USER,
   69         description='Retrieve a list of cluster templates with detail.',
   70         operations=[
   71             {
   72                 'path': '/v1/clustertemplates',
   73                 'method': 'GET'
   74             }
   75         ]
   76     ),
   77     policy.DocumentedRuleDefault(
   78         name=CLUSTER_TEMPLATE % 'get',
   79         check_str=base.RULE_DENY_CLUSTER_USER,
   80         description='Retrieve information about the given cluster template.',
   81         operations=[
   82             {
   83                 'path': '/v1/clustertemplate/{clustertemplate_ident}',
   84                 'method': 'GET'
   85             }
   86         ]
   87     ),
   88     policy.DocumentedRuleDefault(
   89         name=CLUSTER_TEMPLATE % 'get_one_all_projects',
   90         check_str=base.RULE_ADMIN_API,
   91         description=('Retrieve information about the given cluster template '
   92                      'across project.'),
   93         operations=[
   94             {
   95                 'path': '/v1/clustertemplate/{clustertemplate_ident}',
   96                 'method': 'GET'
   97             }
   98         ]
   99     ),
  100     policy.DocumentedRuleDefault(
  101         name=CLUSTER_TEMPLATE % 'get_all',
  102         check_str=base.RULE_DENY_CLUSTER_USER,
  103         description='Retrieve a list of cluster templates.',
  104         operations=[
  105             {
  106                 'path': '/v1/clustertemplates',
  107                 'method': 'GET'
  108             }
  109         ]
  110     ),
  111     policy.DocumentedRuleDefault(
  112         name=CLUSTER_TEMPLATE % 'get_all_all_projects',
  113         check_str=base.RULE_ADMIN_API,
  114         description='Retrieve a list of cluster templates across projects.',
  115         operations=[
  116             {
  117                 'path': '/v1/clustertemplates',
  118                 'method': 'GET'
  119             }
  120         ]
  121     ),
  122     policy.DocumentedRuleDefault(
  123         name=CLUSTER_TEMPLATE % 'update',
  124         check_str=base.RULE_DENY_CLUSTER_USER,
  125         description='Update an existing cluster template.',
  126         operations=[
  127             {
  128                 'path': '/v1/clustertemplate/{clustertemplate_ident}',
  129                 'method': 'PATCH'
  130             }
  131         ]
  132     ),
  133     policy.DocumentedRuleDefault(
  134         name=CLUSTER_TEMPLATE % 'publish',
  135         check_str=base.RULE_ADMIN_API,
  136         description='Publish an existing cluster template.',
  137         operations=[
  138             {
  139                 'path': '/v1/clustertemplates',
  140                 'method': 'POST'
  141             },
  142             {
  143                 'path': '/v1/clustertemplates',
  144                 'method': 'PATCH'
  145             }
  146         ]
  147     )
  148 ]
  149 
  150 
  151 def list_rules():
  152     return rules