/// <summary>
 /// Initializes a new instance of the RunbookCreateDraftParameters
 /// class with required arguments.
 /// </summary>
 public RunbookCreateDraftParameters(RunbookCreateDraftProperties properties)
     : this()
 {
     if (properties == null)
     {
         throw new ArgumentNullException("properties");
     }
     this.Properties = properties;
 }
 /// <summary>
 /// Initializes a new instance of the RunbookCreateDraftParameters
 /// class with required arguments.
 /// </summary>
 public RunbookCreateDraftParameters(RunbookCreateDraftProperties properties)
     : this()
 {
     if (properties == null)
     {
         throw new ArgumentNullException("properties");
     }
     this.Properties = properties;
 }
        public Runbook CreateRunbookByName(string automationAccountName, string runbookName, string description,
            string[] tags)
        {
            using (var request = new RequestSettings(this.automationManagementClient))
            {
                var runbookModel = this.TryGetRunbookModel(automationAccountName, runbookName);
                if (runbookModel != null)
                {
                    throw new ResourceCommonException(typeof (Runbook),
                        string.Format(CultureInfo.CurrentCulture, Resources.RunbookAlreadyExists, runbookName));
                }

                var rdcprop = new RunbookCreateDraftProperties()
                {
                    Description = description,
                    RunbookType = RunbookTypeEnum.Script,
                    Draft = new RunbookDraft(),
                    ServiceManagementTags =
                        (tags != null) ? string.Join(Constants.RunbookTagsSeparatorString, tags) : null
                };

                var rdcparam = new RunbookCreateDraftParameters()
                {
                    Name = runbookName,
                    Properties = rdcprop,
                    Tags = null
                };

                this.automationManagementClient.Runbooks.CreateWithDraft(automationAccountName, rdcparam);

                return this.GetRunbook(automationAccountName, runbookName);
           }
        }