summaryrefslogtreecommitdiff
path: root/openstackclient/identity/common.py
diff options
context:
space:
mode:
authorVishakha Agarwal <agarwalvishakha18@gmail.com>2020-03-26 22:23:57 +0530
committerVishakha Agarwal <agarwalvishakha18@gmail.com>2020-04-08 13:51:01 +0000
commit7f66273d3f2fb6449d7b50d88460ace0cb81bf30 (patch)
tree78e639f02b4d8bda23f15823ecfc4a80d9e8b66b /openstackclient/identity/common.py
parent05da145eaee329e299b449ba2d7ea88d1325e432 (diff)
downloadpython-openstackclient-7f66273d3f2fb6449d7b50d88460ace0cb81bf30.tar.gz
Add resource option immutable
This patch adds the --immutable and --no-immutable option to the role, project and domain CLI. Related-Patch: https://review.opendev.org/#/c/712182/ Change-Id: I9c3bdd741f28bf558267fb217818d947597ce13e
Diffstat (limited to 'openstackclient/identity/common.py')
-rw-r--r--openstackclient/identity/common.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/openstackclient/identity/common.py b/openstackclient/identity/common.py
index 7be2a17b..e70d87d2 100644
--- a/openstackclient/identity/common.py
+++ b/openstackclient/identity/common.py
@@ -213,6 +213,15 @@ def _find_identity_resource(identity_client_manager, name_or_id,
return resource_type(None, {'id': name_or_id, 'name': name_or_id})
+def get_immutable_options(parsed_args):
+ options = {}
+ if parsed_args.immutable:
+ options['immutable'] = True
+ if parsed_args.no_immutable:
+ options['immutable'] = False
+ return options
+
+
def add_user_domain_option_to_parser(parser):
parser.add_argument(
'--user-domain',
@@ -261,3 +270,18 @@ def add_inherited_option_to_parser(parser):
help=_('Specifies if the role grant is inheritable to the sub '
'projects'),
)
+
+
+def add_resource_option_to_parser(parser):
+ enable_group = parser.add_mutually_exclusive_group()
+ enable_group.add_argument(
+ '--immutable',
+ action='store_true',
+ help=_('Make resource immutable. An immutable project may not '
+ 'be deleted or modified except to remove the immutable flag'),
+ )
+ enable_group.add_argument(
+ '--no-immutable',
+ action='store_true',
+ help=_('Make resource mutable (default)'),
+ )