コード例 #1
0
    def create_launch_config(self, launch_config):
        """
        Create a new Launch Configuration

        :type launch_config: dict
        :param launch_config: launch configuration
        """
        endpoint = {'endpoint': self.endpoint}
        params = keyname_formatd(launch_config)
        params.update(endpoint)
        cmd = "CreateLaunchConfiguration"
        log.info("create the launch configuration")
        log.info(">> %s" % launch_config['LaunchConfigurationName'])
        try:
            self.handle_response(operate(self.service, cmd, params))
        except Exception, e:
            raise IcsASException(e)
コード例 #2
0
    def create_group(self, group_config):
        """
        Create a new Auto-Scaling Group

        :type group_config: dict
        :param group_config: auto-scaling group configuration
        """
        endpoint = {'endpoint': self.endpoint}
        params = keyname_formatd(group_config)
        params.update(endpoint)
        cmd = "CreateAutoScalingGroup"
        log.info("create the auto-scaling group")
        log.info(">> %s" % group_config['AutoScalingGroupName'])
        try:
            self.handle_response(operate(self.service, cmd, params))
        except Exception, e:
            raise IcsASException(e)
コード例 #3
0
    def delete_launch_config(self, name):
        """
        Delete an existing Launch Configuration

        :type name: string
        :param name: launch configuration name
        """
        endpoint = {'endpoint': self.endpoint}
        cmd = "DeleteLaunchConfiguration"
        key = 'LaunchConfigurationName'
        params = {key: name}
        params = keyname_formatd(params)
        params.update(endpoint)
        log.info("delete the launch configuration")
        log.info(">> %s" % name)
        try:
            self.handle_response(operate(self.service, cmd, params))
        except Exception, e:
            raise IcsASException(e)
コード例 #4
0
    def fetch_launch_config(self, name):
        """
        Fetch an existing Launch Configuration

        :type name: string
        :param name: launch configuration name
        """
        endpoint = {'endpoint': self.endpoint}
        cmd = "DescribeLaunchConfigurations"
        key = 'LaunchConfigurationNames'
        params = {key: [name]}
        params = keyname_formatd(params)
        params.update(endpoint)
        log.info("find the launch configuration")
        log.info(">> %s" % name)
        try:
            response = operate(self.service, cmd, params)
        except Exception, e:
            raise IcsASException(e)
コード例 #5
0
    def fetch_group(self, name):
        """
        Fetch an existing Auto-Scaling Group

        :type name: string
        :param name: auto-scaling group name
        """
        endpoint = {'endpoint': self.endpoint}
        cmd = "DescribeAutoScalingGroups"
        key = 'AutoScalingGroupNames'
        params = {key: [name]}
        params = keyname_formatd(params)
        params.update(endpoint)
        log.info("find the auto-scaling group")
        log.info(">> %s" % name)
        try:
            response = operate(self.service, cmd, params)
        except Exception, e:
            raise IcsASException(e)
コード例 #6
0
    def delete_group(self, name):
        """
        Delete an existing Auto-Scaling Group

        :type name: string
        :param name: auto-scaling group name
        """
        endpoint = {'endpoint': self.endpoint}
        cmd = "DeleteAutoScalingGroup"
        key = 'AutoScalingGroupName'
        params = {key: name}
        params['ForceDelete'] = True
        params = keyname_formatd(params)
        params.update(endpoint)
        log.info("delete the auto-scaling group")
        log.info(">> %s" % name)
        try:
            self.handle_response(operate(self.service, cmd, params))
        except Exception, e:
            raise IcsASException(e)