
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>
54 lines
1.8 KiB
Python
54 lines
1.8 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_strategy:%s"
|
|
|
|
|
|
sw_update_strategy_rules = [
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % "abort",
|
|
check_str="rule:" + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Abort update strategy execution.",
|
|
operations=[{"method": "POST", "path": "/v1.0/sw-update-strategy/actions"}],
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % "apply",
|
|
check_str="rule:" + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Apply update strategy.",
|
|
operations=[{"method": "POST", "path": "/v1.0/sw-update-strategy/actions"}],
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % "create",
|
|
check_str="rule:" + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Create update strategy.",
|
|
operations=[{"method": "POST", "path": "/v1.0/sw-update-strategy"}],
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % "delete",
|
|
check_str="rule:" + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Delete update strategy.",
|
|
operations=[{"method": "DELETE", "path": "/v1.0/sw-update-strategy"}],
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % "get",
|
|
check_str="rule:" + base.READER_IN_SYSTEM_PROJECTS,
|
|
description="Get update strategy.",
|
|
operations=[
|
|
{"method": "GET", "path": "/v1.0/sw-update-strategy"},
|
|
{"method": "GET", "path": "/v1.0/sw-update-strategy/steps"},
|
|
{"method": "GET", "path": "/v1.0/sw-update-strategy/steps/{cloud_name}"},
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
def list_rules():
|
|
return sw_update_strategy_rules
|