csharp 将Webhooks添加到Azure Data Factory

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 将Webhooks添加到Azure Data Factory相关的知识,希望对你有一定的参考价值。

/*

Create a Resource Alert Rule
Map the Rule to a Webhook
Create/Update the Rule 

*/


Rule resourceAlertRule = new Rule
    {
        Name = alertName,
        Description = String.Format("This alert will be triggered when an {0} is failed", datafactoryName),
        IsEnabled = true,

        Condition = new ManagementEventRuleCondition
        {
            Aggregation = null,
            DataSource = new RuleManagementEventDataSource
            {
                //  ResourceProviderName = "Microsoft.DataFactory",
                Status = "Failed",
                // SubStatus = "FailedExecution",
                ResourceUri = resourceUriFinal,
                OperationName = "RunFinished"
            }
        }
    };
            
            
    var webhookProperties = new Dictionary<string, string>();

    //Custom Properties to be received from Webhooks.
    webhookProperties.Add("resourceGroupName", _resourceGroupName);
    webhookProperties.Add("datafactoryName", datafactoryName);
    webhookProperties.Add("alertName", alertName);
    webhookProperties.Add("customEmailIds", String.Join(",", emailIds));

    RuleAction resourceAlertRuleWebHookAction = new RuleWebhookAction
    {
        ServiceUri = ControlCenter.Common.ControlCenterConfiguration.Adf_AlertWebHookUri,
        Properties = webhookProperties
    };
    //Associate the RuleAction with the Rule  
    resourceAlertRule.Actions = new List<RuleAction>() { };// resourceAlertRuleAction };
    resourceAlertRule.Actions.Add(resourceAlertRuleWebHookAction);
    resourceAlertRule.LastUpdatedTime = DateTime.UtcNow;

    //Commit the Alert configuration   
  AzureOperationResponse alertResponse = managementClient.AlertOperations.CreateOrUpdateRule(_resourceGroupName, new RuleCreateOrUpdateParameters() { Location = _credential.DefaultLocation, Properties = resourceAlertRule });

以上是关于csharp 将Webhooks添加到Azure Data Factory的主要内容,如果未能解决你的问题,请参考以下文章

csharp 通过.net WebAPI将Azure存储专用容器blob下载/流式传输到AngularJS

使用 Zapier webhooks 到 google 表格的 Webflow

csharp Azure功能发布到Blogger

csharp 上传到azure.cs

php [Checkout字段编辑器]向WebHooks API添加自定义字段

当文件上传到 azure 文件共享时,如何添加触发器以将文件从 azure 文件共享移动到 azure blob?