#NEWLINE# def create( self , plan , **kwargs ) : #NEWLINE# #INDENT# kwargs = self . _filter_kwargs ( kwargs ) #NEWLINE# kwargs [ 'data' ] = plan #NEWLINE# kwargs . setdefault ( 'headers' , kwargs . get ( 'headers' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# kwargs [ 'headers' ] [ 'Content-Type' ] = 'x-application/yaml' #NEWLINE# try : #NEWLINE# #INDENT# resp = self . client . post ( self . build_url ( base_url = '/v1' , ** kwargs ) , ** kwargs ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# message = vars ( e ) . get ( 'details' , str ( e ) ) #NEWLINE# raise exceptions . BadRequest ( message = message ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# resp_plan = yamlutils . load ( resp . content ) #NEWLINE# #UNINDENT# except ValueError as e : #NEWLINE# #INDENT# raise exc . CommandException ( message = ( 'Could not load Plan. Reason: %s' % e . message ) ) #NEWLINE# #UNINDENT# return Plan ( self , resp_plan )