コード例 #1
0
 /// <summary>
 /// Updates the runbook draft with runbookStream as its content.  (see
 /// http://aka.ms/azureautomationsdk/runbookdraftoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Automation.IRunbookDraftOperations.
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The runbook draft update parameters.
 /// </param>
 /// <returns>
 /// A standard service response for long running operations.
 /// </returns>
 public static Task<LongRunningOperationResultResponse> UpdateAsync(this IRunbookDraftOperations operations, string automationAccount, RunbookDraftUpdateParameters parameters)
 {
     return operations.UpdateAsync(automationAccount, parameters, CancellationToken.None);
 }
コード例 #2
0
        public Runbook CreateRunbookByPath(string automationAccountName, string runbookPath, string description,
            string[] tags)
        {

            var runbookName = Path.GetFileNameWithoutExtension(runbookPath);

            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 runbook = this.CreateRunbookByName(automationAccountName, runbookName, description, tags);

                var rduprop = new RunbookDraftUpdateParameters()
                {
                    Name = runbookName,
                    Stream = File.ReadAllText(runbookPath)
                };

                this.automationManagementClient.RunbookDraft.Update(automationAccountName, rduprop);

                return runbook;
            }
        }
コード例 #3
0
 /// <summary>
 /// Updates the runbook draft with runbookStream as its content.  (see
 /// http://aka.ms/azureautomationsdk/runbookdraftoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Automation.IRunbookDraftOperations.
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The runbook draft update parameters.
 /// </param>
 /// <returns>
 /// A standard service response for long running operations.
 /// </returns>
 public static LongRunningOperationResultResponse Update(this IRunbookDraftOperations operations, string automationAccount, RunbookDraftUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IRunbookDraftOperations)s).UpdateAsync(automationAccount, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }