<s> """<STR_LIT>""" <EOL> import six <EOL> import sys <EOL> from openstackclient . common import command <EOL> from openstackclient . common import utils <EOL> class CreateServiceProvider ( command . ShowOne ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( CreateServiceProvider , 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> required = True , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> ) <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> required = True , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> ) <EOL> enable_service_provider = parser . add_mutually_exclusive_group ( ) <EOL> enable_service_provider . add_argument ( <EOL> '<STR_LIT>' , <EOL> dest = '<STR_LIT>' , <EOL> action = '<STR_LIT:store_true>' , <EOL> default = True , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> enable_service_provider . add_argument ( <EOL> '<STR_LIT>' , <EOL> dest = '<STR_LIT>' , <EOL> action = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> service_client = self . app . client_manager . identity <EOL> sp = service_client . federation . service_providers . create ( <EOL> id = parsed_args . service_provider_id , <EOL> auth_url = parsed_args . auth_url , <EOL> description = parsed_args . description , <EOL> enabled = parsed_args . enabled , <EOL> sp_url = parsed_args . service_provider_url ) <EOL> sp . _info . pop ( '<STR_LIT>' , None ) <EOL> return zip ( * sorted ( six . iteritems ( sp . _info ) ) ) <EOL> class DeleteServiceProvider ( command . Command ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( DeleteServiceProvider , 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> service_client = self . app . client_manager . identity <EOL> service_client . federation . service_providers . delete ( <EOL> parsed_args . service_provider ) <EOL> class ListServiceProvider ( command . Lister ) : <EOL> """<STR_LIT>""" <EOL> def take_action ( self , parsed_args ) : <EOL> service_client = self . app . client_manager . identity <EOL> data = service_client . federation . service_providers . list ( ) <EOL> column_headers = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> return ( column_headers , <EOL> ( utils . get_item_properties ( <EOL> s , column_headers , <EOL> formatters = { } , <EOL> ) for s in data ) ) <EOL> class SetServiceProvider ( command . Command ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( SetServiceProvider , 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> 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> enable_service_provider = parser . add_mutually_exclusive_group ( ) <EOL> enable_service_provider . add_argument ( <EOL> '<STR_LIT>' , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> enable_service_provider . add_argument ( <EOL> '<STR_LIT>' , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' , <EOL> ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> federation_client = self . app . client_manager . identity . federation <EOL> enabled = None <EOL> if parsed_args . enable is True : <EOL> enabled = True <EOL> elif parsed_args . disable is True : <EOL> enabled = False <EOL> if not any ( ( enabled is not None , parsed_args . description , <EOL> parsed_args . service_provider_url , <EOL> parsed_args . auth_url ) ) : <EOL> sys . stdout . write ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return ( None , None ) <EOL> service_provider = federation_client . service_providers . update ( <EOL> parsed_args . service_provider , enabled = enabled , <EOL> description = parsed_args . description , <EOL> auth_url = parsed_args . auth_url , <EOL> sp_url = parsed_args . service_provider_url ) <EOL> return zip ( * sorted ( six . iteritems ( service_provider . _info ) ) ) <EOL> class ShowServiceProvider ( command . ShowOne ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( ShowServiceProvider , 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> service_client = self . app . client_manager . identity <EOL> service_provider = utils . find_resource ( <EOL> service_client . federation . service_providers , <EOL> parsed_args . service_provider ) <EOL> service_provider . _info . pop ( '<STR_LIT>' , None ) <EOL> return zip ( * sorted ( six . iteritems ( service_provider . _info ) ) ) </s>
