<s> from neutronclient . _i18n import _ <EOL> from neutronclient . neutron import v2_0 as neutronV20 <EOL> RBAC_OBJECTS = { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' } } <EOL> def _get_cmd_resource ( obj_type ) : <EOL> resource = list ( RBAC_OBJECTS [ obj_type ] ) [ <NUM_LIT:0> ] <EOL> cmd_resource = RBAC_OBJECTS [ obj_type ] [ resource ] <EOL> return resource , cmd_resource <EOL> def get_rbac_obj_params ( client , obj_type , obj_id_or_name ) : <EOL> resource , cmd_resource = _get_cmd_resource ( obj_type ) <EOL> obj_id = neutronV20 . find_resourceid_by_name_or_id ( <EOL> client = client , resource = resource , name_or_id = obj_id_or_name , <EOL> cmd_resource = cmd_resource ) <EOL> return obj_id , cmd_resource <EOL> class ListRBACPolicy ( neutronV20 . ListCommand ) : <EOL> """<STR_LIT>""" <EOL> resource = '<STR_LIT>' <EOL> list_columns = [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> pagination_support = True <EOL> sorting_support = True <EOL> allow_names = False <EOL> class ShowRBACPolicy ( neutronV20 . ShowCommand ) : <EOL> """<STR_LIT>""" <EOL> resource = '<STR_LIT>' <EOL> allow_names = False <EOL> class CreateRBACPolicy ( neutronV20 . CreateCommand ) : <EOL> """<STR_LIT>""" <EOL> resource = '<STR_LIT>' <EOL> def add_known_arguments ( self , parser ) : <EOL> parser . add_argument ( <EOL> '<STR_LIT:name>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = _ ( '<STR_LIT>' ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , choices = RBAC_OBJECTS . keys ( ) , <EOL> required = True , <EOL> help = _ ( '<STR_LIT>' ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> help = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , choices = [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> required = True , <EOL> help = _ ( '<STR_LIT>' ) ) <EOL> def args2body ( self , parsed_args ) : <EOL> neutron_client = self . get_client ( ) <EOL> neutron_client . format = parsed_args . request_format <EOL> _object_id , _object_type = get_rbac_obj_params ( neutron_client , <EOL> parsed_args . type , <EOL> parsed_args . name ) <EOL> body = { <EOL> '<STR_LIT>' : _object_id , <EOL> '<STR_LIT>' : _object_type , <EOL> '<STR_LIT>' : parsed_args . target_tenant , <EOL> '<STR_LIT:action>' : parsed_args . action , <EOL> } <EOL> return { self . resource : body } <EOL> class UpdateRBACPolicy ( neutronV20 . UpdateCommand ) : <EOL> """<STR_LIT>""" <EOL> resource = '<STR_LIT>' <EOL> allow_names = False <EOL> def add_known_arguments ( self , parser ) : <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> help = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> def args2body ( self , parsed_args ) : <EOL> body = { '<STR_LIT>' : parsed_args . target_tenant } <EOL> return { self . resource : body } <EOL> class DeleteRBACPolicy ( neutronV20 . DeleteCommand ) : <EOL> """<STR_LIT>""" <EOL> resource = '<STR_LIT>' <EOL> allow_names = False </s>
