コード例 #1
0
 /// <summary>
 /// Update 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 update parameters for runbook.
 /// </param>
 /// <returns>
 /// The response model for the get runbook operation.
 /// </returns>
 public static RunbookGetResponse Update(this IRunbookOperations operations, string automationAccount, RunbookUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IRunbookOperations)s).UpdateAsync(automationAccount, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
コード例 #2
0
 /// <summary>
 /// Update 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 update parameters for runbook.
 /// </param>
 /// <returns>
 /// The response model for the get runbook operation.
 /// </returns>
 public static Task<RunbookGetResponse> UpdateAsync(this IRunbookOperations operations, string automationAccount, RunbookUpdateParameters parameters)
 {
     return operations.UpdateAsync(automationAccount, parameters, CancellationToken.None);
 }
コード例 #3
0
        public Runbook UpdateRunbook(string automationAccountName, string runbookName, string description,
            string[] tags, bool? logProgress, bool? logVerbose)
        {
            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.RunbookNotFound, runbookName));
                }

                var runbookUpdateParameters = new RunbookUpdateParameters();
                runbookUpdateParameters.Name = runbookName;
                runbookUpdateParameters.Tags = null;

                runbookUpdateParameters.Properties = new RunbookUpdateProperties();
                runbookUpdateParameters.Properties.Description = description ?? runbookModel.Properties.Description;
                runbookUpdateParameters.Properties.LogProgress = (logProgress.HasValue)
                    ? logProgress.Value
                    : runbookModel.Properties.LogProgress;
                runbookUpdateParameters.Properties.LogVerbose = (logVerbose.HasValue)
                    ? logVerbose.Value
                    : runbookModel.Properties.LogVerbose;
                runbookUpdateParameters.Properties.ServiceManagementTags = (tags != null)
                    ? string.Join(Constants.RunbookTagsSeparatorString, tags)
                    : runbookModel.Properties.ServiceManagementTags;

                var runbook =
                    this.automationManagementClient.Runbooks.Update(automationAccountName, runbookUpdateParameters)
                        .Runbook;

                return new Runbook(automationAccountName, runbook);
            }
        }