
Adds support for restoring backups for a subcloud or group of subcloud using the dcmanager API. Test Plan: 1. Verify command with multiple combinations of parameters. 2. Retest command after the changes are integrated with others related to subcloud-backup commands. Story: 2010116 Task: 46537 Signed-off-by: Andre Carneiro <Andre.DexheimerCarneiro@windriver.com> Change-Id: I50ac2b529be9da45f68f21f46e9355546328ac40
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
#
|
|
# Copyright (c) 2022 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_backup:%s'
|
|
|
|
|
|
subcloud_backup_rules = [
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % 'create',
|
|
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Create new subcloud backup.",
|
|
operations=[
|
|
{
|
|
'method': 'POST',
|
|
'path': '/v1.0/subcloud-backup'
|
|
}
|
|
]
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % 'delete',
|
|
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Delete a subcloud backup.",
|
|
operations=[
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/subcloud-backup/delete/{release_version}'
|
|
}
|
|
]
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % 'restore',
|
|
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Restore a subcloud backup.",
|
|
operations=[
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/subcloud-backup/restore'
|
|
}
|
|
]
|
|
)
|
|
]
|
|
|
|
|
|
def list_rules():
|
|
return subcloud_backup_rules
|