add functions for autoscaling on aws

Change-Id: I384d3d53bd7510212d6012bb7c79bd7bf4f30bf9
diff --git a/src/com/mirantis/mk/Aws.groovy b/src/com/mirantis/mk/Aws.groovy
index 4ae4fa2..bf096f8 100644
--- a/src/com/mirantis/mk/Aws.groovy
+++ b/src/com/mirantis/mk/Aws.groovy
@@ -1,7 +1,5 @@
 package com.mirantis.mk
 
-
-
 /**
  *
  * AWS function functions
@@ -30,6 +28,13 @@
     ]
 }
 
+
+/**
+ *
+ * CloudFormation stacks
+ *
+ */
+
 def createStack(venv_path, env_vars, template_file, stack_name, parameters = []) {
     def python = new com.mirantis.mk.Python()
 
@@ -123,3 +128,44 @@
         return output
     }
 }
+
+/**
+ *
+ * Autoscaling groups
+ *
+ */
+
+def describeAutoscalingGroup(venv_path, env_vars, group_name) {
+    def python = new com.mirantis.mk.Python()
+    def common = new com.mirantis.mk.Common()
+
+    def cmd = "aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name ${group_name}"
+
+    withEnv(env_vars) {
+        def out = python.runVirtualenvCommand(venv_path, cmd)
+        def out_json = common.parseJSON(out)
+        def info = out_json['AutoScalingGroups'][0]
+        common.prettyPrint(info)
+
+        return info
+    }
+}
+
+def updateAutoscalingGroup(venv_path, env_vars, group_name, parameters = []) {
+    def python = new com.mirantis.mk.Python()
+    def common = new com.mirantis.mk.Common()
+
+    if (parameters == null || parameters.size() == 0) {
+        throw new Exception("Missing parameter")
+    }
+
+    def cmd = "aws autoscaling update-auto-scaling-groups --auto-scaling-group-name ${group_name} " + parameters.join(' ')
+
+    withEnv(env_vars) {
+        def out = python.runVirtualenvCommand(venv_path, cmd)
+
+        return out
+    }
+}
+
+