Beispiel #1
0
        public Model.Webhook UpdateWebhook(
            string resourceGroupName,
            string automationAccountName,
            string name,
            Hashtable parameters,
            bool?isEnabled)
        {
            Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
            Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
            using (var request = new RequestSettings(this.automationManagementClient))
            {
                var webhookModel =
                    this.automationManagementClient.Webhooks.Get(resourceGroupName, automationAccountName, name).Webhook;
                var webhookPatchProperties = new WebhookPatchProperties();
                if (webhookModel != null)
                {
                    if (isEnabled != null)
                    {
                        webhookPatchProperties.IsEnabled = isEnabled.Value;
                    }
                    if (parameters != null)
                    {
                        webhookPatchProperties.Parameters =
                            parameters.Cast <DictionaryEntry>()
                            .ToDictionary(kvp => (string)kvp.Key, kvp => (string)kvp.Value);
                    }
                }

                var webhookPatchParameters = new WebhookPatchParameters(name)
                {
                    Properties = webhookPatchProperties
                };
                var webhook =
                    this.automationManagementClient.Webhooks.Patch(
                        resourceGroupName,
                        automationAccountName,
                        webhookPatchParameters).Webhook;

                return(new Model.Webhook(resourceGroupName, automationAccountName, webhook));
            }
        }
 /// <summary>
 /// Patch the webhook identified by webhook name.  (see
 /// http://aka.ms/azureautomationsdk/webhookoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Automation.IWebhookOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The patch parameters for webhook.
 /// </param>
 /// <returns>
 /// The response model for the get webhook operation.
 /// </returns>
 public static Task <WebhookGetResponse> PatchAsync(this IWebhookOperations operations, string resourceGroupName, string automationAccount, WebhookPatchParameters parameters)
 {
     return(operations.PatchAsync(resourceGroupName, automationAccount, parameters, CancellationToken.None));
 }
 /// <summary>
 /// Patch the webhook identified by webhook name.  (see
 /// http://aka.ms/azureautomationsdk/webhookoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Automation.IWebhookOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The patch parameters for webhook.
 /// </param>
 /// <returns>
 /// The response model for the get webhook operation.
 /// </returns>
 public static WebhookGetResponse Patch(this IWebhookOperations operations, string resourceGroupName, string automationAccount, WebhookPatchParameters parameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IWebhookOperations)s).PatchAsync(resourceGroupName, automationAccount, parameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }