
from oslo_policy import policy

from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:os-instance-usage-audit-log'


instance_usage_audit_log_policies = [
    policy.RuleDefault(
        name=BASE_POLICY_NAME,
        check_str=base.RULE_ADMIN_API),
]


def list_rules():
    return instance_usage_audit_log_policies


from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:os-instance-usage-audit-log'


instance_usage_audit_log_policies = [
    base.create_rule_default(
        BASE_POLICY_NAME,
        base.RULE_ADMIN_API,
        """Lists all usage audits and that occurred before a specified time
for all servers on all compute hosts where usage auditing is configured.""",
        [
            {
                'method': 'GET',
                'path': '/os-instance_usage_audit_log'
            },
            {
                'method': 'GET',
                'path': '/os-instance_usage_audit_log/{before_timestamp}'
            }
        ]),
]


def list_rules():
    return instance_usage_audit_log_policies

Add policy description for instance-usage-audit-log
Add policy description for instance-usage-audit-log

This commit adds policy doc for instance-usage-audit-log policies.

Partial implement blueprint policy-docs

Change-Id: I8baedb9cb69ccb04361cc0003311487599bc9440

- 
- from oslo_policy import policy
  
  from nova.policies import base
  
  
  BASE_POLICY_NAME = 'os_compute_api:os-instance-usage-audit-log'
  
  
  instance_usage_audit_log_policies = [
-     policy.RuleDefault(
+     base.create_rule_default(
-         name=BASE_POLICY_NAME,
+         BASE_POLICY_NAME,
-         check_str=base.RULE_ADMIN_API),
+         base.RULE_ADMIN_API,
+         """Lists all usage audits and that occurred before a specified time
+ for all servers on all compute hosts where usage auditing is configured.""",
+         [
+             {
+                 'method': 'GET',
+                 'path': '/os-instance_usage_audit_log'
+             },
+             {
+                 'method': 'GET',
+                 'path': '/os-instance_usage_audit_log/{before_timestamp}'
+             }
+         ]),
  ]
  
  
  def list_rules():
      return instance_usage_audit_log_policies
  
Add policy description for instance-usage-audit-log
## Code Before:

from oslo_policy import policy

from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:os-instance-usage-audit-log'


instance_usage_audit_log_policies = [
    policy.RuleDefault(
        name=BASE_POLICY_NAME,
        check_str=base.RULE_ADMIN_API),
]


def list_rules():
    return instance_usage_audit_log_policies

## Instruction:
Add policy description for instance-usage-audit-log
## Code After:

from nova.policies import base


BASE_POLICY_NAME = 'os_compute_api:os-instance-usage-audit-log'


instance_usage_audit_log_policies = [
    base.create_rule_default(
        BASE_POLICY_NAME,
        base.RULE_ADMIN_API,
        """Lists all usage audits and that occurred before a specified time
for all servers on all compute hosts where usage auditing is configured.""",
        [
            {
                'method': 'GET',
                'path': '/os-instance_usage_audit_log'
            },
            {
                'method': 'GET',
                'path': '/os-instance_usage_audit_log/{before_timestamp}'
            }
        ]),
]


def list_rules():
    return instance_usage_audit_log_policies
