Exemplo n.º 1
0
        public Runbook CreateRunbookByName(string automationAccountName, string runbookName, string description,
                                           IDictionary <string, string> tags)
        {
            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()
            };

            var rdcparam = new RunbookCreateDraftParameters()
            {
                Name = runbookName, Properties = rdcprop, Location = ""
            };

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

            return(this.GetRunbook(automationAccountName, runbookName));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Create the runbook identified by runbook name.  (see
 /// http://aka.ms/azureautomationsdk/runbookoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Automation.IRunbookOperations.
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The create parameters for runbook.
 /// </param>
 /// <returns>
 /// The response model for the runbook create response.
 /// </returns>
 public static Task <RunbookCreateResponse> CreateWithDraftAsync(this IRunbookOperations operations, string automationAccount, RunbookCreateDraftParameters parameters)
 {
     return(operations.CreateWithDraftAsync(automationAccount, parameters, CancellationToken.None));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create the runbook identified by runbook name.  (see
 /// http://aka.ms/azureautomationsdk/runbookoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Automation.IRunbookOperations.
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The create parameters for runbook.
 /// </param>
 /// <returns>
 /// The response model for the runbook create response.
 /// </returns>
 public static RunbookCreateResponse CreateWithDraft(this IRunbookOperations operations, string automationAccount, RunbookCreateDraftParameters parameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IRunbookOperations)s).CreateWithDraftAsync(automationAccount, parameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }