<s> """<STR_LIT>""" <EOL> import six <EOL> import sys <EOL> from openstackclient . common import command <EOL> from openstackclient . common import utils <EOL> class CreateConsumer ( command . ShowOne ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( CreateConsumer , self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> identity_client = self . app . client_manager . identity <EOL> consumer = identity_client . oauth1 . consumers . create ( <EOL> parsed_args . description <EOL> ) <EOL> consumer . _info . pop ( '<STR_LIT>' , None ) <EOL> return zip ( * sorted ( six . iteritems ( consumer . _info ) ) ) <EOL> class DeleteConsumer ( command . Command ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( DeleteConsumer , self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> identity_client = self . app . client_manager . identity <EOL> consumer = utils . find_resource ( <EOL> identity_client . oauth1 . consumers , parsed_args . consumer ) <EOL> identity_client . oauth1 . consumers . delete ( consumer . id ) <EOL> class ListConsumer ( command . Lister ) : <EOL> """<STR_LIT>""" <EOL> def take_action ( self , parsed_args ) : <EOL> columns = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> data = self . app . client_manager . identity . oauth1 . consumers . list ( ) <EOL> return ( columns , <EOL> ( utils . get_item_properties ( <EOL> s , columns , <EOL> formatters = { } , <EOL> ) for s in data ) ) <EOL> class SetConsumer ( command . Command ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( SetConsumer , self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> identity_client = self . app . client_manager . identity <EOL> consumer = utils . find_resource ( <EOL> identity_client . oauth1 . consumers , parsed_args . consumer ) <EOL> kwargs = { } <EOL> if parsed_args . description : <EOL> kwargs [ '<STR_LIT:description>' ] = parsed_args . description <EOL> if not len ( kwargs ) : <EOL> sys . stdout . write ( '<STR_LIT>' ) <EOL> return <EOL> consumer = identity_client . oauth1 . consumers . update ( <EOL> consumer . id , ** kwargs ) <EOL> class ShowConsumer ( command . ShowOne ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( ShowConsumer , self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> identity_client = self . app . client_manager . identity <EOL> consumer = utils . find_resource ( <EOL> identity_client . oauth1 . consumers , parsed_args . consumer ) <EOL> consumer . _info . pop ( '<STR_LIT>' , None ) <EOL> return zip ( * sorted ( six . iteritems ( consumer . _info ) ) ) </s>
