distcloud/distributedcloud/dcmanager/api/policies/subcloud_deploy.py
Li Zhu e105209400 Add release optionality to subcloud-deploy upload/show
Add an optional --release parameter to subcloud-deploy upload/show
commands to enable release optionality in subcloud-deploy upload and
show.

Test Plan:
PASS: Verify that the deployment files were successfully uploaded to
the directory dedicated for that specified release.
PASS: Verify that the deployment files were successfully uploaded to
the directory dedicated for the active release when the '--release'
parameter not present.
PASS: Verify the deployment files that were showed belong to
the specified release.
PASS: Verify the deployment files that were showed belong to
the active release when the '--release' not present.
PASS: Verify that 'None' files were shown when an unknown release
was given to the "subcloud-deploy show" command.

Story: 2010611
Task: 47663

Signed-off-by: lzhu1 <li.zhu@windriver.com>
Change-Id: I402d95a0fd6c5b7818539d2756fc0c13cf60010c
2023-03-16 21:31:07 -04:00

45 lines
1.0 KiB
Python

#
# Copyright (c) 2022-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from dcmanager.api.policies import base
from oslo_policy import policy
POLICY_ROOT = 'dc_api:subcloud_deploy:%s'
subcloud_deploy_rules = [
policy.DocumentedRuleDefault(
name=POLICY_ROOT % 'upload',
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
description="Upload subcloud deploy files.",
operations=[
{
'method': 'POST',
'path': '/v1.0/subcloud-deploy'
}
]
),
policy.DocumentedRuleDefault(
name=POLICY_ROOT % 'get',
check_str='rule:' + base.READER_IN_SYSTEM_PROJECTS,
description="Show subcloud deploy files.",
operations=[
{
'method': 'GET',
'path': '/v1.0/subcloud-deploy'
},
{
'method': 'GET',
'path': '/v1.0/subcloud-deploy/{release}'
}
]
)
]
def list_rules():
return subcloud_deploy_rules