summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--moonclient/moonclient/action_assignments.py75
-rw-r--r--moonclient/moonclient/action_categories.py29
-rw-r--r--moonclient/moonclient/action_scopes.py (renamed from moonclient/moonclient/action_category_scope.py)71
-rw-r--r--moonclient/moonclient/actions.py19
-rw-r--r--moonclient/moonclient/configuration.py2
-rw-r--r--moonclient/moonclient/intraextension.py11
-rw-r--r--moonclient/moonclient/logs.py2
-rw-r--r--moonclient/moonclient/metarules.py81
-rw-r--r--moonclient/moonclient/object_assignments.py75
-rw-r--r--moonclient/moonclient/object_categories.py27
-rw-r--r--moonclient/moonclient/object_scopes.py (renamed from moonclient/moonclient/object_category_scope.py)83
-rw-r--r--moonclient/moonclient/objects.py23
-rw-r--r--moonclient/moonclient/rules.py6
-rw-r--r--moonclient/moonclient/shell.py2
-rw-r--r--moonclient/moonclient/subject_assignments.py75
-rw-r--r--moonclient/moonclient/subject_categories.py29
-rw-r--r--moonclient/moonclient/subject_scopes.py (renamed from moonclient/moonclient/subject_category_scope.py)72
-rw-r--r--moonclient/moonclient/subjects.py27
-rw-r--r--moonclient/moonclient/tenants.py28
-rw-r--r--moonclient/setup.py44
20 files changed, 402 insertions, 379 deletions
diff --git a/moonclient/moonclient/action_assignments.py b/moonclient/moonclient/action_assignments.py
index 2301abc1..be2a66da 100644
--- a/moonclient/moonclient/action_assignments.py
+++ b/moonclient/moonclient/action_assignments.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class ActionAssignmentsList(Lister):
- """List all Intra_Extensions."""
+ """List all action assignments."""
log = logging.getLogger(__name__)
@@ -22,9 +22,9 @@ class ActionAssignmentsList(Lister):
help='Action UUID',
)
parser.add_argument(
- 'category_id',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'action_category_id',
+ metavar='<action-category-uuid>',
+ help='Action category UUID',
)
parser.add_argument(
'--intraextension',
@@ -33,27 +33,29 @@ class ActionAssignmentsList(Lister):
)
return parser
- def __get_scope_from_id(self, intraextension_id, category_id, scope_id):
+ def __get_scope_from_id(self, intraextension_id, action_category_id, action_scope_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}".format(
- intraextension_id, category_id),
+ intraextension_id, action_category_id),
authtoken=True)
- if scope_id in data:
- return data[scope_id]
+ if action_scope_id in data:
+ return data[action_scope_id]
def take_action(self, parsed_args):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_assignments/{}/{}".format(
- parsed_args.intraextension, parsed_args.action_id, parsed_args.category_id),
+ parsed_args.intraextension, parsed_args.action_id, parsed_args.action_category_id),
authtoken=True)
return (
("id", "name"),
- ((_id, self.__get_scope_from_id(parsed_args.intraextension, parsed_args.category_id, _id)['name']) for _id in data)
+ ((_id, self.__get_scope_from_id(parsed_args.intraextension,
+ parsed_args.action_category_id,
+ _id)['name']) for _id in data)
)
class ActionAssignmentsAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new action assignment."""
log = logging.getLogger(__name__)
@@ -65,14 +67,14 @@ class ActionAssignmentsAdd(Command):
help='Action UUID',
)
parser.add_argument(
- 'action_category',
- metavar='<action_category-uuid>',
- help='Action Category',
+ 'action_category_id',
+ metavar='<action-category-uuid>',
+ help='Action category UUID',
)
parser.add_argument(
- 'action_category_scope',
- metavar='<action_category_scope-uuid>',
- help='Action Category Scope',
+ 'action_scope_id',
+ metavar='<action-scope-uuid>',
+ help='Action scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -81,12 +83,12 @@ class ActionAssignmentsAdd(Command):
)
return parser
- def __get_scope_from_id(self, intraextension_id, category_id, scope_id):
+ def __get_scope_from_id(self, intraextension_id, action_category_id, action_scope_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}".format(
- intraextension_id, category_id),
+ intraextension_id, action_category_id),
authtoken=True)
- if scope_id in data:
- return data[scope_id]
+ if action_scope_id in data:
+ return data[action_scope_id]
def take_action(self, parsed_args):
if not parsed_args.intraextension:
@@ -94,18 +96,19 @@ class ActionAssignmentsAdd(Command):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_assignments".format(parsed_args.intraextension),
post_data={
"action_id": parsed_args.action_id,
- "action_category_id": parsed_args.action_category,
- "action_scope_id": parsed_args.action_category_scope
- },
+ "action_category_id": parsed_args.action_category_id,
+ "action_scope_id": parsed_args.action_scope_id},
authtoken=True)
return (
("id", "name"),
- ((_id, self.__get_scope_from_id(parsed_args.intraextension, parsed_args.category_id, _id)['name']) for _id in data)
+ ((_id, self.__get_scope_from_id(parsed_args.intraextension,
+ parsed_args.action_category_id,
+ _id)['name']) for _id in data)
)
class ActionAssignmentsDelete(Command):
- """List all Intra_Extensions."""
+ """Delete an action assignment."""
log = logging.getLogger(__name__)
@@ -117,14 +120,14 @@ class ActionAssignmentsDelete(Command):
help='Action UUID',
)
parser.add_argument(
- 'action_category',
- metavar='<action_category>',
- help='Action Category',
+ 'action_category_id',
+ metavar='<action-category-uuid>',
+ help='Action category UUID',
)
parser.add_argument(
- 'action_category_scope',
- metavar='<action_category_scope>',
- help='Action Category Scope',
+ 'action_scope_id',
+ metavar='<action-scope-uuid>',
+ help='Action scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -139,8 +142,8 @@ class ActionAssignmentsDelete(Command):
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_assignments/{}/{}/{}".format(
parsed_args.intraextension,
parsed_args.action_id,
- parsed_args.action_category,
- parsed_args.action_category_scope
- ),
+ parsed_args.action_category_id,
+ parsed_args.action_scope_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/action_categories.py b/moonclient/moonclient/action_categories.py
index 44818760..f4400c79 100644
--- a/moonclient/moonclient/action_categories.py
+++ b/moonclient/moonclient/action_categories.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class ActionCategoriesList(Lister):
- """List all Intra_Extensions."""
+ """List all action categories."""
log = logging.getLogger(__name__)
@@ -35,16 +35,16 @@ class ActionCategoriesList(Lister):
class ActionCategoriesAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new action category."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(ActionCategoriesAdd, self).get_parser(prog_name)
parser.add_argument(
- 'action_category',
- metavar='<action_category-uuid>',
- help='Action UUID',
+ 'action_category_name',
+ metavar='<action_category-name>',
+ help='Action category name',
)
parser.add_argument(
'--intraextension',
@@ -54,7 +54,7 @@ class ActionCategoriesAdd(Command):
parser.add_argument(
'--description',
metavar='<description-str>',
- help='Category description',
+ help='Action category description',
)
return parser
@@ -63,9 +63,8 @@ class ActionCategoriesAdd(Command):
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_categories".format(parsed_args.intraextension),
post_data={
- "action_category_name": parsed_args.action_category,
- "action_category_description": parsed_args.description,
- },
+ "action_category_name": parsed_args.action_category_name,
+ "action_category_description": parsed_args.description},
authtoken=True)
return (
("id", "name", "description"),
@@ -74,16 +73,16 @@ class ActionCategoriesAdd(Command):
class ActionCategoriesDelete(Command):
- """List all Intra_Extensions."""
+ """Delete an action category."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(ActionCategoriesDelete, self).get_parser(prog_name)
parser.add_argument(
- 'action_category',
+ 'action_category_id',
metavar='<action_category-uuid>',
- help='Action UUID',
+ help='Action category UUID',
)
parser.add_argument(
'--intraextension',
@@ -97,7 +96,7 @@ class ActionCategoriesDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_categories/{}".format(
parsed_args.intraextension,
- parsed_args.action_category
- ),
+ parsed_args.action_category_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/action_category_scope.py b/moonclient/moonclient/action_scopes.py
index b07c21aa..53ed2604 100644
--- a/moonclient/moonclient/action_category_scope.py
+++ b/moonclient/moonclient/action_scopes.py
@@ -9,17 +9,17 @@ from cliff.lister import Lister
from cliff.command import Command
-class ActionCategoryScopeList(Lister):
- """List all Intra_Extensions."""
+class ActionScopesList(Lister):
+ """List all action scopes."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(ActionCategoryScopeList, self).get_parser(prog_name)
+ parser = super(ActionScopesList, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'action_category_id',
+ metavar='<action-category-uuid>',
+ help='Action category UUID',
)
parser.add_argument(
'--intraextension',
@@ -32,8 +32,8 @@ class ActionCategoryScopeList(Lister):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}".format(
- parsed_args.intraextension, parsed_args.category),
- authtoken=True)
+ parsed_args.intraextension, parsed_args.action_category_id),
+ authtoken=True)
self.log.debug(data)
return (
("id", "name", "description"),
@@ -41,22 +41,22 @@ class ActionCategoryScopeList(Lister):
)
-class ActionCategoryScopeAdd(Command):
- """List all Intra_Extensions."""
+class ActionScopesAdd(Command):
+ """Add a new action scope."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(ActionCategoryScopeAdd, self).get_parser(prog_name)
+ parser = super(ActionScopesAdd, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'action_category_id',
+ metavar='<action-category-uuid>',
+ help='Action category UUID',
)
parser.add_argument(
- 'scope_name',
- metavar='<scope-str>',
- help='Scope Name',
+ 'action_scope_name',
+ metavar='<action-scope-name>',
+ help='Action scope name',
)
parser.add_argument(
'--description',
@@ -74,34 +74,34 @@ class ActionCategoryScopeAdd(Command):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}".format(
- parsed_args.intraextension, parsed_args.category),
- post_data={
- "action_scope_name": parsed_args.scope_name,
- "action_scope_description": parsed_args.description,
- },
- authtoken=True)
+ parsed_args.intraextension, parsed_args.action_category_id),
+ post_data={
+ "action_scope_name": parsed_args.action_scope_name,
+ "action_scope_description": parsed_args.description,
+ },
+ authtoken=True)
return (
("id", "name", "description"),
((_id, data[_id]["name"], data[_id]["description"]) for _id in data)
)
-class ActionCategoryScopeDelete(Command):
- """List all Intra_Extensions."""
+class ActionScopesDelete(Command):
+ """Delete an action scope."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(ActionCategoryScopeDelete, self).get_parser(prog_name)
+ parser = super(ActionScopesDelete, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'action_category_id',
+ metavar='<action-category-uuid>',
+ help='Action category UUID',
)
parser.add_argument(
- 'scope_id',
- metavar='<scope-uuid>',
- help='Scope UUID',
+ 'action_scope_id',
+ metavar='<action-scope-uuid>',
+ help='Action scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -115,8 +115,9 @@ class ActionCategoryScopeDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_scopes/{}/{}".format(
parsed_args.intraextension,
- parsed_args.category,
- parsed_args.scope_id
+ parsed_args.action_category_id,
+ parsed_args.action_scope_id
),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/actions.py b/moonclient/moonclient/actions.py
index f5947b32..f2550579 100644
--- a/moonclient/moonclient/actions.py
+++ b/moonclient/moonclient/actions.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class ActionsList(Lister):
- """List all Intra_Extensions."""
+ """List all actions."""
log = logging.getLogger(__name__)
@@ -35,7 +35,7 @@ class ActionsList(Lister):
class ActionsAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new action."""
log = logging.getLogger(__name__)
@@ -61,11 +61,10 @@ class ActionsAdd(Command):
def take_action(self, parsed_args):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
- data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/actions".format(parsed_args.intraextension),
+ data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/actions".format(parsed_args.intraextension), # TODO: check method POST?
post_data={
"action_name": parsed_args.action_name,
- "action_description": parsed_args.description,
- },
+ "action_description": parsed_args.description},
authtoken=True)
return (
("id", "name", "description"),
@@ -74,14 +73,14 @@ class ActionsAdd(Command):
class ActionsDelete(Command):
- """List all Intra_Extensions."""
+ """Delete an action."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(ActionsDelete, self).get_parser(prog_name)
parser.add_argument(
- 'action',
+ 'action_id',
metavar='<action-uuid>',
help='Action UUID',
)
@@ -97,7 +96,7 @@ class ActionsDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/actions/{}".format(
parsed_args.intraextension,
- parsed_args.action
- ),
+ parsed_args.action_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/configuration.py b/moonclient/moonclient/configuration.py
index 09f241d7..3a77723c 100644
--- a/moonclient/moonclient/configuration.py
+++ b/moonclient/moonclient/configuration.py
@@ -45,7 +45,7 @@ class AggregationAlgorithmsList(Lister):
class SubMetaRuleAlgorithmsList(Lister):
- """List all aggregation algorithms."""
+ """List all sub meta rule algorithms."""
log = logging.getLogger(__name__)
diff --git a/moonclient/moonclient/intraextension.py b/moonclient/moonclient/intraextension.py
index eba6e614..569a99ff 100644
--- a/moonclient/moonclient/intraextension.py
+++ b/moonclient/moonclient/intraextension.py
@@ -12,7 +12,7 @@ import os
class IntraExtensionSelect(Command):
- """Select a Intra_Extension to work with."""
+ """Select an Intra_Extension to work with."""
log = logging.getLogger(__name__)
@@ -84,8 +84,6 @@ class IntraExtensionList(Lister):
def take_action(self, parsed_args):
ie = self.app.get_url("/v3/OS-MOON/intra_extensions", authtoken=True)
- # if "intra_extensions" not in ie:
- # raise Exception("Error in command {}".format(ie))
return (
("id", "name", "model"),
((_id, ie[_id]["name"], ie[_id]["model"]) for _id in ie.keys())
@@ -107,10 +105,9 @@ class IntraExtensionDelete(Command):
return parser
def take_action(self, parsed_args):
- ie = self.app.get_url("/v3/OS-MOON/intra_extensions/{}".format(parsed_args.uuid),
- method="DELETE",
- authtoken=True)
- return
+ self.app.get_url("/v3/OS-MOON/intra_extensions/{}".format(parsed_args.uuid),
+ method="DELETE",
+ authtoken=True)
class IntraExtensionShow(ShowOne):
diff --git a/moonclient/moonclient/logs.py b/moonclient/moonclient/logs.py
index 03c16128..6a1501e9 100644
--- a/moonclient/moonclient/logs.py
+++ b/moonclient/moonclient/logs.py
@@ -11,7 +11,7 @@ from cliff.show import ShowOne
class LogsList(Lister):
- """List all aggregation algorithms."""
+ """List all logs."""
log = logging.getLogger(__name__)
diff --git a/moonclient/moonclient/metarules.py b/moonclient/moonclient/metarules.py
index 51f6a97f..a29ab45f 100644
--- a/moonclient/moonclient/metarules.py
+++ b/moonclient/moonclient/metarules.py
@@ -57,8 +57,8 @@ class AggregationAlgorithmSet(Command):
def get_parser(self, prog_name):
parser = super(AggregationAlgorithmSet, self).get_parser(prog_name)
parser.add_argument(
- 'aggregation_algorithm',
- metavar='<aggregation_algorithm-uuid>',
+ 'aggregation_algorithm_id',
+ metavar='<aggregation-algorithm-uuid>',
help='Aggregation algorithm UUID',
)
parser.add_argument(
@@ -66,6 +66,11 @@ class AggregationAlgorithmSet(Command):
metavar='<intraextension-uuid>',
help='IntraExtension UUID',
)
+ parser.add_argument(
+ '--description',
+ metavar='<description-str>',
+ help='Action description',
+ )
return parser
def take_action(self, parsed_args):
@@ -73,7 +78,9 @@ class AggregationAlgorithmSet(Command):
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/aggregation_algorithm".format(
parsed_args.intraextension),
- post_data={"aggregation_algorithm_id": parsed_args.aggregation_algorithm},
+ post_data={
+ "aggregation_algorithm_id": parsed_args.aggregation_algorithm_id,
+ "aggregation_algorithm_description": parsed_args.description},
authtoken=True)
algorithm = self.__get_aggregation_algorithm_from_id(data['content'])
return (
@@ -96,23 +103,23 @@ class SubMetaRuleShow(Lister):
)
return parser
- def __get_subject_category_name(self, intraextension, category_id):
+ def __get_subject_category_name(self, intraextension, subject_category_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_categories".format(intraextension),
authtoken=True)
- if category_id in data:
- return data[category_id]["name"]
+ if subject_category_id in data:
+ return data[subject_category_id]["name"]
- def __get_object_category_name(self, intraextension, category_id):
+ def __get_object_category_name(self, intraextension, object_category_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_categories".format(intraextension),
authtoken=True)
- if category_id in data:
- return data[category_id]["name"]
+ if object_category_id in data:
+ return data[object_category_id]["name"]
- def __get_action_category_name(self, intraextension, category_id):
+ def __get_action_category_name(self, intraextension, action_category_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_categories".format(intraextension),
authtoken=True)
- if category_id in data:
- return data[category_id]["name"]
+ if action_category_id in data:
+ return data[action_category_id]["name"]
def take_action(self, parsed_args):
if not parsed_args.intraextension:
@@ -140,7 +147,7 @@ class SubMetaRuleSet(Command):
def get_parser(self, prog_name):
parser = super(SubMetaRuleSet, self).get_parser(prog_name)
parser.add_argument(
- 'id',
+ 'submetarule_id',
metavar='<sub_meta_rule-uuid>',
help='Sub Meta Rule UUID (example: "12346")',
)
@@ -155,19 +162,19 @@ class SubMetaRuleSet(Command):
help='name to set (example: "my new sub meta rule")',
)
parser.add_argument(
- '--subject_categories',
- metavar='<subject_categories-uuid>',
- help='subject_categories UUID (example: "12346,")',
+ '--subject_category_id',
+ metavar='<subject-category-uuid>',
+ help='subject category UUID (example: "12346,")',
)
parser.add_argument(
- '--action_categories',
- metavar='<action_categories-uuid>',
- help='action_categories UUID (example: "12346,0987654")',
+ '--object_category_id',
+ metavar='<object-category-uuid>',
+ help='object category UUID (example: "12346")',
)
parser.add_argument(
- '--object_categories',
- metavar='<object_categories-uuid>',
- help='object_categories UUID (example: "12346")',
+ '--action_category_id',
+ metavar='<action-category-uuid>',
+ help='action category UUID (example: "12346,0987654")',
)
parser.add_argument(
'--intraextension',
@@ -179,25 +186,25 @@ class SubMetaRuleSet(Command):
def take_action(self, parsed_args):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
- subject_categories = parsed_args.subject_categories
- if not subject_categories:
- subject_categories = ""
- object_categories = parsed_args.object_categories
- if not object_categories:
- object_categories = ""
- action_categories = parsed_args.action_categories
- if not action_categories:
- action_categories = ""
- subject_categories = map(lambda x: x.strip(), subject_categories.split(','))
- action_categories = map(lambda x: x.strip(), action_categories.split(','))
- object_categories = map(lambda x: x.strip(), object_categories.split(','))
+ subject_category_id = parsed_args.subject_category_id
+ if not subject_category_id:
+ subject_category_id = ""
+ object_category_id = parsed_args.object_category_id
+ if not object_category_id:
+ object_category_id = ""
+ action_category_id = parsed_args.action_category_id
+ if not action_category_id:
+ action_category_id = ""
+ subject_category_id = map(lambda x: x.strip(), subject_category_id.split(','))
+ action_category_id = map(lambda x: x.strip(), action_category_id.split(','))
+ object_category_id = map(lambda x: x.strip(), object_category_id.split(','))
sub_meta_rule_id = parsed_args.id
post_data = dict()
post_data["sub_meta_rule_name"] = parsed_args.name
post_data["sub_meta_rule_algorithm"] = parsed_args.algorithm
- post_data["sub_meta_rule_subject_categories"] = filter(lambda x: x, subject_categories)
- post_data["sub_meta_rule_object_categories"] = filter(lambda x: x, object_categories)
- post_data["sub_meta_rule_action_categories"] = filter(lambda x: x, action_categories)
+ post_data["sub_meta_rule_subject_categories"] = filter(lambda x: x, subject_category_id) # TODO: check for multiple categories
+ post_data["sub_meta_rule_object_categories"] = filter(lambda x: x, object_category_id)
+ post_data["sub_meta_rule_action_categories"] = filter(lambda x: x, action_category_id)
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/sub_meta_rules/{}".format(parsed_args.intraextension, sub_meta_rule_id),
post_data=post_data,
method="POST",
diff --git a/moonclient/moonclient/object_assignments.py b/moonclient/moonclient/object_assignments.py
index 611fdb13..b5f89002 100644
--- a/moonclient/moonclient/object_assignments.py
+++ b/moonclient/moonclient/object_assignments.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class ObjectAssignmentsList(Lister):
- """List all Intra_Extensions."""
+ """List all object assignments."""
log = logging.getLogger(__name__)
@@ -22,9 +22,9 @@ class ObjectAssignmentsList(Lister):
help='Object UUID',
)
parser.add_argument(
- 'category_id',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'object_category_id',
+ metavar='<object-category-uuid>',
+ help='Object category UUID',
)
parser.add_argument(
'--intraextension',
@@ -33,27 +33,29 @@ class ObjectAssignmentsList(Lister):
)
return parser
- def __get_scope_from_id(self, intraextension_id, category_id, scope_id):
+ def __get_scope_from_id(self, intraextension_id, object_category_id, object_scope_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}".format(
- intraextension_id, category_id),
+ intraextension_id, object_category_id),
authtoken=True)
- if scope_id in data:
- return data[scope_id]
+ if object_scope_id in data:
+ return data[object_scope_id]
def take_action(self, parsed_args):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_assignments/{}/{}".format(
- parsed_args.intraextension, parsed_args.object_id, parsed_args.category_id),
+ parsed_args.intraextension, parsed_args.object_id, parsed_args.object_category_id),
authtoken=True)
return (
("id", "name"),
- ((_id, self.__get_scope_from_id(parsed_args.intraextension, parsed_args.category_id, _id)['name']) for _id in data)
+ ((_id, self.__get_scope_from_id(parsed_args.intraextension,
+ parsed_args.object_category_id,
+ _id)['name']) for _id in data)
)
class ObjectAssignmentsAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new object assignment."""
log = logging.getLogger(__name__)
@@ -65,14 +67,14 @@ class ObjectAssignmentsAdd(Command):
help='Object UUID',
)
parser.add_argument(
- 'object_category',
- metavar='<object_category-uuid>',
- help='Object Category',
+ 'object_category_id',
+ metavar='<object-category-uuid>',
+ help='Object category UUID',
)
parser.add_argument(
- 'object_category_scope',
- metavar='<object_category_scope-uuid>',
- help='Object Category Scope',
+ 'object_scope_id',
+ metavar='<object-scope-uuid>',
+ help='Object scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -81,12 +83,12 @@ class ObjectAssignmentsAdd(Command):
)
return parser
- def __get_scope_from_id(self, intraextension_id, category_id, scope_id):
+ def __get_scope_from_id(self, intraextension_id, object_category_id, object_scope_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}".format(
- intraextension_id, category_id),
+ intraextension_id, object_category_id),
authtoken=True)
- if scope_id in data:
- return data[scope_id]
+ if object_scope_id in data:
+ return data[object_scope_id]
def take_action(self, parsed_args):
if not parsed_args.intraextension:
@@ -94,18 +96,19 @@ class ObjectAssignmentsAdd(Command):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_assignments".format(parsed_args.intraextension),
post_data={
"object_id": parsed_args.object_id,
- "object_category_id": parsed_args.object_category,
- "object_scope_id": parsed_args.object_category_scope
- },
+ "object_category_id": parsed_args.object_category_id,
+ "object_scope_id": parsed_args.object_scope_id},
authtoken=True)
return (
("id", "name"),
- ((_id, self.__get_scope_from_id(parsed_args.intraextension, parsed_args.category_id, _id)['name']) for _id in data)
+ ((_id, self.__get_scope_from_id(parsed_args.intraextension,
+ parsed_args.object_category_id,
+ _id)['name']) for _id in data)
)
class ObjectAssignmentsDelete(Command):
- """List all Intra_Extensions."""
+ """Delete an object assignment."""
log = logging.getLogger(__name__)
@@ -117,14 +120,14 @@ class ObjectAssignmentsDelete(Command):
help='Object UUID',
)
parser.add_argument(
- 'object_category',
- metavar='<object_category>',
- help='Object Category',
+ 'object_category_id',
+ metavar='<object-category-id>',
+ help='Object category UUID',
)
parser.add_argument(
- 'object_category_scope',
- metavar='<object_category_scope>',
- help='Object Category Scope',
+ 'object_scope_id',
+ metavar='<object-scope-id>',
+ help='Object scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -139,8 +142,8 @@ class ObjectAssignmentsDelete(Command):
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_assignments/{}/{}/{}".format(
parsed_args.intraextension,
parsed_args.object_id,
- parsed_args.object_category,
- parsed_args.object_category_scope
- ),
+ parsed_args.object_category_id,
+ parsed_args.object_scope_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/object_categories.py b/moonclient/moonclient/object_categories.py
index 6c0076ff..c86586f3 100644
--- a/moonclient/moonclient/object_categories.py
+++ b/moonclient/moonclient/object_categories.py
@@ -35,16 +35,16 @@ class ObjectCategoriesList(Lister):
class ObjectCategoriesAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new object category."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(ObjectCategoriesAdd, self).get_parser(prog_name)
parser.add_argument(
- 'object_category',
- metavar='<object_category-uuid>',
- help='Object UUID',
+ 'object_category_name',
+ metavar='<object_category-name>',
+ help='Object category name',
)
parser.add_argument(
'--intraextension',
@@ -54,7 +54,7 @@ class ObjectCategoriesAdd(Command):
parser.add_argument(
'--description',
metavar='<description-str>',
- help='Category description',
+ help='Object category description',
)
return parser
@@ -63,9 +63,8 @@ class ObjectCategoriesAdd(Command):
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_categories".format(parsed_args.intraextension),
post_data={
- "object_category_name": parsed_args.object_category,
- "object_category_description": parsed_args.description,
- },
+ "object_category_name": parsed_args.object_category_name,
+ "object_category_description": parsed_args.description},
authtoken=True)
return (
("id", "name", "description"),
@@ -74,16 +73,16 @@ class ObjectCategoriesAdd(Command):
class ObjectCategoriesDelete(Command):
- """List all Intra_Extensions."""
+ """Delete an object category."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(ObjectCategoriesDelete, self).get_parser(prog_name)
parser.add_argument(
- 'object_category',
+ 'object_category_id',
metavar='<object_category-uuid>',
- help='Object UUID',
+ help='Object category UUID',
)
parser.add_argument(
'--intraextension',
@@ -97,7 +96,7 @@ class ObjectCategoriesDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_categories/{}".format(
parsed_args.intraextension,
- parsed_args.object_category
- ),
+ parsed_args.object_category_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/object_category_scope.py b/moonclient/moonclient/object_scopes.py
index 3bd10b58..0fbd757d 100644
--- a/moonclient/moonclient/object_category_scope.py
+++ b/moonclient/moonclient/object_scopes.py
@@ -9,17 +9,17 @@ from cliff.lister import Lister
from cliff.command import Command
-class ObjectCategoryScopeList(Lister):
- """List all Intra_Extensions."""
+class ObjectScopesList(Lister):
+ """List all object scopes."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(ObjectCategoryScopeList, self).get_parser(prog_name)
+ parser = super(ObjectScopesList, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'object_category_id',
+ metavar='<object-category-uuid>',
+ help='Object category UUID',
)
parser.add_argument(
'--intraextension',
@@ -32,76 +32,76 @@ class ObjectCategoryScopeList(Lister):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}".format(
- parsed_args.intraextension, parsed_args.category),
- authtoken=True)
- self.log.debug(data)
+ parsed_args.intraextension, parsed_args.object_category_id),
+ authtoken=True)
+ self.log.debug(data) # TODO: why log here?
return (
("id", "name", "description"),
((_id, data[_id]["name"], data[_id]["description"]) for _id in data)
)
-class ObjectCategoryScopeAdd(Command):
- """List all Intra_Extensions."""
+class ObjectScopesAdd(Command):
+ """Add a new object scope."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(ObjectCategoryScopeAdd, self).get_parser(prog_name)
+ parser = super(ObjectScopesAdd, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'object_category_id',
+ metavar='<object-category-uuid>',
+ help='Object category UUID',
)
parser.add_argument(
- 'scope_name',
- metavar='<scope-str>',
- help='Scope Name',
- )
- parser.add_argument(
- '--description',
- metavar='<description-str>',
- help='Description',
+ 'object_scope_name',
+ metavar='<object-scope-str>',
+ help='Object scope name',
)
parser.add_argument(
'--intraextension',
metavar='<intraextension-uuid>',
help='IntraExtension UUID',
)
+ parser.add_argument(
+ '--description',
+ metavar='<description-str>',
+ help='Description',
+ )
return parser
def take_action(self, parsed_args):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}".format(
- parsed_args.intraextension, parsed_args.category),
- post_data={
- "object_scope_name": parsed_args.scope_name,
- "object_scope_description": parsed_args.description,
- },
- authtoken=True)
+ parsed_args.intraextension, parsed_args.object_category_id),
+ post_data={
+ "object_scope_name": parsed_args.object_scope_name,
+ "object_scope_description": parsed_args.description,
+ },
+ authtoken=True)
return (
("id", "name", "description"),
((_id, data[_id]["name"], data[_id]["description"]) for _id in data)
)
-class ObjectCategoryScopeDelete(Command):
- """List all Intra_Extensions."""
+class ObjectScopesDelete(Command):
+ """Delete an object scope."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(ObjectCategoryScopeDelete, self).get_parser(prog_name)
+ parser = super(ObjectScopesDelete, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'object_category_id',
+ metavar='<object-category-uuid>',
+ help='Object category UUID',
)
parser.add_argument(
- 'scope_id',
- metavar='<scope-uuid>',
- help='Scope UUID',
+ 'object_scope_id',
+ metavar='<object-scope-uuid>',
+ help='Object scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -115,8 +115,9 @@ class ObjectCategoryScopeDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_scopes/{}/{}".format(
parsed_args.intraextension,
- parsed_args.category,
- parsed_args.scope_id
+ parsed_args.object_category_id,
+ parsed_args.object_scope_id
),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/objects.py b/moonclient/moonclient/objects.py
index f4166fd0..0f6fef06 100644
--- a/moonclient/moonclient/objects.py
+++ b/moonclient/moonclient/objects.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class ObjectsList(Lister):
- """List all Intra_Extensions."""
+ """List all objects."""
log = logging.getLogger(__name__)
@@ -35,16 +35,16 @@ class ObjectsList(Lister):
class ObjectsAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new object."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(ObjectsAdd, self).get_parser(prog_name)
parser.add_argument(
- 'object_id',
- metavar='<object-id>',
- help='Object UUID',
+ 'object_name',
+ metavar='<object-name>',
+ help='Object name',
)
parser.add_argument(
'--intraextension',
@@ -63,9 +63,8 @@ class ObjectsAdd(Command):
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/objects".format(parsed_args.intraextension),
post_data={
- "object_name": parsed_args.object_id,
- "object_description": parsed_args.description,
- },
+ "object_name": parsed_args.object_name,
+ "object_description": parsed_args.description},
authtoken=True)
return (
("id", "name", "description"),
@@ -81,7 +80,7 @@ class ObjectsDelete(Command):
def get_parser(self, prog_name):
parser = super(ObjectsDelete, self).get_parser(prog_name)
parser.add_argument(
- 'object',
+ 'object_id',
metavar='<object-uuid>',
help='Object UUID',
)
@@ -97,7 +96,7 @@ class ObjectsDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/objects/{}".format(
parsed_args.intraextension,
- parsed_args.object
- ),
+ parsed_args.object_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/rules.py b/moonclient/moonclient/rules.py
index 6b4be6f8..dcf1a8f0 100644
--- a/moonclient/moonclient/rules.py
+++ b/moonclient/moonclient/rules.py
@@ -11,7 +11,7 @@ from cliff.show import ShowOne
class RulesList(Lister):
- """List all aggregation algorithms."""
+ """List all rules."""
log = logging.getLogger(__name__)
@@ -120,7 +120,7 @@ class RulesList(Lister):
class RuleAdd(Command):
- """List the current aggregation algorithm."""
+ """Add a new rule."""
log = logging.getLogger(__name__)
@@ -228,7 +228,7 @@ class RuleAdd(Command):
class RuleDelete(Command):
- """Set the current aggregation algorithm."""
+ """Delete a new rule."""
log = logging.getLogger(__name__)
diff --git a/moonclient/moonclient/shell.py b/moonclient/moonclient/shell.py
index 5efef032..60a5355f 100644
--- a/moonclient/moonclient/shell.py
+++ b/moonclient/moonclient/shell.py
@@ -84,6 +84,7 @@ class MoonClient(App):
if not self._tenant_id:
self._tenant_id = self.get_url("/v3/projects?name={}".format(self._tenant_name),
authtoken=True)["projects"][0]["id"]
+ # TODO: change '/v3/projects?name={}'
return self._tenant_id
@property
@@ -101,6 +102,7 @@ class MoonClient(App):
def get_tenant_uuid(self, tenant_name):
return self.get_url("/v3/projects?name={}".format(tenant_name), authtoken=True)["projects"][0]["id"]
+ # TODO: change '/v3/projects?name={}'
def get_url(self, url, post_data=None, delete_data=None, method="GET", authtoken=None):
if post_data:
diff --git a/moonclient/moonclient/subject_assignments.py b/moonclient/moonclient/subject_assignments.py
index 8978def5..5ca31291 100644
--- a/moonclient/moonclient/subject_assignments.py
+++ b/moonclient/moonclient/subject_assignments.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class SubjectAssignmentsList(Lister):
- """List all Intra_Extensions."""
+ """List all subject assignments."""
log = logging.getLogger(__name__)
@@ -22,9 +22,9 @@ class SubjectAssignmentsList(Lister):
help='Subject UUID',
)
parser.add_argument(
- 'category_id',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'subject_category_id',
+ metavar='<subject-category-uuid>',
+ help='Subject category UUID',
)
parser.add_argument(
'--intraextension',
@@ -33,27 +33,29 @@ class SubjectAssignmentsList(Lister):
)
return parser
- def __get_scope_from_id(self, intraextension_id, category_id, scope_id):
+ def __get_scope_from_id(self, intraextension_id, subject_category_id, subject_scope_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}".format(
- intraextension_id, category_id),
+ intraextension_id, subject_category_id),
authtoken=True)
- if scope_id in data:
- return data[scope_id]
+ if subject_scope_id in data:
+ return data[subject_scope_id]
def take_action(self, parsed_args):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_assignments/{}/{}".format(
- parsed_args.intraextension, parsed_args.subject_id, parsed_args.category_id),
+ parsed_args.intraextension, parsed_args.subject_id, parsed_args.subject_category_id),
authtoken=True)
return (
("id", "name"),
- ((_id, self.__get_scope_from_id(parsed_args.intraextension, parsed_args.category_id, _id)['name']) for _id in data)
+ ((_id, self.__get_scope_from_id(parsed_args.intraextension,
+ parsed_args.subject_category_id,
+ _id)['name']) for _id in data)
)
class SubjectAssignmentsAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new subject assignment."""
log = logging.getLogger(__name__)
@@ -65,14 +67,14 @@ class SubjectAssignmentsAdd(Command):
help='Subject UUID',
)
parser.add_argument(
- 'subject_category',
- metavar='<subject_category-uuid>',
- help='Subject Category',
+ 'subject_category_id',
+ metavar='<subject-category-uuid>',
+ help='Subject category id',
)
parser.add_argument(
- 'subject_category_scope',
- metavar='<subject_category_scope-uuid>',
- help='Subject Category Scope',
+ 'subject_scope_id',
+ metavar='<subject-scope-uuid>',
+ help='Subject scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -81,12 +83,12 @@ class SubjectAssignmentsAdd(Command):
)
return parser
- def __get_scope_from_id(self, intraextension_id, category_id, scope_id):
+ def __get_scope_from_id(self, intraextension_id, subject_category_id, subject_scope_id):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}".format(
- intraextension_id, category_id),
+ intraextension_id, subject_category_id),
authtoken=True)
- if scope_id in data:
- return data[scope_id]
+ if subject_scope_id in data:
+ return data[subject_scope_id]
def take_action(self, parsed_args):
if not parsed_args.intraextension:
@@ -94,18 +96,19 @@ class SubjectAssignmentsAdd(Command):
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_assignments".format(parsed_args.intraextension),
post_data={
"subject_id": parsed_args.subject_id,
- "subject_category_id": parsed_args.subject_category,
- "subject_scope_id": parsed_args.subject_category_scope
- },
+ "subject_category_id": parsed_args.subject_category_id,
+ "subject_scope_id": parsed_args.subject_scope_id},
authtoken=True)
return (
("id", "name"),
- ((_id, self.__get_scope_from_id(parsed_args.intraextension, parsed_args.category_id, _id)['name']) for _id in data)
+ ((_id, self.__get_scope_from_id(parsed_args.intraextension,
+ parsed_args.subject_category_id,
+ _id)['name']) for _id in data)
)
class SubjectAssignmentsDelete(Command):
- """List all Intra_Extensions."""
+ """Delete a subject assignment."""
log = logging.getLogger(__name__)
@@ -117,14 +120,14 @@ class SubjectAssignmentsDelete(Command):
help='Subject UUID',
)
parser.add_argument(
- 'subject_category',
- metavar='<subject_category>',
- help='Subject Category',
+ 'subject_category_id',
+ metavar='<subject-category-uuid>',
+ help='Subject category UUID',
)
parser.add_argument(
- 'subject_category_scope',
- metavar='<subject_category_scope>',
- help='Subject Category Scope',
+ 'subject_scope_id',
+ metavar='<subject-scope-uuid>',
+ help='Subject scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -139,8 +142,8 @@ class SubjectAssignmentsDelete(Command):
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_assignments/{}/{}/{}".format(
parsed_args.intraextension,
parsed_args.subject_id,
- parsed_args.subject_category,
- parsed_args.subject_category_scope
- ),
+ parsed_args.subject_category_id,
+ parsed_args.subject_scope_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/subject_categories.py b/moonclient/moonclient/subject_categories.py
index 274ab211..e7ecfe6a 100644
--- a/moonclient/moonclient/subject_categories.py
+++ b/moonclient/moonclient/subject_categories.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class SubjectCategoriesList(Lister):
- """List all Intra_Extensions."""
+ """List all subject categories."""
log = logging.getLogger(__name__)
@@ -35,16 +35,16 @@ class SubjectCategoriesList(Lister):
class SubjectCategoriesAdd(Command):
- """List all Intra_Extensions."""
+ """Add a new subject category."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(SubjectCategoriesAdd, self).get_parser(prog_name)
parser.add_argument(
- 'subject_category',
- metavar='<subject_category-uuid>',
- help='Subject UUID',
+ 'subject_category_name',
+ metavar='<subject_category-name>',
+ help='Subject category name',
)
parser.add_argument(
'--intraextension',
@@ -54,7 +54,7 @@ class SubjectCategoriesAdd(Command):
parser.add_argument(
'--description',
metavar='<description-str>',
- help='Category description',
+ help='Subject category description',
)
return parser
@@ -63,9 +63,8 @@ class SubjectCategoriesAdd(Command):
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_categories".format(parsed_args.intraextension),
post_data={
- "subject_category_name": parsed_args.subject_category,
- "subject_category_description": parsed_args.description,
- },
+ "subject_category_name": parsed_args.subject_category_name,
+ "subject_category_description": parsed_args.description},
authtoken=True)
return (
("id", "name", "description"),
@@ -74,16 +73,16 @@ class SubjectCategoriesAdd(Command):
class SubjectCategoriesDelete(Command):
- """List all Intra_Extensions."""
+ """Delete a subject category."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(SubjectCategoriesDelete, self).get_parser(prog_name)
parser.add_argument(
- 'subject_category',
+ 'subject_category_id',
metavar='<subject_category-uuid>',
- help='Subject UUID',
+ help='Subject category UUID',
)
parser.add_argument(
'--intraextension',
@@ -97,7 +96,7 @@ class SubjectCategoriesDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_categories/{}".format(
parsed_args.intraextension,
- parsed_args.subject_category
- ),
+ parsed_args.subject_category_id),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/subject_category_scope.py b/moonclient/moonclient/subject_scopes.py
index e6329c25..f960a1d0 100644
--- a/moonclient/moonclient/subject_category_scope.py
+++ b/moonclient/moonclient/subject_scopes.py
@@ -9,17 +9,17 @@ from cliff.lister import Lister
from cliff.command import Command
-class SubjectCategoryScopeList(Lister):
- """List all Intra_Extensions."""
+class SubjectScopesList(Lister):
+ """List all subject scopes."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(SubjectCategoryScopeList, self).get_parser(prog_name)
+ parser = super(SubjectScopesList, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'subject_category_id',
+ metavar='<subject-category-uuid>',
+ help='Subject category UUID',
)
parser.add_argument(
'--intraextension',
@@ -32,30 +32,31 @@ class SubjectCategoryScopeList(Lister):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}".format(
- parsed_args.intraextension, parsed_args.category),
- authtoken=True)
+ parsed_args.intraextension,
+ parsed_args.subject_category_id),
+ authtoken=True)
return (
("id", "name", "description"),
((_id, data[_id]["name"], data[_id]["description"]) for _id in data)
)
-class SubjectCategoryScopeAdd(Command):
- """List all Intra_Extensions."""
+class SubjectScopesAdd(Command):
+ """Add a new subject scope."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(SubjectCategoryScopeAdd, self).get_parser(prog_name)
+ parser = super(SubjectScopesAdd, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'subject_category_id',
+ metavar='<subject-category-uuid>',
+ help='Subject category UUID',
)
parser.add_argument(
- 'scope_name',
- metavar='<scope-str>',
- help='Scope Name',
+ 'subject_scope_name',
+ metavar='<subject-scope-str>',
+ help='Subject scope Name',
)
parser.add_argument(
'--description',
@@ -73,34 +74,34 @@ class SubjectCategoryScopeAdd(Command):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}".format(
- parsed_args.intraextension, parsed_args.category),
- post_data={
- "subject_scope_name": parsed_args.scope_name,
- "subject_scope_description": parsed_args.description,
- },
- authtoken=True)
+ parsed_args.intraextension, parsed_args.subject_category_id),
+ post_data={
+ "subject_scope_name": parsed_args.subject_scope_name,
+ "subject_scope_description": parsed_args.description,
+ },
+ authtoken=True)
return (
("id", "name", "description"),
((_id, data[_id]["name"], data[_id]["description"]) for _id in data)
)
-class SubjectCategoryScopeDelete(Command):
- """List all Intra_Extensions."""
+class SubjectScopesDelete(Command):
+ """Delete a subject scope."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
- parser = super(SubjectCategoryScopeDelete, self).get_parser(prog_name)
+ parser = super(SubjectScopesDelete, self).get_parser(prog_name)
parser.add_argument(
- 'category',
- metavar='<category-uuid>',
- help='Category UUID',
+ 'subject_category_id',
+ metavar='<subject-category-uuid>',
+ help='Subject category UUID',
)
parser.add_argument(
- 'scope_id',
- metavar='<scope-uuid>',
- help='Scope UUID',
+ 'subject_scope_id',
+ metavar='<subject-scope-uuid>',
+ help='Subject scope UUID',
)
parser.add_argument(
'--intraextension',
@@ -114,8 +115,9 @@ class SubjectCategoryScopeDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}/{}".format(
parsed_args.intraextension,
- parsed_args.category,
- parsed_args.scope_id
+ parsed_args.subject_category_id,
+ parsed_args.subject_scope_id
),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/subjects.py b/moonclient/moonclient/subjects.py
index 69286343..6eebcfb8 100644
--- a/moonclient/moonclient/subjects.py
+++ b/moonclient/moonclient/subjects.py
@@ -10,7 +10,7 @@ from cliff.command import Command
class SubjectsList(Lister):
- """List all Intra_Extensions."""
+ """List all subjects."""
log = logging.getLogger(__name__)
@@ -35,14 +35,14 @@ class SubjectsList(Lister):
class SubjectsAdd(Command):
- """List all Intra_Extensions."""
+ """add a new subject."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(SubjectsAdd, self).get_parser(prog_name)
parser.add_argument(
- 'subject',
+ 'subject_name',
metavar='<subject-name>',
help='Subject name',
)
@@ -51,13 +51,21 @@ class SubjectsAdd(Command):
metavar='<intraextension-uuid>',
help='IntraExtension UUID',
)
+ parser.add_argument(
+ '--description',
+ metavar='<description-str>',
+ help='Subject description',
+ )
return parser
def take_action(self, parsed_args):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subjects".format(parsed_args.intraextension),
- post_data={"subject_name": parsed_args.subject},
+ post_data={
+ "subject_name": parsed_args.subject_name,
+ "subject_description": parsed_args.description
+ },
authtoken=True)
return (
("id", "name", "Keystone ID"),
@@ -66,14 +74,14 @@ class SubjectsAdd(Command):
class SubjectsDelete(Command):
- """List all Intra_Extensions."""
+ """Delete a subject."""
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = super(SubjectsDelete, self).get_parser(prog_name)
parser.add_argument(
- 'subject',
+ 'subject_id',
metavar='<subject-uuid>',
help='Subject UUID',
)
@@ -89,7 +97,8 @@ class SubjectsDelete(Command):
parsed_args.intraextension = self.app.intraextension
self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subjects/{}".format(
parsed_args.intraextension,
- parsed_args.subject
- ),
+ parsed_args.subject_id
+ ),
method="DELETE",
- authtoken=True) \ No newline at end of file
+ authtoken=True
+ ) \ No newline at end of file
diff --git a/moonclient/moonclient/tenants.py b/moonclient/moonclient/tenants.py
index cc7c1de0..c1f99af6 100644
--- a/moonclient/moonclient/tenants.py
+++ b/moonclient/moonclient/tenants.py
@@ -29,8 +29,8 @@ class TenantList(Lister):
tenants[tenant_id]["description"],
tenants[tenant_id]["intra_authz_extension_id"],
tenants[tenant_id]["intra_admin_extension_id"],
- )
- for tenant_id in tenants)
+ )
+ for tenant_id in tenants)
)
@@ -73,8 +73,8 @@ class TenantAdd(Command):
if parsed_args.desc:
post_data["tenant_description"] = parsed_args.desc
tenants = self.app.get_url("/v3/OS-MOON/tenants",
- post_data=post_data,
- authtoken=True)
+ post_data=post_data,
+ authtoken=True)
return (
("id", "name", "description", "intra_authz_extension_id", "intra_admin_extension_id"),
((
@@ -83,13 +83,13 @@ class TenantAdd(Command):
tenants[tenant_id]["description"],
tenants[tenant_id]["intra_authz_extension_id"],
tenants[tenant_id]["intra_admin_extension_id"],
- )
+ )
for tenant_id in tenants)
)
class TenantShow(Command):
- """Show information about a tenant."""
+ """Show information of one tenant."""
log = logging.getLogger(__name__)
@@ -104,7 +104,7 @@ class TenantShow(Command):
def take_action(self, parsed_args):
tenants = self.app.get_url("/v3/OS-MOON/tenants/{}".format(parsed_args.tenant_name),
- authtoken=True)
+ authtoken=True)
return (
("id", "name", "description", "intra_authz_extension_id", "intra_admin_extension_id"),
((
@@ -113,7 +113,7 @@ class TenantShow(Command):
tenants[tenant_id]["description"],
tenants[tenant_id]["intra_authz_extension_id"],
tenants[tenant_id]["intra_admin_extension_id"],
- )
+ )
for tenant_id in tenants)
)
@@ -164,8 +164,8 @@ class TenantSet(Command):
if parsed_args.desc is not None:
post_data["tenant_description"] = parsed_args.desc
tenants = self.app.get_url("/v3/OS-MOON/tenants/{}".format(post_data["tenant_id"]),
- post_data=post_data,
- authtoken=True)
+ post_data=post_data,
+ authtoken=True)
return (
("id", "name", "description", "authz", "admin"),
((
@@ -174,13 +174,13 @@ class TenantSet(Command):
tenants[tenant_id]["description"],
tenants[tenant_id]["intra_authz_extension_id"],
tenants[tenant_id]["intra_admin_extension_id"],
- )
+ )
for tenant_id in tenants)
)
class TenantDelete(Command):
- """Modify a tenant."""
+ """Delete a tenant."""
log = logging.getLogger(__name__)
@@ -195,5 +195,5 @@ class TenantDelete(Command):
def take_action(self, parsed_args):
self.app.get_url("/v3/OS-MOON/tenants/{}".format(parsed_args.tenant_id),
- method="DELETE",
- authtoken=True)
+ method="DELETE",
+ authtoken=True)
diff --git a/moonclient/setup.py b/moonclient/setup.py
index b2bf612b..5e090529 100644
--- a/moonclient/setup.py
+++ b/moonclient/setup.py
@@ -58,9 +58,9 @@ setup(
'moon = moonclient.shell:main'
],
'moon.client': [
- 'templates_list = moonclient.configuration:TemplatesList',
- 'aggregation_algorithms_list = moonclient.configuration:AggregationAlgorithmsList',
- 'submetarule_algorithms_list = moonclient.configuration:SubMetaRuleAlgorithmsList',
+ 'template_list = moonclient.configuration:TemplatesList',
+ 'aggregation_algorithm_list = moonclient.configuration:AggregationAlgorithmsList',
+ 'submetarule_algorithm_list = moonclient.configuration:SubMetaRuleAlgorithmsList',
'tenant_add = moonclient.tenants:TenantAdd',
'tenant_set = moonclient.tenants:TenantSet',
@@ -83,15 +83,6 @@ setup(
'action_list = moonclient.actions:ActionsList',
'action_add = moonclient.actions:ActionsAdd',
'action_delete = moonclient.actions:ActionsDelete',
- 'action_assignment_list = moonclient.action_assignments:ActionAssignmentsList',
- 'action_assignment_add = moonclient.action_assignments:ActionAssignmentsAdd',
- 'action_assignment_delete = moonclient.action_assignments:ActionAssignmentsDelete',
- 'object_assignment_list = moonclient.object_assignments:ObjectAssignmentsList',
- 'object_assignment_add = moonclient.object_assignments:ObjectAssignmentsAdd',
- 'object_assignment_delete = moonclient.object_assignments:ObjectAssignmentsDelete',
- 'subject_assignment_list = moonclient.subject_assignments:SubjectAssignmentsList',
- 'subject_assignment_add = moonclient.subject_assignments:SubjectAssignmentsAdd',
- 'subject_assignment_delete = moonclient.subject_assignments:SubjectAssignmentsDelete',
'subject_category_list = moonclient.subject_categories:SubjectCategoriesList',
'subject_category_add = moonclient.subject_categories:SubjectCategoriesAdd',
'subject_category_delete = moonclient.subject_categories:SubjectCategoriesDelete',
@@ -101,15 +92,24 @@ setup(
'action_category_list = moonclient.action_categories:ActionCategoriesList',
'action_category_add = moonclient.action_categories:ActionCategoriesAdd',
'action_category_delete = moonclient.action_categories:ActionCategoriesDelete',
- 'subject_scope_list = moonclient.subject_category_scope:SubjectCategoryScopeList',
- 'subject_scope_add = moonclient.subject_category_scope:SubjectCategoryScopeAdd',
- 'subject_scope_delete = moonclient.subject_category_scope:SubjectCategoryScopeDelete',
- 'object_scope_list = moonclient.object_category_scope:ObjectCategoryScopeList',
- 'object_scope_add = moonclient.object_category_scope:ObjectCategoryScopeAdd',
- 'object_scope_delete = moonclient.object_category_scope:ObjectCategoryScopeDelete',
- 'action_scope_list = moonclient.action_category_scope:ActionCategoryScopeList',
- 'action_scope_add = moonclient.action_category_scope:ActionCategoryScopeAdd',
- 'action_scope_delete = moonclient.action_category_scope:ActionCategoryScopeDelete',
+ 'subject_scope_list = moonclient.subject_scope:SubjectScopesList',
+ 'subject_scope_add = moonclient.subject_scope:SubjectScopesAdd',
+ 'subject_scope_delete = moonclient.subject_scope:SubjectScopesDelete',
+ 'object_scope_list = moonclient.object_scope:ObjectScopesList',
+ 'object_scope_add = moonclient.object_scope:ObjectScopesAdd',
+ 'object_scope_delete = moonclient.object_scope:ObjectScopesDelete',
+ 'action_scope_list = moonclient.action_scope:ActionScopesList',
+ 'action_scope_add = moonclient.action_scope:ActionScopesAdd',
+ 'action_scope_delete = moonclient.action_scope:ActionScopesDelete',
+ 'subject_assignment_list = moonclient.subject_assignments:SubjectAssignmentsList',
+ 'subject_assignment_add = moonclient.subject_assignments:SubjectAssignmentsAdd',
+ 'subject_assignment_delete = moonclient.subject_assignments:SubjectAssignmentsDelete',
+ 'object_assignment_list = moonclient.object_assignments:ObjectAssignmentsList',
+ 'object_assignment_add = moonclient.object_assignments:ObjectAssignmentsAdd',
+ 'object_assignment_delete = moonclient.object_assignments:ObjectAssignmentsDelete',
+ 'action_assignment_list = moonclient.action_assignments:ActionAssignmentsList',
+ 'action_assignment_add = moonclient.action_assignments:ActionAssignmentsAdd',
+ 'action_assignment_delete = moonclient.action_assignments:ActionAssignmentsDelete',
'aggregation_algorithm_show = moonclient.metarules:AggregationAlgorithmsList',
'aggregation_algorithm_set = moonclient.metarules:AggregationAlgorithmSet',
@@ -124,7 +124,7 @@ setup(
'log = moonclient.logs:LogsList',
- 'tests = moonclient.tests:TestsLaunch',
+ 'test = moonclient.tests:TestsLaunch',
],
},