From 55eca6e099c127f5d0532af7adb23a3b37eb36b6 Mon Sep 17 00:00:00 2001 From: Sujitha Date: Mon, 13 Mar 2017 22:14:23 +0000 Subject: [PATCH] Add description to policies in aggregates.py The 'discoverable' policy is not documented as it will be removed in a future change. blueprint policy-doc Change-Id: I535a94ddcb3ce596dff33eabc35e16c2aa11e359 --- nova/policies/aggregates.py | 104 +++++++++++++++++++++++++++--------- 1 file changed, 80 insertions(+), 24 deletions(-) diff --git a/nova/policies/aggregates.py b/nova/policies/aggregates.py index 030815911..c4d708de6 100644 --- a/nova/policies/aggregates.py +++ b/nova/policies/aggregates.py @@ -22,33 +22,89 @@ POLICY_ROOT = 'os_compute_api:os-aggregates:%s' aggregates_policies = [ - policy.RuleDefault( - name=POLICY_ROOT % 'set_metadata', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'add_host', - check_str=base.RULE_ADMIN_API), + base.create_rule_default( + POLICY_ROOT % 'set_metadata', + base.RULE_ADMIN_API, + "Create or replace metadata for an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}/action (set_metadata)', + 'method': 'POST' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'add_host', + base.RULE_ADMIN_API, + "Add a host to an aggregate.", + [ + { + 'path': '/os-aggregates/{aggregate_id}/action (add_host)', + 'method': 'POST' + } + ]), policy.RuleDefault( name=POLICY_ROOT % 'discoverable', check_str=base.RULE_ANY), - policy.RuleDefault( - name=POLICY_ROOT % 'create', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'remove_host', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'update', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'index', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'delete', - check_str=base.RULE_ADMIN_API), - policy.RuleDefault( - name=POLICY_ROOT % 'show', - check_str=base.RULE_ADMIN_API), + base.create_rule_default( + POLICY_ROOT % 'create', + base.RULE_ADMIN_API, + "Create an aggregate", + [ + { + 'path': '/os-aggregates', + 'method': 'POST' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'remove_host', + base.RULE_ADMIN_API, + "Remove a host from an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}/action (remove_host)', + 'method': 'POST' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'update', + base.RULE_ADMIN_API, + "Update name and/or availability zone for an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}', + 'method': 'PUT' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'index', + base.RULE_ADMIN_API, + "List all aggregates", + [ + { + 'path': '/os-aggregates', + 'method': 'GET' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'delete', + base.RULE_ADMIN_API, + "Delete an aggregate", + [ + { + 'path': '/os-aggregates/{aggregate_id}', + 'method': 'DELETE' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'show', + base.RULE_ADMIN_API, + "Show details for an aggregate.", + [ + { + 'path': '/os-aggregates/{aggregate_id}', + 'method': 'GET' + } + ]), ]