Hugo Brito 9aa90f102e Apply black formatter to dcmanager/api
This commit applies the Black format to the `dcmanager/api`
files to ensure that it adheres to the Black code style guidelines.

Test Plan:
PASS: Success in stx-distcloud-tox-black

Story: 2011149
Task: 50444

Change-Id: Ib1af98da7b1fdd6a478b8c093dc7dd474d3bc5e6
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-07-03 15:52:22 -03:00

41 lines
1.2 KiB
Python

#
# Copyright (c) 2022, 2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from oslo_policy import policy
from dcmanager.api.policies import base
POLICY_ROOT = "dc_api:sw_update_options:%s"
sw_update_options_rules = [
policy.DocumentedRuleDefault(
name=POLICY_ROOT % "delete",
check_str="rule:" + base.ADMIN_IN_SYSTEM_PROJECTS,
description="Delete per subcloud sw-update options.",
operations=[{"method": "DELETE", "path": "/v1.0/sw-update-options/{subcloud}"}],
),
policy.DocumentedRuleDefault(
name=POLICY_ROOT % "get",
check_str="rule:" + base.READER_IN_SYSTEM_PROJECTS,
description="Get sw-update options.",
operations=[
{"method": "GET", "path": "/v1.0/sw-update-options"},
{"method": "GET", "path": "/v1.0/sw-update-options/{subcloud}"},
],
),
policy.DocumentedRuleDefault(
name=POLICY_ROOT % "update",
check_str="rule:" + base.ADMIN_IN_SYSTEM_PROJECTS,
description="Update sw-update options (defaults or per subcloud).",
operations=[{"method": "POST", "path": "/v1.0/sw-update-options/{subcloud}"}],
),
]
def list_rules():
return sw_update_options_rules