Exemplo n.º 1
0
        internal override void Execute(SkytapClient client)
        {
            if (string.IsNullOrWhiteSpace(this.TemplateId) && string.IsNullOrWhiteSpace(this.TemplateName))
            {
                this.LogError("Template ID or template name must be specified.");
                return;
            }

            SkytapResource template = null;

            if (!string.IsNullOrWhiteSpace(this.TemplateId))
            {
                template = client.GetTemplate(this.TemplateId);
                if (template == null)
                {
                    if (string.IsNullOrWhiteSpace(this.TemplateName))
                    {
                        this.LogError("Could not find template with ID=" + this.TemplateId);
                        return;
                    }
                    else
                    {
                        this.LogDebug("Could not find template with ID=" + this.TemplateId + "; looking up template with name=" + this.TemplateName);
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(this.TemplateName))
            {
                template = client.GetTemplateFromName(this.TemplateName);
                if (template == null)
                {
                    this.LogError("Could not find template with name=" + this.TemplateName);
                    return;
                }
            }

            this.LogDebug("Found template ID={0}, name={1}", template.Id, template.Name);
            this.Execute(client, template);
        }