Command doc: mapping
Also tweaked the code for `mapping set` as it was previously using cliff Show instead of cliff Command. Change-Id: I0ea1383a9f2dddf4b2f717b2aa16bbd60ab1720c
This commit is contained in:
parent
6b196d1a17
commit
e8be3b64c1
91
doc/source/command-objects/mapping.rst
Normal file
91
doc/source/command-objects/mapping.rst
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
=======
|
||||||
|
mapping
|
||||||
|
=======
|
||||||
|
|
||||||
|
Identity v3
|
||||||
|
|
||||||
|
`Requires: OS-FEDERATION extension`
|
||||||
|
|
||||||
|
mapping create
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Create new mapping
|
||||||
|
|
||||||
|
.. program:: mapping create
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
os mapping create
|
||||||
|
--rules <filename>
|
||||||
|
<name>
|
||||||
|
|
||||||
|
.. option:: --rules <filename>
|
||||||
|
|
||||||
|
Filename that contains a set of mapping rules (required)
|
||||||
|
|
||||||
|
.. _mapping_create-mapping:
|
||||||
|
.. describe:: <name>
|
||||||
|
|
||||||
|
New mapping name (must be unique)
|
||||||
|
|
||||||
|
mapping delete
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Delete a mapping
|
||||||
|
|
||||||
|
.. program:: mapping delete
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
os mapping delete
|
||||||
|
<mapping>
|
||||||
|
|
||||||
|
.. _mapping_delete-mapping:
|
||||||
|
.. describe:: <mapping>
|
||||||
|
|
||||||
|
Mapping to delete
|
||||||
|
|
||||||
|
mapping list
|
||||||
|
------------
|
||||||
|
|
||||||
|
List mappings
|
||||||
|
|
||||||
|
.. program:: mapping list
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
os mapping list
|
||||||
|
|
||||||
|
mapping set
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Set mapping properties
|
||||||
|
|
||||||
|
.. program:: mapping set
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
os mapping set
|
||||||
|
[--rules <filename>]
|
||||||
|
<mapping>
|
||||||
|
|
||||||
|
.. option:: --rules <filename>
|
||||||
|
|
||||||
|
Filename that contains a new set of mapping rules
|
||||||
|
|
||||||
|
.. _mapping_set-mapping:
|
||||||
|
.. describe:: <mapping>
|
||||||
|
|
||||||
|
Mapping to modify
|
||||||
|
|
||||||
|
mapping show
|
||||||
|
------------
|
||||||
|
|
||||||
|
Display mapping details
|
||||||
|
|
||||||
|
.. program:: mapping show
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
os mapping show
|
||||||
|
<mapping>
|
||||||
|
|
||||||
|
.. _mapping_show-mapping:
|
||||||
|
.. describe:: <mapping>
|
||||||
|
|
||||||
|
Mapping to display
|
@ -93,6 +93,7 @@ referring to both Compute and Volume quotas.
|
|||||||
* ``ip floating``: Compute, Network - a public IP address that can be mapped to a server
|
* ``ip floating``: Compute, Network - a public IP address that can be mapped to a server
|
||||||
* ``keypair``: (**Compute**) an SSH public key
|
* ``keypair``: (**Compute**) an SSH public key
|
||||||
* ``limits``: (**Compute**, **Volume**) resource usage limits
|
* ``limits``: (**Compute**, **Volume**) resource usage limits
|
||||||
|
* ``mapping``: (**Identity**) a definition to translate identity provider attributes to Identity concepts
|
||||||
* ``module``: internal - installed Python modules in the OSC process
|
* ``module``: internal - installed Python modules in the OSC process
|
||||||
* ``network``: Network - a virtual network for connecting servers and other resources
|
* ``network``: Network - a virtual network for connecting servers and other resources
|
||||||
* ``object``: (**Object Store**) a single file in the Object Store
|
* ``object``: (**Object Store**) a single file in the Object Store
|
||||||
|
@ -80,7 +80,7 @@ class _RulesReader(object):
|
|||||||
|
|
||||||
|
|
||||||
class CreateMapping(show.ShowOne, _RulesReader):
|
class CreateMapping(show.ShowOne, _RulesReader):
|
||||||
"""Create new federation mapping"""
|
"""Create new mapping"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.CreateMapping')
|
log = logging.getLogger(__name__ + '.CreateMapping')
|
||||||
|
|
||||||
@ -89,12 +89,12 @@ class CreateMapping(show.ShowOne, _RulesReader):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'mapping',
|
'mapping',
|
||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
help='New mapping (must be unique)',
|
help='New mapping name (must be unique)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--rules',
|
'--rules',
|
||||||
metavar='<rules>', required=True,
|
metavar='<filename>', required=True,
|
||||||
help='Filename with rules',
|
help='Filename that contains a set of mapping rules (required)',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class CreateMapping(show.ShowOne, _RulesReader):
|
|||||||
|
|
||||||
|
|
||||||
class DeleteMapping(command.Command):
|
class DeleteMapping(command.Command):
|
||||||
"""Delete federation mapping"""
|
"""Delete a mapping"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.DeleteMapping')
|
log = logging.getLogger(__name__ + '.DeleteMapping')
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ class DeleteMapping(command.Command):
|
|||||||
parser = super(DeleteMapping, self).get_parser(prog_name)
|
parser = super(DeleteMapping, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'mapping',
|
'mapping',
|
||||||
metavar='<name>',
|
metavar='<mapping>',
|
||||||
help='Mapping to delete',
|
help='Mapping to delete',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
@ -134,7 +134,7 @@ class DeleteMapping(command.Command):
|
|||||||
|
|
||||||
|
|
||||||
class ListMapping(lister.Lister):
|
class ListMapping(lister.Lister):
|
||||||
"""List federation mappings"""
|
"""List mappings"""
|
||||||
log = logging.getLogger(__name__ + '.ListMapping')
|
log = logging.getLogger(__name__ + '.ListMapping')
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -149,8 +149,8 @@ class ListMapping(lister.Lister):
|
|||||||
return (columns, items)
|
return (columns, items)
|
||||||
|
|
||||||
|
|
||||||
class SetMapping(show.ShowOne, _RulesReader):
|
class SetMapping(command.Command, _RulesReader):
|
||||||
"""Update federation mapping"""
|
"""Set mapping properties"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.SetMapping')
|
log = logging.getLogger(__name__ + '.SetMapping')
|
||||||
|
|
||||||
@ -159,12 +159,12 @@ class SetMapping(show.ShowOne, _RulesReader):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'mapping',
|
'mapping',
|
||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
help='Mapping to update.',
|
help='Mapping to modify',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--rules',
|
'--rules',
|
||||||
metavar='<rules>', required=True,
|
metavar='<filename>',
|
||||||
help='Filename with rules',
|
help='Filename that contains a new set of mapping rules',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -172,19 +172,22 @@ class SetMapping(show.ShowOne, _RulesReader):
|
|||||||
self.log.debug('take_action(%s)' % parsed_args)
|
self.log.debug('take_action(%s)' % parsed_args)
|
||||||
identity_client = self.app.client_manager.identity
|
identity_client = self.app.client_manager.identity
|
||||||
|
|
||||||
|
if not parsed_args.rules:
|
||||||
|
self.app.log.error("No changes requested")
|
||||||
|
return
|
||||||
|
|
||||||
rules = self._read_rules(parsed_args.rules)
|
rules = self._read_rules(parsed_args.rules)
|
||||||
|
|
||||||
mapping = identity_client.federation.mappings.update(
|
mapping = identity_client.federation.mappings.update(
|
||||||
mapping=parsed_args.mapping,
|
mapping=parsed_args.mapping,
|
||||||
rules=rules)
|
rules=rules)
|
||||||
|
|
||||||
info = {}
|
mapping._info.pop('links', None)
|
||||||
info.update(mapping._info)
|
return zip(*sorted(six.iteritems(mapping._info)))
|
||||||
return zip(*sorted(six.iteritems(info)))
|
|
||||||
|
|
||||||
|
|
||||||
class ShowMapping(show.ShowOne):
|
class ShowMapping(show.ShowOne):
|
||||||
"""Show federation mapping details"""
|
"""Display mapping details"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + '.ShowMapping')
|
log = logging.getLogger(__name__ + '.ShowMapping')
|
||||||
|
|
||||||
@ -192,8 +195,8 @@ class ShowMapping(show.ShowOne):
|
|||||||
parser = super(ShowMapping, self).get_parser(prog_name)
|
parser = super(ShowMapping, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'mapping',
|
'mapping',
|
||||||
metavar='<name>',
|
metavar='<mapping>',
|
||||||
help='Mapping to show',
|
help='Mapping to display',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user