Example #1
0
        public ZAwsElasticIp(ZAwsEc2Controller controller, Amazon.EC2.Model.Address res)
            : base(controller)
        {
            Update(res);

            //myController.HandleNewElasticIp(this);
        }
Example #2
0
        }                                                       ///Seconds!

        protected ZAwsTask(ZAwsEc2Controller controller, string taskname)
        {
            Taskname = taskname;

            myController = controller;

            StartMessage     = string.Format("Starting task {0}", taskname);
            SuccessMessage   = string.Format("Task executed succesfully.");
            ExceptionMessage = "Error executing task " + taskname + ", reason: {1}";

            DelayBeforeTaskStart = 0;
        }
Example #3
0
        public ZAwsTaskInstallApps(ZAwsEc2Controller controller, string eC2Name, ZAws.ZAwsAmi.NewApp[] appsToInstall)
            : base(controller, "Application will be installed.")
        {
            Ec2Name       = eC2Name;
            AppsToInstall = appsToInstall;

            StartMessage     = "";
            SuccessMessage   = "";
            ExceptionMessage = "Error installing applications, reason: {0}";

            DelayBeforeTaskStart = 10;
        }
Example #4
0
        public ZAwsTaskNewSpotRequestHandling(ZAwsEc2Controller controller, string spotRequestId, string Name)
            : base(controller, "New Spot Request handling.")
        {
            SpotRequestId = spotRequestId;
            Ec2NewName    = Name;

            StartMessage     = "";
            SuccessMessage   = "Succesfully handled new Spot Request.";
            ExceptionMessage = "Error handling Spot Request, reason: {0}";

            DelayBeforeTaskStart = 0;
        }
Example #5
0
        public ZAwsEc2(ZAwsEc2Controller controller, Amazon.EC2.Model.Reservation res)
            : base(controller)
        {
            StatisticsValid = false;

            LatestBootConsoleTimestamp = "";
            ConsoleOutput = "";

            Update(res);

            /*
             * Trace.WriteLine("Now will see to configure new applications.");
             * ConfigureAppsWhenBootingComplete = myController.HandleNewEc2Instance(this) ? 3 : 0;
             * Trace.WriteLine("ConfigureAppsWhenBootingComplete = " + ConfigureAppsWhenBootingComplete.ToString());
             * */
        }
Example #6
0
 public ZAwsS3(ZAwsEc2Controller controller, Amazon.S3.Model.S3Bucket res)
     : base(controller)
 {
     Update(res);
 }
Example #7
0
 public ZAwsSecGroup(ZAwsEc2Controller controller, Amazon.EC2.Model.SecurityGroup res)
     : base(controller)
 {
     Update(res);
 }
Example #8
0
 public ZAwsKeyPair(ZAwsEc2Controller controller, Amazon.EC2.Model.KeyPair res)
     : base(controller)
 {
     Update(res);
 }
Example #9
0
 public ZAwsSnapshot(ZAwsEc2Controller controller, Amazon.EC2.Model.Snapshot res)
     : base(controller)
 {
     Update(res);
 }
Example #10
0
 public ZAwsEbsVolume(ZAwsEc2Controller controller, Amazon.EC2.Model.Volume res)
     : base(controller)
 {
     Update(res);
 }
Example #11
0
 public ZAwsSpotRequest(ZAwsEc2Controller controller, Amazon.EC2.Model.SpotInstanceRequest res)
     : base(controller)
 {
     Update(res);
 }
Example #12
0
 public ZAwsAmi(ZAwsEc2Controller controller, Amazon.EC2.Model.Image res)
     : base(controller)
 {
     Update(res);
 }
Example #13
0
 public ZAwsHostedZone(ZAwsEc2Controller controller, HostedZone res)
     : base(controller)
 {
     Update(res);
     RecordsAvailable = false;
 }
Example #14
0
 protected ZAwsObject(ZAwsEc2Controller controller)
 {
     myController = controller;
 }
Example #15
0
        internal ZAwsTaskHandler(ZAwsEc2Controller controller)
        {
            myController  = controller;
            handlerThread = new Thread(new ThreadStart(delegate
            {
                Thread.CurrentThread.Name = "TaskHandler";
                while (runner)
                {
                    ZAwsObject currentObject = null;
                    lock (myLock)
                    {
                        try
                        {
                            currentObject = myTagetObjects.Dequeue();
                        }
                        catch (System.InvalidOperationException)
                        {
                            if (!runner)
                            {
                                return;
                            }
                            runnerEver.Reset();
                        }
                    }

                    if (currentObject == null)
                    {
                        //Now wait for the next object to be added
                        runnerEver.WaitOne(3000);
                        continue;
                    }

                    while (true)
                    {
                        ZAwsTask currentTask = null;
                        lock (myLock)
                        {
                            for (int i = 0; i < myTaskList.Count; i++)
                            {
                                if (myTaskList[i].WillHandle(currentObject))
                                {
                                    //remove this task from list
                                    currentTask = myTaskList[i];
                                    myTaskList.RemoveAt(i);
                                    break;
                                }
                            }
                        }

                        if (currentTask == null)
                        {
                            break;
                        }

                        if (sleepEvent.WaitOne(currentTask.DelayBeforeTaskStart * 1000))
                        {
                            //This event is only set by the Close function, so if this returns true, you should close right away
                            return;
                        }
                        Program.TraceLine(currentTask.StartMessage);
                        try
                        {
                            currentTask.DoExecute(currentObject);
                            Program.TraceLine(currentTask.SuccessMessage);
                        }
                        catch (Exception ex)
                        {
                            Program.TraceLine(currentTask.ExceptionMessage, ex);
                        }
                    }
                }
            }));
            handlerThread.Start();
        }