Ejemplo n.º 1
0
        public HostService(PlatformDb db, ec2::Ec2Client ec2)
        {
            #region Preconditions

            if (db == null) throw new ArgumentNullException(nameof(db));

            #endregion

            this.db = db;
            this.ec2 = ec2;
        }
Ejemplo n.º 2
0
        private InstanceStatus GetStatus(ec2::InstanceState state)
        {
            switch (state.Name)
            {
                case "pending"       : return InstanceStatus.Pending;
                case "running"       : return InstanceStatus.Running;
                case "shutting-down" : return InstanceStatus.Terminating;
                case "terminated"    : return InstanceStatus.Terminated;
                case "stopping"      : return InstanceStatus.Suspending;
                case "stopped"       : return InstanceStatus.Suspended;

                default: throw new Exception("unexpected state:" + state.Name);
            }
        }