Add description to policies in server_groups.py

Add description to policies in server_groups.py
This patch also fix a typo in server_groups.py

blueprint policy-docs

Change-Id: I3abe1cfcddae1f68927450edeee0e743ddbe696a
This commit is contained in:
Kevin_Zheng 2017-03-24 16:27:32 +08:00 committed by Zhenyu Zheng
parent 6f881e8b84
commit 7943147895
2 changed files with 46 additions and 13 deletions

View File

@ -85,7 +85,7 @@ class ServerGroupController(wsgi.Controller):
@wsgi.response(204)
@extensions.expected_errors(404)
def delete(self, req, id):
"""Delete an server group."""
"""Delete a server group."""
context = _authorize_context(req, 'delete')
try:
sg = objects.InstanceGroup.get_by_uuid(context, id)

View File

@ -27,21 +27,54 @@ server_groups_policies = [
policy.RuleDefault(
name=POLICY_ROOT % 'discoverable',
check_str=base.RULE_ANY),
# TODO(Kevin_Zheng): remove this rule as this not used by any API
policy.RuleDefault(
name=BASE_POLICY_NAME,
check_str=base.RULE_ADMIN_OR_OWNER),
policy.RuleDefault(
name=POLICY_ROOT % 'create',
check_str=BASE_POLICY_RULE),
policy.RuleDefault(
name=POLICY_ROOT % 'delete',
check_str=BASE_POLICY_RULE),
policy.RuleDefault(
name=POLICY_ROOT % 'index',
check_str=BASE_POLICY_RULE),
policy.RuleDefault(
name=POLICY_ROOT % 'show',
check_str=BASE_POLICY_RULE),
base.create_rule_default(
POLICY_ROOT % 'create',
BASE_POLICY_RULE,
"Create a new server group",
[
{
'path': '/os-server-groups',
'method': 'POST'
}
]
),
base.create_rule_default(
POLICY_ROOT % 'delete',
BASE_POLICY_RULE,
"Delete a server group",
[
{
'path': '/os-server-groups/{server_group_id}',
'method': 'DELETE'
}
]
),
base.create_rule_default(
POLICY_ROOT % 'index',
BASE_POLICY_RULE,
"List all server groups",
[
{
'path': '/os-server-groups',
'method': 'GET'
}
]
),
base.create_rule_default(
POLICY_ROOT % 'show',
BASE_POLICY_RULE,
"Show details of a server group",
[
{
'path': '/os-server-groups/{server_group_id}',
'method': 'GET'
}
]
),
]