o .&a@s\dZddlZddlmZddlmZddlmZddZdd Z d d Z Gd d d eZ dS)z This customization adds the following scalar parameters to the cloudwatch put-metric-data operation: * --metric-name * --dimensions * --timestamp * --value * --statistic-values * --unit * --storage-resolution N)CustomArgument)split_on_commas)#validate_mutually_exclusive_handlercCs(|dt|dtdggddS)Nz2building-argument-table.cloudwatch.put-metric-dataz0operation-args-parsed.cloudwatch.put-metric-data metric_data) metric_name timestampunitvalue dimensionsstatistic_values)register _promote_argsr) event_handlerrE/usr/lib/python3/dist-packages/awscli/customizations/putmetricdata.pyregister_put_metric_data!s rcKsd|d_tddd|d<tddd|d<tdd d|d<td d d|d <td d d|d <tddd|d<|jjdj}|jd}td|jd|d<dS)NFz metric-dataz metric-namezThe name of the metric.) help_textrzyThe time stamp used for the metric. If not specified, the default value is set to the time the metric data was received.rzThe unit of metric.r a=The value for the metric. Although the --value parameter accepts numbers of type Double, Amazon CloudWatch truncates values with very large exponents. Values with base-10 exponents greater than 126 (1 x 10^126) are truncated. Likewise, values with base-10 exponents less than -130 (1 x 10^-130) are also truncated.r aThe --dimensions argument further expands on the identity of a metric using a Name=Value pair, separated by commas, for example: --dimensions InstanceID=1-23456789,InstanceType=m1.small. Note that the --dimensions argument has a different format when used in get-metric-data, where for the same example you would use the format --dimensions Name=InstanceID,Value=i-aaba32d4 Name=InstanceType,value=m1.small .zstatistic-valuesz2A set of statistical values describing the metric. MetricDataStorageResolutionzstorage-resolution)requiredPutMetricArgument input_shapemembersmember documentation)argument_tableoperation_modelkwargsrstorage_resolutionrrrr +s2          r csfdd}|S)Ncsfdd}|S)Ncs6|durdS|vrig|<|d}|||S)Nrr)self parametersr first_element)funcnamerr_add_to_params^s    zIinsert_first_element.._wrap_add_to_params.._add_to_paramsr)r"r$r#)r"r_wrap_add_to_params]s z1insert_first_element.._wrap_add_to_paramsr)r#r&rr%rinsert_first_element\s r'c@seZdZddZedddZedddZeddd Zedd d Zedd d Z edddZ edddZ dS)rcCs"d|jdd}t||||S)Nz _add_param_%s-_)r#replacegetattr)rr r method_namerrr add_to_paramsoszPutMetricArgument.add_to_paramsrcC ||d<dS)N MetricNamerrr!r rrr_add_param_metric_names z(PutMetricArgument._add_param_metric_namecCr.)NUnitrr0rrr_add_param_unitwr2z!PutMetricArgument._add_param_unitcCr.)N Timestamprr0rrr_add_param_timestamp{r2z&PutMetricArgument._add_param_timestampcCst||d<dS)NValue)decimalDecimalr0rrr_add_param_valuesz"PutMetricArgument._add_param_valuecCs<g}t|D]}|d\}}|||dq||d<dS)N=)Namer7 Dimensions)rsplitappend)rr!r r pairkeyrrr_add_param_dimensionss   z'PutMetricArgument._add_param_dimensionscCs:i}t|D]}|d\}}t|||<q||d<dS)Nr;StatisticValues)rr>r8r9)rr!r statisticsr@rArrr_add_param_statistic_valuess   z-PutMetricArgument._add_param_statistic_valuescCst||d<dS)Nr)intr0rrr_add_param_storage_resolutionsz/PutMetricArgument._add_param_storage_resolutionN) __name__ __module__ __qualname__r-r'r1r4r6r:rBrErGrrrrrns        r) __doc__r8awscli.argumentsr awscli.utilsrawscli.customizations.utilsrrr r'rrrrrs     1