Current File : //usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pyc
�
��Xc@s�ddlZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZd	eefd
��YZdS(i����N(tArg(t
ArgumentError(tTabifyingMixin(tPaginatedResponse(tdelimited_list(tCloudWatchRequest(tcloudwatch_dimensiontGetMetricStatisticscBsLeZdZeddddd�edddd	d
edd�edd
ddd
eddded�dd�eddddddedde�dd�eddddddd�eddddddd�eddd dd!ded"d#dd$�ed%dd&dd'�gZd(gZ	d)�Z
d*�Zd+�Zd,�Z
d-�ZRS(.sShow a metric's statisticst
MetricNametmetavartMETRICthelps3name of the metric to get statistics for (required)s-ns--namespacetdestt	Namespacetrequireds!the metric's namespace (required)s-ss--statisticssStatistics.membersSTAT1,STAT2,...ttypet,s3the metric statistics to show (at least 1 required)s--dimensionssDimensions.membersKEY1=VALUE1,KEY2=VALUE2,...t	item_types$the dimensions of the metric to shows--start-timet	StartTimesYYYY-MM-DDThh:mm:ssZsQearliest time to
                retrieve data points for (default: one hour ago)s
--end-timetEndTimesFlatest time to retrieve
                data points for (default: now)s--periodtPeriodtSECONDStdefaulti<s`granularity of the returned data
                points (must be a multiple of 60) (default: 60)s--unittUnitsunit the metric is reported int
DatapointscCsntj|�|jjd�rj|jddkrAtd��qj|jdddkrjtd��qjndS(Ntperiodis)argument --period: value must be positivei<s1argument --period: value must be a multiple of 60(Rt	configuretargstgetR(tself((sU/usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pyR@s
cCs�tjj�}|tjdd�}|jjd�sP|jd�|jd<n|jjd�s{|jd�|jd<nt|dd�S(	NthoursiRs%Y-%m-%dT%H:%M:%SZRR(N(R(	tdatetimetutcnowt	timedeltaRRtstrftimetparamsRtNone(Rtnowtthen((sU/usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pytmainJscCs||jd<dS(Nt	NextToken(R#(Rtpage((sU/usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pytprepare_for_pageUscCs|jd�pdS(NR((RR$(Rtresponse((sU/usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pyt
get_next_pageZsc
Cs�g}x�|jdg�D]�}|jdd�}y(tjj|d�}|jd�}Wntk
rlnX|j||jd�|jd�|jd�|jd	�|jd
�|jd�f�qWx"t|�D]}|j|�GHq�WdS(NRt	Timestampts%Y-%m-%dT%H:%M:%SZs%Y-%m-%d %H:%M:%StSampleCounttAveragetSumtMinimumtMaximumR(RRtstrptimeR"t
ValueErrortappendtsortedttabify(Rtresulttpointstpointt	timestamptparsed((sU/usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pytprint_result^s	
(t__name__t
__module__tDESCRIPTIONRtTrueRRtinttARGSt	LIST_TAGSRR'R*R,R>(((sU/usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pyR&s8		
			(RtrequestbuilderRtrequestbuilder.exceptionsRtrequestbuilder.mixinsRtrequestbuilder.responseRteuca2ools.commands.argtypesRteuca2ools.commands.monitoringRt&euca2ools.commands.monitoring.argtypesRR(((sU/usr/lib/python2.7/site-packages/euca2ools/commands/monitoring/getmetricstatistics.pyt<module>s