summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJann Kleen <jann@pocketvillage.com>2011-03-26 15:07:44 +0100
committerJann Kleen <jann@pocketvillage.com>2011-03-26 15:07:44 +0100
commit159b2611aee3e64f0ec30375cdc94086ef9d34e3 (patch)
treee3f34b9a5301bfbb7cd09b8b48946c019d100ab8
parent3f3c8de5725fad29e469167d0baef7a0264b3c44 (diff)
downloadboto-159b2611aee3e64f0ec30375cdc94086ef9d34e3.tar.gz
started removing legacy code
-rw-r--r--boto/ec2/autoscale/__init__.py60
-rw-r--r--boto/ec2/autoscale/trigger.py134
2 files changed, 30 insertions, 164 deletions
diff --git a/boto/ec2/autoscale/__init__.py b/boto/ec2/autoscale/__init__.py
index 2389b003..11a903a0 100644
--- a/boto/ec2/autoscale/__init__.py
+++ b/boto/ec2/autoscale/__init__.py
@@ -29,7 +29,7 @@ import boto
from boto.connection import AWSQueryConnection
from boto.ec2.regioninfo import RegionInfo
from boto.ec2.autoscale.request import Request
-from boto.ec2.autoscale.trigger import Trigger
+#from boto.ec2.autoscale.trigger import Trigger
from boto.ec2.autoscale.launchconfig import LaunchConfiguration
from boto.ec2.autoscale.group import AutoScalingGroup
from boto.ec2.autoscale.activity import Activity
@@ -172,31 +172,31 @@ class AutoScaleConnection(AWSQueryConnection):
return self.get_object('CreateLaunchConfiguration', params,
Request, verb='POST')
- def create_trigger(self, trigger):
- """
-
- """
- params = {'TriggerName' : trigger.name,
- 'AutoScalingGroupName' : trigger.autoscale_group.name,
- 'MeasureName' : trigger.measure_name,
- 'Statistic' : trigger.statistic,
- 'Period' : trigger.period,
- 'Unit' : trigger.unit,
- 'LowerThreshold' : trigger.lower_threshold,
- 'LowerBreachScaleIncrement' : trigger.lower_breach_scale_increment,
- 'UpperThreshold' : trigger.upper_threshold,
- 'UpperBreachScaleIncrement' : trigger.upper_breach_scale_increment,
- 'BreachDuration' : trigger.breach_duration}
- # dimensions should be a list of tuples
- dimensions = []
- for dim in trigger.dimensions:
- name, value = dim
- dimensions.append(dict(Name=name, Value=value))
- self.build_list_params(params, dimensions, 'Dimensions')
-
- req = self.get_object('CreateOrUpdateScalingTrigger', params,
- Request)
- return req
+ #def create_trigger(self, trigger):
+ # """
+ #
+ # """
+ # params = {'TriggerName' : trigger.name,
+ # 'AutoScalingGroupName' : trigger.autoscale_group.name,
+ # 'MeasureName' : trigger.measure_name,
+ # 'Statistic' : trigger.statistic,
+ # 'Period' : trigger.period,
+ # 'Unit' : trigger.unit,
+ # 'LowerThreshold' : trigger.lower_threshold,
+ # 'LowerBreachScaleIncrement' : trigger.lower_breach_scale_increment,
+ # 'UpperThreshold' : trigger.upper_threshold,
+ # 'UpperBreachScaleIncrement' : trigger.upper_breach_scale_increment,
+ # 'BreachDuration' : trigger.breach_duration}
+ # # dimensions should be a list of tuples
+ # dimensions = []
+ # for dim in trigger.dimensions:
+ # name, value = dim
+ # dimensions.append(dict(Name=name, Value=value))
+ # self.build_list_params(params, dimensions, 'Dimensions')
+ #
+ # req = self.get_object('CreateOrUpdateScalingTrigger', params,
+ # Request)
+ # return req
def get_all_groups(self, names=None):
"""
@@ -237,10 +237,10 @@ class AutoScaleConnection(AWSQueryConnection):
return self.get_list('DescribeScalingActivities', params,
[('member', Activity)])
- def get_all_triggers(self, autoscale_group):
- params = {'AutoScalingGroupName' : autoscale_group}
- return self.get_list('DescribeTriggers', params,
- [('member', Trigger)])
+ #def get_all_triggers(self, autoscale_group):
+ # params = {'AutoScalingGroupName' : autoscale_group}
+ # return self.get_list('DescribeTriggers', params,
+ # [('member', Trigger)])
def terminate_instance(self, instance_id, decrement_capacity=True):
params = {
diff --git a/boto/ec2/autoscale/trigger.py b/boto/ec2/autoscale/trigger.py
deleted file mode 100644
index 2840e67e..00000000
--- a/boto/ec2/autoscale/trigger.py
+++ /dev/null
@@ -1,134 +0,0 @@
-# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish, dis-
-# tribute, sublicense, and/or sell copies of the Software, and to permit
-# persons to whom the Software is furnished to do so, subject to the fol-
-# lowing conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# 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,
-# 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.
-
-import weakref
-
-from boto.ec2.autoscale.request import Request
-
-
-class Trigger(object):
- """
- An auto scaling trigger.
- """
-
- def __init__(self, connection=None, name=None, autoscale_group=None,
- dimensions=None, measure_name=None,
- statistic=None, unit=None, period=60,
- lower_threshold=None,
- lower_breach_scale_increment=None,
- upper_threshold=None,
- upper_breach_scale_increment=None,
- breach_duration=None):
- """
- Initialize an auto-scaling trigger object.
-
- :type name: str
- :param name: The name for this trigger
-
- :type autoscale_group: str
- :param autoscale_group: The name of the AutoScalingGroup that will be
- associated with the trigger. The AutoScalingGroup
- that will be affected by the trigger when it is
- activated.
-
- :type dimensions: list
- :param dimensions: List of tuples, i.e.
- ('ImageId', 'i-13lasde') etc.
-
- :type measure_name: str
- :param measure_name: The measure name associated with the metric used by
- the trigger to determine when to activate, for
- example, CPU, network I/O, or disk I/O.
-
- :type statistic: str
- :param statistic: The particular statistic used by the trigger when
- fetching metric statistics to examine.
-
- :type period: int
- :param period: The period associated with the metric statistics in
- seconds. Valid Values: 60 or a multiple of 60.
-
- :type unit: str
- :param unit: The unit of measurement.
- """
- self.name = name
- self.connection = connection
- self.dimensions = dimensions
- self.breach_duration = breach_duration
- self.upper_breach_scale_increment = upper_breach_scale_increment
- self.created_time = None
- self.upper_threshold = upper_threshold
- self.status = None
- self.lower_threshold = lower_threshold
- self.period = period
- self.lower_breach_scale_increment = lower_breach_scale_increment
- self.statistic = statistic
- self.unit = unit
- self.namespace = None
- if autoscale_group:
- self.autoscale_group = weakref.proxy(autoscale_group)
- else:
- self.autoscale_group = None
- self.measure_name = measure_name
-
- def __repr__(self):
- return 'Trigger:%s' % (self.name)
-
- def startElement(self, name, attrs, connection):
- return None
-
- def endElement(self, name, value, connection):
- if name == 'BreachDuration':
- self.breach_duration = value
- elif name == 'TriggerName':
- self.name = value
- elif name == 'Period':
- self.period = value
- elif name == 'CreatedTime':
- self.created_time = value
- elif name == 'Statistic':
- self.statistic = value
- elif name == 'Unit':
- self.unit = value
- elif name == 'Namespace':
- self.namespace = value
- elif name == 'AutoScalingGroupName':
- self.autoscale_group_name = value
- elif name == 'MeasureName':
- self.measure_name = value
- else:
- setattr(self, name, value)
-
- def update(self):
- """ Write out differences to trigger. """
- self.connection.create_trigger(self)
-
- def delete(self):
- """ Delete this trigger. """
- params = {
- 'TriggerName' : self.name,
- 'AutoScalingGroupName' : self.autoscale_group_name,
- }
- req =self.connection.get_object('DeleteTrigger', params,
- Request)
- self.connection.last_request = req
- return req
-