<s> from monascaclient . common import monasca_manager <EOL> from monascaclient . openstack . common . apiclient import base <EOL> from monascaclient . openstack . common . py3kcompat import urlutils <EOL> class Metrics ( base . Resource ) : <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % self . _info <EOL> class MetricsManager ( monasca_manager . MonascaManager ) : <EOL> resource_class = Metrics <EOL> base_url = '<STR_LIT>' <EOL> def create ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> url_str = self . base_url <EOL> newheaders = self . get_headers ( ) <EOL> if '<STR_LIT>' in kwargs : <EOL> url_str = url_str + '<STR_LIT>' % kwargs [ '<STR_LIT>' ] <EOL> del kwargs [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in kwargs : <EOL> resp , body = self . client . json_request ( '<STR_LIT:POST>' , url_str , <EOL> data = kwargs [ '<STR_LIT>' ] , <EOL> headers = newheaders ) <EOL> else : <EOL> resp , body = self . client . json_request ( '<STR_LIT:POST>' , url_str , <EOL> data = kwargs , <EOL> headers = newheaders ) <EOL> return resp <EOL> def list ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> url_str = self . base_url <EOL> newheaders = self . get_headers ( ) <EOL> if '<STR_LIT>' in kwargs : <EOL> dimstr = self . get_dimensions_url_string ( kwargs [ '<STR_LIT>' ] ) <EOL> kwargs [ '<STR_LIT>' ] = dimstr <EOL> if kwargs : <EOL> url_str = url_str + '<STR_LIT>' % urlutils . urlencode ( kwargs , True ) <EOL> resp , body = self . client . json_request ( <EOL> '<STR_LIT:GET>' , url_str , headers = newheaders ) <EOL> return body [ '<STR_LIT>' ] if type ( body ) is dict else body <EOL> def list_names ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> url_str = self . base_url + '<STR_LIT>' <EOL> newheaders = self . get_headers ( ) <EOL> if '<STR_LIT>' in kwargs : <EOL> dimstr = self . get_dimensions_url_string ( kwargs [ '<STR_LIT>' ] ) <EOL> kwargs [ '<STR_LIT>' ] = dimstr <EOL> if kwargs : <EOL> url_str = url_str + '<STR_LIT>' % urlutils . urlencode ( kwargs , True ) <EOL> resp , body = self . client . json_request ( <EOL> '<STR_LIT:GET>' , url_str , headers = newheaders ) <EOL> return body [ '<STR_LIT>' ] if type ( body ) is dict else body <EOL> def list_measurements ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> url_str = self . base_url + '<STR_LIT>' <EOL> newheaders = self . get_headers ( ) <EOL> if '<STR_LIT>' in kwargs : <EOL> dimstr = self . get_dimensions_url_string ( kwargs [ '<STR_LIT>' ] ) <EOL> kwargs [ '<STR_LIT>' ] = dimstr <EOL> if kwargs : <EOL> url_str = url_str + '<STR_LIT>' % urlutils . urlencode ( kwargs , True ) <EOL> resp , body = self . client . json_request ( <EOL> '<STR_LIT:GET>' , url_str , headers = newheaders ) <EOL> return body [ '<STR_LIT>' ] if type ( body ) is dict else body <EOL> def list_statistics ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> url_str = self . base_url + '<STR_LIT>' <EOL> newheaders = self . get_headers ( ) <EOL> if '<STR_LIT>' in kwargs : <EOL> dimstr = self . get_dimensions_url_string ( kwargs [ '<STR_LIT>' ] ) <EOL> kwargs [ '<STR_LIT>' ] = dimstr <EOL> if kwargs : <EOL> url_str = url_str + '<STR_LIT>' % urlutils . urlencode ( kwargs , True ) <EOL> resp , body = self . client . json_request ( <EOL> '<STR_LIT:GET>' , url_str , headers = newheaders ) <EOL> return body [ '<STR_LIT>' ] if type ( body ) is dict else body </s>
