mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.6 KiB
39 lines
1.6 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.RegularExpressions;
|
|
using Squidex.Domain.Apps.Core.HandleRules;
|
|
using Squidex.Domain.Apps.Core.Rules;
|
|
using Squidex.Infrastructure;
|
|
|
|
namespace Squidex.Extensions.Actions.AzureQueue
|
|
{
|
|
[RuleActionHandler(typeof(AzureQueueActionHandler))]
|
|
[RuleAction(Link = "https://azure.microsoft.com/en-us/services/storage/queues/",
|
|
Display = "Send to Azure Queue",
|
|
Description = "Send an event to azure queue storage.")]
|
|
public sealed class AzureQueueAction : RuleAction
|
|
{
|
|
[Required]
|
|
[Display(Name = "Connection String", Description = "The connection string to the storage account.")]
|
|
public string ConnectionString { get; set; }
|
|
|
|
[Required]
|
|
[Display(Name = "Queue", Description = "The name of the queue.")]
|
|
public string Queue { get; set; }
|
|
|
|
protected override IEnumerable<ValidationError> CustomValidate()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(Queue) && !Regex.IsMatch(Queue, "^[a-z][a-z0-9]{2,}(\\-[a-z0-9]+)*$"))
|
|
{
|
|
yield return new ValidationError("Queue must be valid azure queue name.", nameof(Queue));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|