FRTc@sdZddlmZmZmZmZddlmZddlm Z ddl m Z m Z m Z ddlmZddlmZmZmZddlZejd iZd Zd Zd efd YZdS(sc This module provides an interface to the Elastic Compute Cloud (EC2) CloudWatch service from AWS. i(tjsontmaptsixtzip(tAWSQueryConnection(tMetric(t MetricAlarmt MetricAlarmstAlarmHistoryItem(t Datapoint(t RegionInfot get_regionst load_regionsNt cloudwatchcCstddtS(s Get all available regions for the CloudWatch service. :rtype: list :return: A list of :class:`boto.RegionInfo` instances R tconnection_cls(R tCloudWatchConnection(((sI/opt/freeware/lib/python2.7/site-packages/boto/ec2/cloudwatch/__init__.pytregions%scKs4x-tD]"}|j|kr |j|Sq WdS(sI Given a valid region name, return a :class:`boto.ec2.cloudwatch.CloudWatchConnection`. :param str region_name: The name of the region to connect to. :rtype: :class:`boto.ec2.CloudWatchConnection` or ``None`` :return: A connection to the given region, or None if an invalid region name is given N(RtnametconnecttNone(t region_namet kw_paramstregion((sI/opt/freeware/lib/python2.7/site-packages/boto/ec2/cloudwatch/__init__.pytconnect_to_region/s RcBs|eZejjdddZejjdddZejjdddZdde dddddddddde dd Z d Z d Z d Z dddddd ZdddZdddddZddddddZdddddddZdddddddZdddddZdZeZeZdZddZdZdZRS(tBototcloudwatch_versions 2010-08-01tcloudwatch_region_names us-east-1tcloudwatch_region_endpoints"monitoring.us-east-1.amazonaws.comit/cCs| s!t||j|j} n| |_|jjdkrEt}ntt|j|||||||||jj | | | | d|d| dS(s Init method to create a new connection to EC2 Monitoring Service. B{Note:} The host argument is overridden by the host specified in the boto configuration file. s eu-west-1tvalidate_certst profile_nameN( R tDefaultRegionNametDefaultRegionEndpointRRtFalsetsuperRt__init__tendpoint(tselftaws_access_key_idtaws_secret_access_keyt is_securetporttproxyt proxy_portt proxy_usert proxy_passtdebugthttps_connection_factoryRtpathtsecurity_tokenRR((sI/opt/freeware/lib/python2.7/site-packages/boto/ec2/cloudwatch/__init__.pyR#Is      cCsdgS(Nshmac-v4((R%((sI/opt/freeware/lib/python2.7/site-packages/boto/ec2/cloudwatch/__init__.pyt_required_auth_capabilityhscCsd}d}x|D]}||}|rt|tjrG|g}nxm|D]@}||d||df<||d||df<|d7}qNWq||d||df<|d7}qWdS(NsDimensions.memberis %s.%d.Nameis %s.%d.Value(t isinstanceRt string_types(R%t dimensiontparamstprefixtitdim_namet dim_valuetvalue((sI/opt/freeware/lib/python2.7/site-packages/boto/ec2/cloudwatch/__init__.pytbuild_dimension_paramks    c Cst|tjr|g}nxt|D]\}}|d}t|trxetj|D]C\}}||||df<|dk r`||||dfscsCt|tr8t|kr4tdn|S|gS(Ns3Must specify equal number of elements; expected %d.(R3RIRJt Exception(RK(tlength(sI/opt/freeware/lib/python2.7/site-packages/boto/ec2/cloudwatch/__init__.pytaslists t MetricNamet TimestamptUnittmaximumsStatisticValues.MaximumtminimumsStatisticValues.Minimumt samplecountsStatisticValues.SampleCounttsumsStatisticValues.Sums*You supplied a value and statistics for a s(metric.Posting statistics and not value.R>s*Must specify a value or statistics to put.sMetricData.member.%d.%si( tmaxRR?Rt isoformatR<RtbototlogtwarnRMRRA(R%R6RR;t timestamptunitt dimensionst statisticstargsRORDtnRGtutdtsttt metric_datatmsgtkeytval((RNsI/opt/freeware/lib/python2.7/site-packages/boto/ec2/cloudwatch/__init__.pytbuild_put_paramss2:      c Csi|d6|d6|d6|jd6|jd6} |j| |d|ra|j|| n|rt|| ds"