
from oslo_policy import policy

from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:image-size'


image_size_policies = [
    policy.RuleDefault(
        name=BASE_POLICY_NAME,
        check_str=base.RULE_ADMIN_OR_OWNER),
]


def list_rules():
    return image_size_policies


from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:image-size'


image_size_policies = [
    base.create_rule_default(
        BASE_POLICY_NAME,
        base.RULE_ADMIN_OR_OWNER,
        """Add 'OS-EXT-IMG-SIZE:size' attribute in the image response.""",
        [
            {
                'method': 'GET',
                'path': '/images/{id}'
            },
            {
                'method': 'GET',
                'path': '/images/detail'
            }
        ]),
]


def list_rules():
    return image_size_policies

Add policy description for image size
Add policy description for image size

This commit adds policy doc for image size policies.

Partial implement blueprint policy-docs

Change-Id: I0de4aaa47e21c4e156569eebcb495412ab364417

- 
- from oslo_policy import policy
  
  from nova.policies import base
  
  
  BASE_POLICY_NAME = 'os_compute_api:image-size'
  
  
  image_size_policies = [
-     policy.RuleDefault(
+     base.create_rule_default(
-         name=BASE_POLICY_NAME,
+         BASE_POLICY_NAME,
-         check_str=base.RULE_ADMIN_OR_OWNER),
+         base.RULE_ADMIN_OR_OWNER,
+         """Add 'OS-EXT-IMG-SIZE:size' attribute in the image response.""",
+         [
+             {
+                 'method': 'GET',
+                 'path': '/images/{id}'
+             },
+             {
+                 'method': 'GET',
+                 'path': '/images/detail'
+             }
+         ]),
  ]
  
  
  def list_rules():
      return image_size_policies
  
Add policy description for image size
## Code Before:

from oslo_policy import policy

from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:image-size'


image_size_policies = [
    policy.RuleDefault(
        name=BASE_POLICY_NAME,
        check_str=base.RULE_ADMIN_OR_OWNER),
]


def list_rules():
    return image_size_policies

## Instruction:
Add policy description for image size
## Code After:

from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:image-size'


image_size_policies = [
    base.create_rule_default(
        BASE_POLICY_NAME,
        base.RULE_ADMIN_OR_OWNER,
        """Add 'OS-EXT-IMG-SIZE:size' attribute in the image response.""",
        [
            {
                'method': 'GET',
                'path': '/images/{id}'
            },
            {
                'method': 'GET',
                'path': '/images/detail'
            }
        ]),
]


def list_rules():
    return image_size_policies
