
from oslo_policy import policy

from nova.policies import base


POLICY_ROOT = 'os_compute_api:os-quota-class-sets:%s'


quota_class_sets_policies = [
    policy.RuleDefault(
        name=POLICY_ROOT % 'show',
        check_str='is_admin:True or quota_class:%(quota_class)s'),
    policy.RuleDefault(
        name=POLICY_ROOT % 'update',
        check_str=base.RULE_ADMIN_API),
]


def list_rules():
    return quota_class_sets_policies


from nova.policies import base


POLICY_ROOT = 'os_compute_api:os-quota-class-sets:%s'


quota_class_sets_policies = [
    base.create_rule_default(
        POLICY_ROOT % 'show',
        'is_admin:True or quota_class:%(quota_class)s',
        "List quotas for specific quota classs",
        [
            {
                'method': 'GET',
                'path': '/os-quota-class-sets/{quota_class}'
            }
        ]),
    base.create_rule_default(
        POLICY_ROOT % 'update',
        base.RULE_ADMIN_API,
        'Update quotas for specific quota class',
        [
            {
                'method': 'PUT',
                'path': '/os-quota-class-sets/{quota_class}'
            }
        ]),
]


def list_rules():
    return quota_class_sets_policies

Add policy description for os-quota-classes
Add policy description for os-quota-classes

This commit adds policy doc for os-quota-classes policies.

Partial implement blueprint policy-docs

Change-Id: Ic7568b77ebfaa012e4310c3c1beac68587bd19f6

- 
- from oslo_policy import policy
  
  from nova.policies import base
  
  
  POLICY_ROOT = 'os_compute_api:os-quota-class-sets:%s'
  
  
  quota_class_sets_policies = [
-     policy.RuleDefault(
+     base.create_rule_default(
-         name=POLICY_ROOT % 'show',
+         POLICY_ROOT % 'show',
-         check_str='is_admin:True or quota_class:%(quota_class)s'),
+         'is_admin:True or quota_class:%(quota_class)s',
-     policy.RuleDefault(
+         "List quotas for specific quota classs",
+         [
+             {
+                 'method': 'GET',
+                 'path': '/os-quota-class-sets/{quota_class}'
+             }
+         ]),
+     base.create_rule_default(
-         name=POLICY_ROOT % 'update',
+         POLICY_ROOT % 'update',
-         check_str=base.RULE_ADMIN_API),
+         base.RULE_ADMIN_API,
+         'Update quotas for specific quota class',
+         [
+             {
+                 'method': 'PUT',
+                 'path': '/os-quota-class-sets/{quota_class}'
+             }
+         ]),
  ]
  
  
  def list_rules():
      return quota_class_sets_policies
  
Add policy description for os-quota-classes
## Code Before:

from oslo_policy import policy

from nova.policies import base


POLICY_ROOT = 'os_compute_api:os-quota-class-sets:%s'


quota_class_sets_policies = [
    policy.RuleDefault(
        name=POLICY_ROOT % 'show',
        check_str='is_admin:True or quota_class:%(quota_class)s'),
    policy.RuleDefault(
        name=POLICY_ROOT % 'update',
        check_str=base.RULE_ADMIN_API),
]


def list_rules():
    return quota_class_sets_policies

## Instruction:
Add policy description for os-quota-classes
## Code After:

from nova.policies import base


POLICY_ROOT = 'os_compute_api:os-quota-class-sets:%s'


quota_class_sets_policies = [
    base.create_rule_default(
        POLICY_ROOT % 'show',
        'is_admin:True or quota_class:%(quota_class)s',
        "List quotas for specific quota classs",
        [
            {
                'method': 'GET',
                'path': '/os-quota-class-sets/{quota_class}'
            }
        ]),
    base.create_rule_default(
        POLICY_ROOT % 'update',
        base.RULE_ADMIN_API,
        'Update quotas for specific quota class',
        [
            {
                'method': 'PUT',
                'path': '/os-quota-class-sets/{quota_class}'
            }
        ]),
]


def list_rules():
    return quota_class_sets_policies
