diff options
Diffstat (limited to 'boto/ec2/cloudwatch')
-rw-r--r-- | boto/ec2/cloudwatch/__init__.py | 44 | ||||
-rw-r--r-- | boto/ec2/cloudwatch/alarm.py | 17 | ||||
-rw-r--r-- | boto/ec2/cloudwatch/datapoint.py | 1 | ||||
-rw-r--r-- | boto/ec2/cloudwatch/dimension.py | 1 | ||||
-rw-r--r-- | boto/ec2/cloudwatch/listelement.py | 3 |
5 files changed, 35 insertions, 31 deletions
diff --git a/boto/ec2/cloudwatch/__init__.py b/boto/ec2/cloudwatch/__init__.py index 0c9115e8..9b150b4e 100644 --- a/boto/ec2/cloudwatch/__init__.py +++ b/boto/ec2/cloudwatch/__init__.py @@ -92,14 +92,14 @@ class CloudWatchConnection(AWSQueryConnection): validate_certs = False super(CloudWatchConnection, self).__init__(aws_access_key_id, - aws_secret_access_key, - is_secure, port, proxy, proxy_port, - proxy_user, proxy_pass, - self.region.endpoint, debug, - https_connection_factory, path, - security_token, - validate_certs=validate_certs, - profile_name=profile_name) + aws_secret_access_key, + is_secure, port, proxy, proxy_port, + proxy_user, proxy_pass, + self.region.endpoint, debug, + https_connection_factory, path, + security_token, + validate_certs=validate_certs, + profile_name=profile_name) def _required_auth_capability(self): return ['hmac-v4'] @@ -113,11 +113,11 @@ class CloudWatchConnection(AWSQueryConnection): if isinstance(dim_value, six.string_types): dim_value = [dim_value] for value in dim_value: - params['%s.%d.Name' % (prefix, i+1)] = dim_name - params['%s.%d.Value' % (prefix, i+1)] = value + params['%s.%d.Name' % (prefix, i + 1)] = dim_name + params['%s.%d.Value' % (prefix, i + 1)] = value i += 1 else: - params['%s.%d.Name' % (prefix, i+1)] = dim_name + params['%s.%d.Name' % (prefix, i + 1)] = dim_name i += 1 def build_list_params(self, params, items, label): @@ -134,7 +134,7 @@ class CloudWatchConnection(AWSQueryConnection): params[label % i] = item def build_put_params(self, params, name, value=None, timestamp=None, - unit=None, dimensions=None, statistics=None): + unit=None, dimensions=None, statistics=None): args = (name, value, unit, dimensions, statistics, timestamp) length = max(map(lambda a: len(a) if isinstance(a, list) else 1, args)) @@ -329,7 +329,7 @@ class CloudWatchConnection(AWSQueryConnection): """ params = {'Namespace': namespace} self.build_put_params(params, name, value=value, timestamp=timestamp, - unit=unit, dimensions=dimensions, statistics=statistics) + unit=unit, dimensions=dimensions, statistics=statistics) return self.get_status('PutMetricData', params, verb="POST") @@ -498,15 +498,15 @@ class CloudWatchConnection(AWSQueryConnection): :param alarm: MetricAlarm object. """ params = { - 'AlarmName': alarm.name, - 'MetricName': alarm.metric, - 'Namespace': alarm.namespace, - 'Statistic': alarm.statistic, - 'ComparisonOperator': alarm.comparison, - 'Threshold': alarm.threshold, - 'EvaluationPeriods': alarm.evaluation_periods, - 'Period': alarm.period, - } + 'AlarmName': alarm.name, + 'MetricName': alarm.metric, + 'Namespace': alarm.namespace, + 'Statistic': alarm.statistic, + 'ComparisonOperator': alarm.comparison, + 'Threshold': alarm.threshold, + 'EvaluationPeriods': alarm.evaluation_periods, + 'Period': alarm.period, + } if alarm.actions_enabled is not None: params['ActionsEnabled'] = alarm.actions_enabled if alarm.alarm_actions: diff --git a/boto/ec2/cloudwatch/alarm.py b/boto/ec2/cloudwatch/alarm.py index 787c08cf..c267ab03 100644 --- a/boto/ec2/cloudwatch/alarm.py +++ b/boto/ec2/cloudwatch/alarm.py @@ -52,11 +52,11 @@ class MetricAlarm(object): INSUFFICIENT_DATA = 'INSUFFICIENT_DATA' _cmp_map = { - '>=': 'GreaterThanOrEqualToThreshold', - '>': 'GreaterThanThreshold', - '<': 'LessThanThreshold', - '<=': 'LessThanOrEqualToThreshold', - } + '>=': 'GreaterThanOrEqualToThreshold', + '>': 'GreaterThanThreshold', + '<': 'LessThanThreshold', + '<=': 'LessThanOrEqualToThreshold', + } _rev_cmp_map = dict((v, k) for (k, v) in six.iteritems(_cmp_map)) def __init__(self, connection=None, name=None, metric=None, @@ -122,15 +122,15 @@ class MetricAlarm(object): 'InstanceId': ['i-0123456', 'i-0123457'], 'LoadBalancerName': 'test-lb' } - + :type alarm_actions: list of strs :param alarm_actions: A list of the ARNs of the actions to take in ALARM state - + :type insufficient_data_actions: list of strs :param insufficient_data_actions: A list of the ARNs of the actions to take in INSUFFICIENT_DATA state - + :type ok_actions: list of strs :param ok_actions: A list of the ARNs of the actions to take in OK state """ @@ -295,6 +295,7 @@ class MetricAlarm(object): def delete(self): self.connection.delete_alarms([self.name]) + class AlarmHistoryItem(object): def __init__(self, connection=None): self.connection = connection diff --git a/boto/ec2/cloudwatch/datapoint.py b/boto/ec2/cloudwatch/datapoint.py index a33771a1..94955acd 100644 --- a/boto/ec2/cloudwatch/datapoint.py +++ b/boto/ec2/cloudwatch/datapoint.py @@ -21,6 +21,7 @@ # from datetime import datetime + class Datapoint(dict): def __init__(self, connection=None): diff --git a/boto/ec2/cloudwatch/dimension.py b/boto/ec2/cloudwatch/dimension.py index 86ebb9c3..9ff4fb11 100644 --- a/boto/ec2/cloudwatch/dimension.py +++ b/boto/ec2/cloudwatch/dimension.py @@ -20,6 +20,7 @@ # IN THE SOFTWARE. # + class Dimension(dict): def startElement(self, name, attrs, connection): diff --git a/boto/ec2/cloudwatch/listelement.py b/boto/ec2/cloudwatch/listelement.py index 2dd9cef0..6a290418 100644 --- a/boto/ec2/cloudwatch/listelement.py +++ b/boto/ec2/cloudwatch/listelement.py @@ -14,11 +14,12 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. + class ListElement(list): def startElement(self, name, attrs, connection): |