<s> from cerberusclient . common import base <EOL> from cerberusclient . v1 import base as v1_base <EOL> class Task ( base . Resource ) : <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % self . _info <EOL> def data ( self , ** kwargs ) : <EOL> return self . manager . data ( self , ** kwargs ) <EOL> class TaskManager ( v1_base . BaseManager ) : <EOL> resource_class = Task <EOL> def __init__ ( self , api ) : <EOL> super ( TaskManager , self ) . __init__ ( api ) <EOL> self . url = self . url_prefix + '<STR_LIT>' <EOL> def list ( self ) : <EOL> return self . _list ( self . url , '<STR_LIT>' ) <EOL> def get ( self , task_id ) : <EOL> return self . _get ( self . url + '<STR_LIT>' . format ( id = task_id ) ) <EOL> def create ( self , plugin_id , method , name = '<STR_LIT>' , type = '<STR_LIT>' , <EOL> period = None , persistent = '<STR_LIT:False>' ) : <EOL> data = { } <EOL> data [ '<STR_LIT>' ] = method <EOL> data [ '<STR_LIT:name>' ] = name <EOL> data [ '<STR_LIT:type>' ] = type <EOL> data [ '<STR_LIT>' ] = period <EOL> data [ '<STR_LIT>' ] = plugin_id <EOL> data [ '<STR_LIT>' ] = persistent <EOL> return self . _create ( self . url , <EOL> data = data ) <EOL> def stop ( self , task_id ) : <EOL> return self . _act ( self . url + '<STR_LIT>' . format ( id = task_id ) <EOL> + '<STR_LIT>' , <EOL> { } ) <EOL> def delete ( self , task_id ) : <EOL> return self . _delete ( self . url + '<STR_LIT>' . format ( id = task_id ) ) <EOL> def force_delete ( self , task_id ) : <EOL> return self . _act ( self . url + '<STR_LIT>' . format ( id = task_id ) <EOL> + '<STR_LIT>' , <EOL> { } ) <EOL> def restart ( self , task_id ) : <EOL> return self . _act ( self . url + '<STR_LIT>' . format ( id = task_id ) <EOL> + '<STR_LIT>' , <EOL> { } ) </s>
