Exemplo n.º 1
0
        public override ActionDescription GetActionDescription()
        {
            var shortDesc = new ShortActionDescription();

            if (string.IsNullOrWhiteSpace(this.ConfigurationName))
            {
                shortDesc.AppendContent("Create Skytap Configuration");
            }
            else
            {
                shortDesc.AppendContent(
                    "Create ",
                    new Hilite(this.ConfigurationName),
                    " Skytap Environment"
                    );
            }

            var longDesc = new LongActionDescription(
                "from ",
                new Hilite(this.TemplateName)
                );

            if (this.ExportVariables)
            {
                longDesc.AppendContent(
                    ", and set ${Skytap-EnvironmentId} to the environment ID"
                    );
            }

            return(new ActionDescription(
                       shortDesc,
                       longDesc
                       ));
        }
Exemplo n.º 2
0
        public override ActionDescription GetActionDescription()
        {
            var shortDesc = new ShortActionDescription("Publish ", this.ConfigurationName, " Skytap Environment");

            if (!string.IsNullOrEmpty(this.PublishedSetName))
            {
                shortDesc.AppendContent(" to ", new Inedo.BuildMaster.Extensibility.Actions.Hilite(this.PublishedSetName));
            }

            var longDesc = new LongActionDescription("with ");

            if (this.VirtualMachines == null || this.VirtualMachines.Length == 0)
            {
                longDesc.AppendContent(
                    new Inedo.BuildMaster.Extensibility.Actions.Hilite("all"),
                    " virtual machines at ",
                    new Inedo.BuildMaster.Extensibility.Actions.Hilite(this.DefaultAccess)
                    );
            }
            else
            {
                longDesc.AppendContent(
                    new Inedo.BuildMaster.Extensibility.Actions.ListHilite(this.VirtualMachines.Select(v => string.Format("{0} ({1})", v.Name, v.Access)))
                    );
                longDesc.AppendContent(" virtual machines");
            }

            var extraInfo = new List <object>();

            if (!string.IsNullOrEmpty(this.RuntimeLimitHours))
            {
                extraInfo.Add(new object[] { "runtime limit of ", new Inedo.BuildMaster.Extensibility.Actions.Hilite(this.RuntimeLimitHours + " hours") });
            }

            if (!string.IsNullOrEmpty(this.ExpirationHours))
            {
                extraInfo.Add(new object[] { "expiring after ", new Inedo.BuildMaster.Extensibility.Actions.Hilite(this.ExpirationHours + " hours") });
            }

            if (!string.IsNullOrEmpty(this.DailyAccessStart) && !string.IsNullOrEmpty(this.DailyAccessEnd))
            {
                var start = TimeSpan.Parse(this.DailyAccessStart);
                var end   = TimeSpan.Parse(this.DailyAccessEnd);

                var today = DateTime.Today;
                extraInfo.Add(
                    new object[]
                {
                    "daily access from ",
                    new Inedo.BuildMaster.Extensibility.Actions.Hilite((today + start).ToShortTimeString()),
                    " to ",
                    new Inedo.BuildMaster.Extensibility.Actions.Hilite((today + end).ToShortTimeString())
                }
                    );
            }

            if (extraInfo.Count > 0)
            {
                foreach (var info in extraInfo.Take(extraInfo.Count - 1))
                {
                    longDesc.AppendContent(", ", info);
                }

                if (extraInfo.Count > 1)
                {
                    longDesc.AppendContent(", and ", extraInfo.Last());
                }
            }

            return(new ActionDescription(shortDesc, longDesc));
        }