From 0aa929943c144a6acf34003b5135594d5ced16ff Mon Sep 17 00:00:00 2001 From: Tim D'haeyer Date: Fri, 19 Jul 2024 11:38:38 +0200 Subject: [PATCH 1/3] Add rules for subscriptions --- avm/res/service-bus/namespace/main.bicep | 66 +++++++++++++++++++ .../service-bus/namespace/topic/main.bicep | 1 + .../namespace/topic/subscription/main.bicep | 13 ++++ .../topic/subscription/rule/main.bicep | 40 +++++++++++ 4 files changed, 120 insertions(+) create mode 100644 avm/res/service-bus/namespace/topic/subscription/rule/main.bicep diff --git a/avm/res/service-bus/namespace/main.bicep b/avm/res/service-bus/namespace/main.bicep index a38fd0e5bc..08346c651d 100644 --- a/avm/res/service-bus/namespace/main.bicep +++ b/avm/res/service-bus/namespace/main.bicep @@ -864,6 +864,72 @@ type topicType = { @description('Optional. A value that indicates whether the subscription supports the concept of session.') requiresSession: bool? + @description('Optional. The subscription rules') + rules: { + @description('Required. The name of the service bus namespace topic subscription rule.') + name: string + + @description('Optional. Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression') + action: { + @description('Optional. This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20.') + compatibilityLevel: int? + + @description('Optional. Value that indicates whether the rule action requires preprocessing.') + requiresPreprocessing: bool? + + @description('Optional. SQL expression. e.g. MyProperty=\'ABC\'') + sqlExpression: string? + }? + + @description('Optional. Properties of correlationFilter') + correlationFilter: { + @description('Optional. Content type of the message.') + contentType: string? + + @description('Optional. Identifier of the correlation.') + correlationId: string? + + @description('Optional. Application specific label.') + label: string? + + @description('Optional. Identifier of the message.') + messageId: string? + + @description('Optional. dictionary object for custom filters') + properties: {}[]? + + @description('Optional. Address of the queue to reply to.') + replyTo: string? + + @description('Optional. Session identifier to reply to.') + replyToSessionId: string? + + @description('Optional. Value that indicates whether the rule action requires preprocessing.') + requiresPreprocessing: bool? + + @description('Optional. Session identifier.') + sessionId: string? + + @description('Optional. Address to send to.') + to: string + }? + + @description('Optional. Filter type that is evaluated against a BrokeredMessage.') + filterType: ('CorrelationFilter' | 'SqlFilter')? + + @description('Optional. Properties of sqlFilter') + sqlFilter: { + @description('Optional. This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20.') + compatibilityLevel: int? + + @description('Optional. Value that indicates whether the rule action requires preprocessing.') + requiresPreprocessing: bool? + + @description('Optional. SQL expression. e.g. MyProperty=\'ABC\'') + sqlExpression: string? + }? + }[]? + @description('Optional. Enumerates the possible values for the status of a messaging entity. - Active, Disabled, Restoring, SendDisabled, ReceiveDisabled, Creating, Deleting, Renaming, Unknown.') status: ( | 'Active' diff --git a/avm/res/service-bus/namespace/topic/main.bicep b/avm/res/service-bus/namespace/topic/main.bicep index d59e2a85b1..26c9e80d32 100644 --- a/avm/res/service-bus/namespace/topic/main.bicep +++ b/avm/res/service-bus/namespace/topic/main.bicep @@ -196,6 +196,7 @@ module topic_subscription 'subscription/main.bicep' = [ lockDuration: subscription.?lockDuration ?? 'PT1M' maxDeliveryCount: subscription.?maxDeliveryCount ?? 10 requiresSession: subscription.?requiresSession ?? false + rules: subscription.?rules status: subscription.?status ?? 'Active' } } diff --git a/avm/res/service-bus/namespace/topic/subscription/main.bicep b/avm/res/service-bus/namespace/topic/subscription/main.bicep index d6afd724d8..44743b0c5e 100644 --- a/avm/res/service-bus/namespace/topic/subscription/main.bicep +++ b/avm/res/service-bus/namespace/topic/subscription/main.bicep @@ -50,6 +50,9 @@ param maxDeliveryCount int = 10 @description('Optional. A value that indicates whether the subscription supports the concept of session.') param requiresSession bool = false +@description('Optional. The subscription rules') +param rules array = [] + @description('Optional. Enumerates the possible values for the status of a messaging entity.') @allowed([ 'Active' @@ -93,6 +96,16 @@ resource subscription 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2021 } } +module subscription_rule 'rule/main.bicep' = [ + for (rule, index) in (rules ?? []): { + name: '${deployment().name}-rule-${index}' + params: { + name: rule.name + subscriptionName: subscription.name + } + } +] + @description('The name of the topic subscription.') output name string = subscription.name diff --git a/avm/res/service-bus/namespace/topic/subscription/rule/main.bicep b/avm/res/service-bus/namespace/topic/subscription/rule/main.bicep new file mode 100644 index 0000000000..d09290c093 --- /dev/null +++ b/avm/res/service-bus/namespace/topic/subscription/rule/main.bicep @@ -0,0 +1,40 @@ +metadata name = 'Service Bus Namespace Topic Subscription Rule' +metadata description = 'This module deploys a Service Bus Namespace Topic Subscription Rule.' +metadata owner = 'Azure/module-maintainers' + +@description('Required. The name of the service bus namespace topic subscription rule.') +param name string + +@description('Conditional. The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment.') +param subscriptionName string + +@description('Opional. Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression') +param action object = {} + +@description('Opional. Properties of correlationFilter') +param correlationFilter object = {} + +@description('Optional. Filter type that is evaluated against a BrokeredMessage.') +@allowed([ + 'CorrelationFilter' + 'SqlFilter' +]) +param filterType string? + +@description('Opional. Properties of sqlFilter') +param sqlFilter object = {} + +resource subscription 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2022-10-01-preview' existing = { + name: subscriptionName +} + +resource symbolicname 'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2022-10-01-preview' = { + name: name + parent: subscription + properties: { + action: action + correlationFilter: correlationFilter + filterType: filterType + sqlFilter: sqlFilter + } +} From 71f2aa9c0ca335ff32a7256c8c8edb9d793719d2 Mon Sep 17 00:00:00 2001 From: Tim D'haeyer Date: Mon, 28 Oct 2024 13:39:16 +0100 Subject: [PATCH 2/3] run set-avmmodule --- avm/res/service-bus/namespace/README.md | 215 ++++++++++++ .../namespace/authorization-rule/main.json | 4 +- .../disaster-recovery-config/main.json | 4 +- avm/res/service-bus/namespace/main.json | 329 ++++++++++++++++-- .../migration-configuration/main.json | 4 +- .../namespace/network-rule-set/main.json | 4 +- .../queue/authorization-rule/main.json | 4 +- avm/res/service-bus/namespace/queue/main.json | 8 +- avm/res/service-bus/namespace/topic/README.md | 1 + .../topic/authorization-rule/main.json | 4 +- avm/res/service-bus/namespace/topic/main.json | 131 ++++++- .../namespace/topic/subscription/README.md | 10 + .../namespace/topic/subscription/main.json | 120 ++++++- .../topic/subscription/rule/README.md | 111 ++++++ .../topic/subscription/rule/main.json | 83 +++++ 15 files changed, 988 insertions(+), 44 deletions(-) create mode 100644 avm/res/service-bus/namespace/topic/subscription/rule/README.md create mode 100644 avm/res/service-bus/namespace/topic/subscription/rule/main.json diff --git a/avm/res/service-bus/namespace/README.md b/avm/res/service-bus/namespace/README.md index 4ef8712ce2..2c26a7ca25 100644 --- a/avm/res/service-bus/namespace/README.md +++ b/avm/res/service-bus/namespace/README.md @@ -30,6 +30,7 @@ This module deploys a Service Bus Namespace. | `Microsoft.ServiceBus/namespaces/topics` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics) | | `Microsoft.ServiceBus/namespaces/topics/authorizationRules` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics/authorizationRules) | | `Microsoft.ServiceBus/namespaces/topics/subscriptions` | [2021-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2021-11-01/namespaces/topics/subscriptions) | +| `Microsoft.ServiceBus/namespaces/topics/subscriptions/rules` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics/subscriptions/rules) | ## Usage examples @@ -2742,6 +2743,7 @@ The subscriptions of the topic. | [`lockDuration`](#parameter-topicssubscriptionslockduration) | string | ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. | | [`maxDeliveryCount`](#parameter-topicssubscriptionsmaxdeliverycount) | int | Number of maximum deliveries. A message is automatically deadlettered after this number of deliveries. Default value is 10. | | [`requiresSession`](#parameter-topicssubscriptionsrequiressession) | bool | A value that indicates whether the subscription supports the concept of session. | +| [`rules`](#parameter-topicssubscriptionsrules) | array | The subscription rules | | [`status`](#parameter-topicssubscriptionsstatus) | string | Enumerates the possible values for the status of a messaging entity. - Active, Disabled, Restoring, SendDisabled, ReceiveDisabled, Creating, Deleting, Renaming, Unknown. | ### Parameter: `topics.subscriptions.name` @@ -2876,6 +2878,219 @@ A value that indicates whether the subscription supports the concept of session. - Required: No - Type: bool +### Parameter: `topics.subscriptions.rules` + +The subscription rules + +- Required: No +- Type: array + +**Required parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`name`](#parameter-topicssubscriptionsrulesname) | string | The name of the service bus namespace topic subscription rule. | + +**Optional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`action`](#parameter-topicssubscriptionsrulesaction) | object | Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression | +| [`correlationFilter`](#parameter-topicssubscriptionsrulescorrelationfilter) | object | Properties of correlationFilter | +| [`filterType`](#parameter-topicssubscriptionsrulesfiltertype) | string | Filter type that is evaluated against a BrokeredMessage. | +| [`sqlFilter`](#parameter-topicssubscriptionsrulessqlfilter) | object | Properties of sqlFilter | + +### Parameter: `topics.subscriptions.rules.name` + +The name of the service bus namespace topic subscription rule. + +- Required: Yes +- Type: string + +### Parameter: `topics.subscriptions.rules.action` + +Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression + +- Required: No +- Type: object + +**Optional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`compatibilityLevel`](#parameter-topicssubscriptionsrulesactioncompatibilitylevel) | int | This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. | +| [`requiresPreprocessing`](#parameter-topicssubscriptionsrulesactionrequirespreprocessing) | bool | Value that indicates whether the rule action requires preprocessing. | +| [`sqlExpression`](#parameter-topicssubscriptionsrulesactionsqlexpression) | string | SQL expression. e.g. MyProperty='ABC' | + +### Parameter: `topics.subscriptions.rules.action.compatibilityLevel` + +This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + +- Required: No +- Type: int + +### Parameter: `topics.subscriptions.rules.action.requiresPreprocessing` + +Value that indicates whether the rule action requires preprocessing. + +- Required: No +- Type: bool + +### Parameter: `topics.subscriptions.rules.action.sqlExpression` + +SQL expression. e.g. MyProperty='ABC' + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter` + +Properties of correlationFilter + +- Required: No +- Type: object + +**Optional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`contentType`](#parameter-topicssubscriptionsrulescorrelationfiltercontenttype) | string | Content type of the message. | +| [`correlationId`](#parameter-topicssubscriptionsrulescorrelationfiltercorrelationid) | string | Identifier of the correlation. | +| [`label`](#parameter-topicssubscriptionsrulescorrelationfilterlabel) | string | Application specific label. | +| [`messageId`](#parameter-topicssubscriptionsrulescorrelationfiltermessageid) | string | Identifier of the message. | +| [`properties`](#parameter-topicssubscriptionsrulescorrelationfilterproperties) | array | dictionary object for custom filters | +| [`replyTo`](#parameter-topicssubscriptionsrulescorrelationfilterreplyto) | string | Address of the queue to reply to. | +| [`replyToSessionId`](#parameter-topicssubscriptionsrulescorrelationfilterreplytosessionid) | string | Session identifier to reply to. | +| [`requiresPreprocessing`](#parameter-topicssubscriptionsrulescorrelationfilterrequirespreprocessing) | bool | Value that indicates whether the rule action requires preprocessing. | +| [`sessionId`](#parameter-topicssubscriptionsrulescorrelationfiltersessionid) | string | Session identifier. | +| [`to`](#parameter-topicssubscriptionsrulescorrelationfilterto) | string | Address to send to. | + +### Parameter: `topics.subscriptions.rules.correlationFilter.contentType` + +Content type of the message. + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter.correlationId` + +Identifier of the correlation. + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter.label` + +Application specific label. + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter.messageId` + +Identifier of the message. + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter.properties` + +dictionary object for custom filters + +- Required: No +- Type: array +- Allowed: + ```Bicep + [ + {} + ] + ``` + +### Parameter: `topics.subscriptions.rules.correlationFilter.replyTo` + +Address of the queue to reply to. + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter.replyToSessionId` + +Session identifier to reply to. + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter.requiresPreprocessing` + +Value that indicates whether the rule action requires preprocessing. + +- Required: No +- Type: bool + +### Parameter: `topics.subscriptions.rules.correlationFilter.sessionId` + +Session identifier. + +- Required: No +- Type: string + +### Parameter: `topics.subscriptions.rules.correlationFilter.to` + +Address to send to. + +- Required: Yes +- Type: string + +### Parameter: `topics.subscriptions.rules.filterType` + +Filter type that is evaluated against a BrokeredMessage. + +- Required: No +- Type: string +- Allowed: + ```Bicep + [ + 'CorrelationFilter' + 'SqlFilter' + ] + ``` + +### Parameter: `topics.subscriptions.rules.sqlFilter` + +Properties of sqlFilter + +- Required: No +- Type: object + +**Optional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`compatibilityLevel`](#parameter-topicssubscriptionsrulessqlfiltercompatibilitylevel) | int | This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. | +| [`requiresPreprocessing`](#parameter-topicssubscriptionsrulessqlfilterrequirespreprocessing) | bool | Value that indicates whether the rule action requires preprocessing. | +| [`sqlExpression`](#parameter-topicssubscriptionsrulessqlfiltersqlexpression) | string | SQL expression. e.g. MyProperty='ABC' | + +### Parameter: `topics.subscriptions.rules.sqlFilter.compatibilityLevel` + +This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + +- Required: No +- Type: int + +### Parameter: `topics.subscriptions.rules.sqlFilter.requiresPreprocessing` + +Value that indicates whether the rule action requires preprocessing. + +- Required: No +- Type: bool + +### Parameter: `topics.subscriptions.rules.sqlFilter.sqlExpression` + +SQL expression. e.g. MyProperty='ABC' + +- Required: No +- Type: string + ### Parameter: `topics.subscriptions.status` Enumerates the possible values for the status of a messaging entity. - Active, Disabled, Restoring, SendDisabled, ReceiveDisabled, Creating, Deleting, Renaming, Unknown. diff --git a/avm/res/service-bus/namespace/authorization-rule/main.json b/avm/res/service-bus/namespace/authorization-rule/main.json index 8a0020d80f..69891f3a56 100644 --- a/avm/res/service-bus/namespace/authorization-rule/main.json +++ b/avm/res/service-bus/namespace/authorization-rule/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "16894150656839211462" + "version": "0.30.23.60470", + "templateHash": "4728331591356881277" }, "name": "Service Bus Namespace Authorization Rules", "description": "This module deploys a Service Bus Namespace Authorization Rule.", diff --git a/avm/res/service-bus/namespace/disaster-recovery-config/main.json b/avm/res/service-bus/namespace/disaster-recovery-config/main.json index 9a59ce66a5..f1d4df322e 100644 --- a/avm/res/service-bus/namespace/disaster-recovery-config/main.json +++ b/avm/res/service-bus/namespace/disaster-recovery-config/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "5291933683239809881" + "version": "0.30.23.60470", + "templateHash": "1218226237647695558" }, "name": "Service Bus Namespace Disaster Recovery Configs", "description": "This module deploys a Service Bus Namespace Disaster Recovery Config", diff --git a/avm/res/service-bus/namespace/main.json b/avm/res/service-bus/namespace/main.json index 0dc8f07057..c46be615ea 100644 --- a/avm/res/service-bus/namespace/main.json +++ b/avm/res/service-bus/namespace/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "14555459005793836910" + "version": "0.30.23.60470", + "templateHash": "4851309199341985144" }, "name": "Service Bus Namespaces", "description": "This module deploys a Service Bus Namespace.", @@ -1060,6 +1060,176 @@ "description": "Optional. A value that indicates whether the subscription supports the concept of session." } }, + "rules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "metadata": { + "description": "Required. The name of the service bus namespace topic subscription rule." + } + }, + "action": { + "type": "object", + "properties": { + "compatibilityLevel": { + "type": "int", + "nullable": true, + "metadata": { + "description": "Optional. This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20." + } + }, + "requiresPreprocessing": { + "type": "bool", + "nullable": true, + "metadata": { + "description": "Optional. Value that indicates whether the rule action requires preprocessing." + } + }, + "sqlExpression": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. SQL expression. e.g. MyProperty='ABC'" + } + } + }, + "nullable": true, + "metadata": { + "description": "Optional. Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression" + } + }, + "correlationFilter": { + "type": "object", + "properties": { + "contentType": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. Content type of the message." + } + }, + "correlationId": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. Identifier of the correlation." + } + }, + "label": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. Application specific label." + } + }, + "messageId": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. Identifier of the message." + } + }, + "properties": { + "type": "array", + "allowedValues": [ + {} + ], + "nullable": true, + "metadata": { + "description": "Optional. dictionary object for custom filters" + } + }, + "replyTo": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. Address of the queue to reply to." + } + }, + "replyToSessionId": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. Session identifier to reply to." + } + }, + "requiresPreprocessing": { + "type": "bool", + "nullable": true, + "metadata": { + "description": "Optional. Value that indicates whether the rule action requires preprocessing." + } + }, + "sessionId": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. Session identifier." + } + }, + "to": { + "type": "string", + "metadata": { + "description": "Optional. Address to send to." + } + } + }, + "nullable": true, + "metadata": { + "description": "Optional. Properties of correlationFilter" + } + }, + "filterType": { + "type": "string", + "allowedValues": [ + "CorrelationFilter", + "SqlFilter" + ], + "nullable": true, + "metadata": { + "description": "Optional. Filter type that is evaluated against a BrokeredMessage." + } + }, + "sqlFilter": { + "type": "object", + "properties": { + "compatibilityLevel": { + "type": "int", + "nullable": true, + "metadata": { + "description": "Optional. This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20." + } + }, + "requiresPreprocessing": { + "type": "bool", + "nullable": true, + "metadata": { + "description": "Optional. Value that indicates whether the rule action requires preprocessing." + } + }, + "sqlExpression": { + "type": "string", + "nullable": true, + "metadata": { + "description": "Optional. SQL expression. e.g. MyProperty='ABC'" + } + } + }, + "nullable": true, + "metadata": { + "description": "Optional. Properties of sqlFilter" + } + } + } + }, + "nullable": true, + "metadata": { + "description": "Optional. The subscription rules" + } + }, "status": { "type": "string", "allowedValues": [ @@ -1468,8 +1638,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "16894150656839211462" + "version": "0.30.23.60470", + "templateHash": "4728331591356881277" }, "name": "Service Bus Namespace Authorization Rules", "description": "This module deploys a Service Bus Namespace Authorization Rule.", @@ -1572,8 +1742,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "5291933683239809881" + "version": "0.30.23.60470", + "templateHash": "1218226237647695558" }, "name": "Service Bus Namespace Disaster Recovery Configs", "description": "This module deploys a Service Bus Namespace Disaster Recovery Config", @@ -1677,8 +1847,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "1979996026271958468" + "version": "0.30.23.60470", + "templateHash": "16589713685358551002" }, "name": "Service Bus Namespace Migration Configuration", "description": "This module deploys a Service Bus Namespace Migration Configuration.", @@ -1782,8 +1952,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "2567977628816180304" + "version": "0.30.23.60470", + "templateHash": "10055705590102866988" }, "name": "Service Bus Namespace Network Rule Sets", "description": "This module deploys a ServiceBus Namespace Network Rule Set.", @@ -1982,8 +2152,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "16865717026433728292" + "version": "0.30.23.60470", + "templateHash": "7498488486983491567" }, "name": "Service Bus Namespace Queue", "description": "This module deploys a Service Bus Namespace Queue.", @@ -2356,8 +2526,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "15391519662555721522" + "version": "0.30.23.60470", + "templateHash": "13793175890494658919" }, "name": "Service Bus Namespace Queue Authorization Rules", "description": "This module deploys a Service Bus Namespace Queue Authorization Rule.", @@ -2537,8 +2707,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "10953229984809736827" + "version": "0.30.23.60470", + "templateHash": "9239479891739811869" }, "name": "Service Bus Namespace Topic", "description": "This module deploys a Service Bus Namespace Topic.", @@ -3020,8 +3190,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "11438474699882792252" + "version": "0.30.23.60470", + "templateHash": "1348283370469099109" }, "name": "Service Bus Namespace Topic Authorization Rules", "description": "This module deploys a Service Bus Namespace Topic Authorization Rule.", @@ -3160,6 +3330,9 @@ "requiresSession": { "value": "[coalesce(tryGet(coalesce(parameters('subscriptions'), createArray())[copyIndex()], 'requiresSession'), false())]" }, + "rules": { + "value": "[tryGet(coalesce(parameters('subscriptions'), createArray())[copyIndex()], 'rules')]" + }, "status": { "value": "[coalesce(tryGet(coalesce(parameters('subscriptions'), createArray())[copyIndex()], 'status'), 'Active')]" } @@ -3170,8 +3343,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "13876094385420679023" + "version": "0.30.23.60470", + "templateHash": "10276453737025789282" }, "name": "Service Bus Namespace Topic Subscription", "description": "This module deploys a Service Bus Namespace Topic Subscription.", @@ -3287,6 +3460,13 @@ "description": "Optional. A value that indicates whether the subscription supports the concept of session." } }, + "rules": { + "type": "array", + "defaultValue": [], + "metadata": { + "description": "Optional. The subscription rules" + } + }, "status": { "type": "string", "defaultValue": "Active", @@ -3327,6 +3507,115 @@ "requiresSession": "[parameters('requiresSession')]", "status": "[parameters('status')]" } + }, + { + "copy": { + "name": "subscription_rule", + "count": "[length(coalesce(parameters('rules'), createArray()))]" + }, + "type": "Microsoft.Resources/deployments", + "apiVersion": "2022-09-01", + "name": "[format('{0}-rule-{1}', deployment().name, copyIndex())]", + "properties": { + "expressionEvaluationOptions": { + "scope": "inner" + }, + "mode": "Incremental", + "parameters": { + "name": { + "value": "[coalesce(parameters('rules'), createArray())[copyIndex()].name]" + }, + "subscriptionName": { + "value": "[parameters('name')]" + } + }, + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "languageVersion": "2.0", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.30.23.60470", + "templateHash": "11445949177763307107" + }, + "name": "Service Bus Namespace Topic Subscription Rule", + "description": "This module deploys a Service Bus Namespace Topic Subscription Rule.", + "owner": "Azure/module-maintainers" + }, + "parameters": { + "name": { + "type": "string", + "metadata": { + "description": "Required. The name of the service bus namespace topic subscription rule." + } + }, + "subscriptionName": { + "type": "string", + "metadata": { + "description": "Conditional. The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment." + } + }, + "action": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression" + } + }, + "correlationFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of correlationFilter" + } + }, + "filterType": { + "type": "string", + "nullable": true, + "allowedValues": [ + "CorrelationFilter", + "SqlFilter" + ], + "metadata": { + "description": "Optional. Filter type that is evaluated against a BrokeredMessage." + } + }, + "sqlFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of sqlFilter" + } + } + }, + "resources": { + "subscription": { + "existing": true, + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", + "apiVersion": "2022-10-01-preview", + "name": "[parameters('subscriptionName')]" + }, + "symbolicname": { + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules", + "apiVersion": "2022-10-01-preview", + "name": "[format('{0}/{1}/{2}/{3}', split(parameters('subscriptionName'), '/')[0], split(parameters('subscriptionName'), '/')[1], split(parameters('subscriptionName'), '/')[2], parameters('name'))]", + "properties": { + "action": "[parameters('action')]", + "correlationFilter": "[parameters('correlationFilter')]", + "filterType": "[parameters('filterType')]", + "sqlFilter": "[parameters('sqlFilter')]" + }, + "dependsOn": [ + "subscription" + ] + } + } + } + }, + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', parameters('namespaceName'), parameters('topicName'), parameters('name'))]" + ] } ], "outputs": { diff --git a/avm/res/service-bus/namespace/migration-configuration/main.json b/avm/res/service-bus/namespace/migration-configuration/main.json index 4b7f623c4b..58dfcc663d 100644 --- a/avm/res/service-bus/namespace/migration-configuration/main.json +++ b/avm/res/service-bus/namespace/migration-configuration/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "1979996026271958468" + "version": "0.30.23.60470", + "templateHash": "16589713685358551002" }, "name": "Service Bus Namespace Migration Configuration", "description": "This module deploys a Service Bus Namespace Migration Configuration.", diff --git a/avm/res/service-bus/namespace/network-rule-set/main.json b/avm/res/service-bus/namespace/network-rule-set/main.json index 58c40bbf6f..31d9ccc68e 100644 --- a/avm/res/service-bus/namespace/network-rule-set/main.json +++ b/avm/res/service-bus/namespace/network-rule-set/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "2567977628816180304" + "version": "0.30.23.60470", + "templateHash": "10055705590102866988" }, "name": "Service Bus Namespace Network Rule Sets", "description": "This module deploys a ServiceBus Namespace Network Rule Set.", diff --git a/avm/res/service-bus/namespace/queue/authorization-rule/main.json b/avm/res/service-bus/namespace/queue/authorization-rule/main.json index 978ee618a5..7f4595b2c4 100644 --- a/avm/res/service-bus/namespace/queue/authorization-rule/main.json +++ b/avm/res/service-bus/namespace/queue/authorization-rule/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "15391519662555721522" + "version": "0.30.23.60470", + "templateHash": "13793175890494658919" }, "name": "Service Bus Namespace Queue Authorization Rules", "description": "This module deploys a Service Bus Namespace Queue Authorization Rule.", diff --git a/avm/res/service-bus/namespace/queue/main.json b/avm/res/service-bus/namespace/queue/main.json index d7f75e9c96..76db61f294 100644 --- a/avm/res/service-bus/namespace/queue/main.json +++ b/avm/res/service-bus/namespace/queue/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "16865717026433728292" + "version": "0.30.23.60470", + "templateHash": "7498488486983491567" }, "name": "Service Bus Namespace Queue", "description": "This module deploys a Service Bus Namespace Queue.", @@ -379,8 +379,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "15391519662555721522" + "version": "0.30.23.60470", + "templateHash": "13793175890494658919" }, "name": "Service Bus Namespace Queue Authorization Rules", "description": "This module deploys a Service Bus Namespace Queue Authorization Rule.", diff --git a/avm/res/service-bus/namespace/topic/README.md b/avm/res/service-bus/namespace/topic/README.md index 3da5c7b960..8f85eaddc4 100644 --- a/avm/res/service-bus/namespace/topic/README.md +++ b/avm/res/service-bus/namespace/topic/README.md @@ -19,6 +19,7 @@ This module deploys a Service Bus Namespace Topic. | `Microsoft.ServiceBus/namespaces/topics` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics) | | `Microsoft.ServiceBus/namespaces/topics/authorizationRules` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics/authorizationRules) | | `Microsoft.ServiceBus/namespaces/topics/subscriptions` | [2021-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2021-11-01/namespaces/topics/subscriptions) | +| `Microsoft.ServiceBus/namespaces/topics/subscriptions/rules` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics/subscriptions/rules) | ## Parameters diff --git a/avm/res/service-bus/namespace/topic/authorization-rule/main.json b/avm/res/service-bus/namespace/topic/authorization-rule/main.json index cbe91a6bb8..f3ac22d34d 100644 --- a/avm/res/service-bus/namespace/topic/authorization-rule/main.json +++ b/avm/res/service-bus/namespace/topic/authorization-rule/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "11438474699882792252" + "version": "0.30.23.60470", + "templateHash": "1348283370469099109" }, "name": "Service Bus Namespace Topic Authorization Rules", "description": "This module deploys a Service Bus Namespace Topic Authorization Rule.", diff --git a/avm/res/service-bus/namespace/topic/main.json b/avm/res/service-bus/namespace/topic/main.json index 30c735aa77..35e3180049 100644 --- a/avm/res/service-bus/namespace/topic/main.json +++ b/avm/res/service-bus/namespace/topic/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "10953229984809736827" + "version": "0.30.23.60470", + "templateHash": "9239479891739811869" }, "name": "Service Bus Namespace Topic", "description": "This module deploys a Service Bus Namespace Topic.", @@ -488,8 +488,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "11438474699882792252" + "version": "0.30.23.60470", + "templateHash": "1348283370469099109" }, "name": "Service Bus Namespace Topic Authorization Rules", "description": "This module deploys a Service Bus Namespace Topic Authorization Rule.", @@ -628,6 +628,9 @@ "requiresSession": { "value": "[coalesce(tryGet(coalesce(parameters('subscriptions'), createArray())[copyIndex()], 'requiresSession'), false())]" }, + "rules": { + "value": "[tryGet(coalesce(parameters('subscriptions'), createArray())[copyIndex()], 'rules')]" + }, "status": { "value": "[coalesce(tryGet(coalesce(parameters('subscriptions'), createArray())[copyIndex()], 'status'), 'Active')]" } @@ -638,8 +641,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "13876094385420679023" + "version": "0.30.23.60470", + "templateHash": "10276453737025789282" }, "name": "Service Bus Namespace Topic Subscription", "description": "This module deploys a Service Bus Namespace Topic Subscription.", @@ -755,6 +758,13 @@ "description": "Optional. A value that indicates whether the subscription supports the concept of session." } }, + "rules": { + "type": "array", + "defaultValue": [], + "metadata": { + "description": "Optional. The subscription rules" + } + }, "status": { "type": "string", "defaultValue": "Active", @@ -795,6 +805,115 @@ "requiresSession": "[parameters('requiresSession')]", "status": "[parameters('status')]" } + }, + { + "copy": { + "name": "subscription_rule", + "count": "[length(coalesce(parameters('rules'), createArray()))]" + }, + "type": "Microsoft.Resources/deployments", + "apiVersion": "2022-09-01", + "name": "[format('{0}-rule-{1}', deployment().name, copyIndex())]", + "properties": { + "expressionEvaluationOptions": { + "scope": "inner" + }, + "mode": "Incremental", + "parameters": { + "name": { + "value": "[coalesce(parameters('rules'), createArray())[copyIndex()].name]" + }, + "subscriptionName": { + "value": "[parameters('name')]" + } + }, + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "languageVersion": "2.0", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.30.23.60470", + "templateHash": "11445949177763307107" + }, + "name": "Service Bus Namespace Topic Subscription Rule", + "description": "This module deploys a Service Bus Namespace Topic Subscription Rule.", + "owner": "Azure/module-maintainers" + }, + "parameters": { + "name": { + "type": "string", + "metadata": { + "description": "Required. The name of the service bus namespace topic subscription rule." + } + }, + "subscriptionName": { + "type": "string", + "metadata": { + "description": "Conditional. The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment." + } + }, + "action": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression" + } + }, + "correlationFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of correlationFilter" + } + }, + "filterType": { + "type": "string", + "nullable": true, + "allowedValues": [ + "CorrelationFilter", + "SqlFilter" + ], + "metadata": { + "description": "Optional. Filter type that is evaluated against a BrokeredMessage." + } + }, + "sqlFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of sqlFilter" + } + } + }, + "resources": { + "subscription": { + "existing": true, + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", + "apiVersion": "2022-10-01-preview", + "name": "[parameters('subscriptionName')]" + }, + "symbolicname": { + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules", + "apiVersion": "2022-10-01-preview", + "name": "[format('{0}/{1}/{2}/{3}', split(parameters('subscriptionName'), '/')[0], split(parameters('subscriptionName'), '/')[1], split(parameters('subscriptionName'), '/')[2], parameters('name'))]", + "properties": { + "action": "[parameters('action')]", + "correlationFilter": "[parameters('correlationFilter')]", + "filterType": "[parameters('filterType')]", + "sqlFilter": "[parameters('sqlFilter')]" + }, + "dependsOn": [ + "subscription" + ] + } + } + } + }, + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', parameters('namespaceName'), parameters('topicName'), parameters('name'))]" + ] } ], "outputs": { diff --git a/avm/res/service-bus/namespace/topic/subscription/README.md b/avm/res/service-bus/namespace/topic/subscription/README.md index 7802e34205..76282c0b39 100644 --- a/avm/res/service-bus/namespace/topic/subscription/README.md +++ b/avm/res/service-bus/namespace/topic/subscription/README.md @@ -15,6 +15,7 @@ This module deploys a Service Bus Namespace Topic Subscription. | Resource Type | API Version | | :-- | :-- | | `Microsoft.ServiceBus/namespaces/topics/subscriptions` | [2021-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2021-11-01/namespaces/topics/subscriptions) | +| `Microsoft.ServiceBus/namespaces/topics/subscriptions/rules` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics/subscriptions/rules) | ## Parameters @@ -48,6 +49,7 @@ This module deploys a Service Bus Namespace Topic Subscription. | [`lockDuration`](#parameter-lockduration) | string | ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. | | [`maxDeliveryCount`](#parameter-maxdeliverycount) | int | Number of maximum deliveries. A message is automatically deadlettered after this number of deliveries. Default value is 10. | | [`requiresSession`](#parameter-requiressession) | bool | A value that indicates whether the subscription supports the concept of session. | +| [`rules`](#parameter-rules) | array | The subscription rules | | [`status`](#parameter-status) | string | Enumerates the possible values for the status of a messaging entity. | ### Parameter: `name` @@ -175,6 +177,14 @@ A value that indicates whether the subscription supports the concept of session. - Type: bool - Default: `False` +### Parameter: `rules` + +The subscription rules + +- Required: No +- Type: array +- Default: `[]` + ### Parameter: `status` Enumerates the possible values for the status of a messaging entity. diff --git a/avm/res/service-bus/namespace/topic/subscription/main.json b/avm/res/service-bus/namespace/topic/subscription/main.json index c9949f08b8..7e663594aa 100644 --- a/avm/res/service-bus/namespace/topic/subscription/main.json +++ b/avm/res/service-bus/namespace/topic/subscription/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.28.1.47646", - "templateHash": "13876094385420679023" + "version": "0.30.23.60470", + "templateHash": "10276453737025789282" }, "name": "Service Bus Namespace Topic Subscription", "description": "This module deploys a Service Bus Namespace Topic Subscription.", @@ -121,6 +121,13 @@ "description": "Optional. A value that indicates whether the subscription supports the concept of session." } }, + "rules": { + "type": "array", + "defaultValue": [], + "metadata": { + "description": "Optional. The subscription rules" + } + }, "status": { "type": "string", "defaultValue": "Active", @@ -161,6 +168,115 @@ "requiresSession": "[parameters('requiresSession')]", "status": "[parameters('status')]" } + }, + { + "copy": { + "name": "subscription_rule", + "count": "[length(coalesce(parameters('rules'), createArray()))]" + }, + "type": "Microsoft.Resources/deployments", + "apiVersion": "2022-09-01", + "name": "[format('{0}-rule-{1}', deployment().name, copyIndex())]", + "properties": { + "expressionEvaluationOptions": { + "scope": "inner" + }, + "mode": "Incremental", + "parameters": { + "name": { + "value": "[coalesce(parameters('rules'), createArray())[copyIndex()].name]" + }, + "subscriptionName": { + "value": "[parameters('name')]" + } + }, + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "languageVersion": "2.0", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.30.23.60470", + "templateHash": "11445949177763307107" + }, + "name": "Service Bus Namespace Topic Subscription Rule", + "description": "This module deploys a Service Bus Namespace Topic Subscription Rule.", + "owner": "Azure/module-maintainers" + }, + "parameters": { + "name": { + "type": "string", + "metadata": { + "description": "Required. The name of the service bus namespace topic subscription rule." + } + }, + "subscriptionName": { + "type": "string", + "metadata": { + "description": "Conditional. The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment." + } + }, + "action": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression" + } + }, + "correlationFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of correlationFilter" + } + }, + "filterType": { + "type": "string", + "nullable": true, + "allowedValues": [ + "CorrelationFilter", + "SqlFilter" + ], + "metadata": { + "description": "Optional. Filter type that is evaluated against a BrokeredMessage." + } + }, + "sqlFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of sqlFilter" + } + } + }, + "resources": { + "subscription": { + "existing": true, + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", + "apiVersion": "2022-10-01-preview", + "name": "[parameters('subscriptionName')]" + }, + "symbolicname": { + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules", + "apiVersion": "2022-10-01-preview", + "name": "[format('{0}/{1}/{2}/{3}', split(parameters('subscriptionName'), '/')[0], split(parameters('subscriptionName'), '/')[1], split(parameters('subscriptionName'), '/')[2], parameters('name'))]", + "properties": { + "action": "[parameters('action')]", + "correlationFilter": "[parameters('correlationFilter')]", + "filterType": "[parameters('filterType')]", + "sqlFilter": "[parameters('sqlFilter')]" + }, + "dependsOn": [ + "subscription" + ] + } + } + } + }, + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', parameters('namespaceName'), parameters('topicName'), parameters('name'))]" + ] } ], "outputs": { diff --git a/avm/res/service-bus/namespace/topic/subscription/rule/README.md b/avm/res/service-bus/namespace/topic/subscription/rule/README.md new file mode 100644 index 0000000000..2b5be0291f --- /dev/null +++ b/avm/res/service-bus/namespace/topic/subscription/rule/README.md @@ -0,0 +1,111 @@ +# Service Bus Namespace Topic Subscription Rule `[Microsoft.ServiceBus/namespaces/topics/subscriptions/rules]` + +This module deploys a Service Bus Namespace Topic Subscription Rule. + +## Navigation + +- [Resource Types](#Resource-Types) +- [Parameters](#Parameters) +- [Outputs](#Outputs) +- [Cross-referenced modules](#Cross-referenced-modules) +- [Data Collection](#Data-Collection) + +## Resource Types + +| Resource Type | API Version | +| :-- | :-- | +| `Microsoft.ServiceBus/namespaces/topics/subscriptions/rules` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ServiceBus/2022-10-01-preview/namespaces/topics/subscriptions/rules) | + +## Parameters + +**Required parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`name`](#parameter-name) | string | The name of the service bus namespace topic subscription rule. | + +**Conditional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`subscriptionName`](#parameter-subscriptionname) | string | The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment. | + +**Optional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`filterType`](#parameter-filtertype) | string | Filter type that is evaluated against a BrokeredMessage. | + +**Opional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`action`](#parameter-action) | object | Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression | +| [`correlationFilter`](#parameter-correlationfilter) | object | Properties of correlationFilter | +| [`sqlFilter`](#parameter-sqlfilter) | object | Properties of sqlFilter | + +### Parameter: `name` + +The name of the service bus namespace topic subscription rule. + +- Required: Yes +- Type: string + +### Parameter: `subscriptionName` + +The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment. + +- Required: Yes +- Type: string + +### Parameter: `filterType` + +Filter type that is evaluated against a BrokeredMessage. + +- Required: No +- Type: string +- Allowed: + ```Bicep + [ + 'CorrelationFilter' + 'SqlFilter' + ] + ``` + +### Parameter: `action` + +Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression + +- Required: No +- Type: object +- Default: `{}` + +### Parameter: `correlationFilter` + +Properties of correlationFilter + +- Required: No +- Type: object +- Default: `{}` + +### Parameter: `sqlFilter` + +Properties of sqlFilter + +- Required: No +- Type: object +- Default: `{}` + + +## Outputs + +| Output | Type | +| :-- | :-- | + +## Cross-referenced modules + +_None_ + +## Data Collection + +The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at . You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. diff --git a/avm/res/service-bus/namespace/topic/subscription/rule/main.json b/avm/res/service-bus/namespace/topic/subscription/rule/main.json new file mode 100644 index 0000000000..dee0a6c895 --- /dev/null +++ b/avm/res/service-bus/namespace/topic/subscription/rule/main.json @@ -0,0 +1,83 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "languageVersion": "2.0", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.30.23.60470", + "templateHash": "11445949177763307107" + }, + "name": "Service Bus Namespace Topic Subscription Rule", + "description": "This module deploys a Service Bus Namespace Topic Subscription Rule.", + "owner": "Azure/module-maintainers" + }, + "parameters": { + "name": { + "type": "string", + "metadata": { + "description": "Required. The name of the service bus namespace topic subscription rule." + } + }, + "subscriptionName": { + "type": "string", + "metadata": { + "description": "Conditional. The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment." + } + }, + "action": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression" + } + }, + "correlationFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of correlationFilter" + } + }, + "filterType": { + "type": "string", + "nullable": true, + "allowedValues": [ + "CorrelationFilter", + "SqlFilter" + ], + "metadata": { + "description": "Optional. Filter type that is evaluated against a BrokeredMessage." + } + }, + "sqlFilter": { + "type": "object", + "defaultValue": {}, + "metadata": { + "description": "Opional. Properties of sqlFilter" + } + } + }, + "resources": { + "subscription": { + "existing": true, + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", + "apiVersion": "2022-10-01-preview", + "name": "[parameters('subscriptionName')]" + }, + "symbolicname": { + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules", + "apiVersion": "2022-10-01-preview", + "name": "[format('{0}/{1}/{2}/{3}', split(parameters('subscriptionName'), '/')[0], split(parameters('subscriptionName'), '/')[1], split(parameters('subscriptionName'), '/')[2], parameters('name'))]", + "properties": { + "action": "[parameters('action')]", + "correlationFilter": "[parameters('correlationFilter')]", + "filterType": "[parameters('filterType')]", + "sqlFilter": "[parameters('sqlFilter')]" + }, + "dependsOn": [ + "subscription" + ] + } + } +} \ No newline at end of file From f6642827ee9a8da8a94482e7171961226a064c1c Mon Sep 17 00:00:00 2001 From: Tim D'haeyer Date: Mon, 28 Oct 2024 14:58:22 +0100 Subject: [PATCH 3/3] Changes after testing --- .../namespace/authorization-rule/main.json | 2 +- .../disaster-recovery-config/main.json | 2 +- avm/res/service-bus/namespace/main.json | 2 +- .../migration-configuration/main.json | 2 +- .../namespace/network-rule-set/main.json | 2 +- .../queue/authorization-rule/main.json | 2 +- avm/res/service-bus/namespace/queue/main.json | 2 +- .../tests/e2e/with-rule/main.test.bicep | 70 +++++++++++++++++++ .../topic/authorization-rule/main.json | 2 +- avm/res/service-bus/namespace/topic/main.json | 2 +- .../namespace/topic/subscription/main.bicep | 6 ++ .../namespace/topic/subscription/main.json | 2 +- .../topic/subscription/rule/main.bicep | 20 +++++- .../topic/subscription/rule/main.json | 2 +- 14 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 avm/res/service-bus/namespace/tests/e2e/with-rule/main.test.bicep diff --git a/avm/res/service-bus/namespace/authorization-rule/main.json b/avm/res/service-bus/namespace/authorization-rule/main.json index 69891f3a56..dd5b019965 100644 --- a/avm/res/service-bus/namespace/authorization-rule/main.json +++ b/avm/res/service-bus/namespace/authorization-rule/main.json @@ -72,4 +72,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/disaster-recovery-config/main.json b/avm/res/service-bus/namespace/disaster-recovery-config/main.json index f1d4df322e..4ad1b0b8e4 100644 --- a/avm/res/service-bus/namespace/disaster-recovery-config/main.json +++ b/avm/res/service-bus/namespace/disaster-recovery-config/main.json @@ -76,4 +76,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/main.json b/avm/res/service-bus/namespace/main.json index c46be615ea..53c0dbc464 100644 --- a/avm/res/service-bus/namespace/main.json +++ b/avm/res/service-bus/namespace/main.json @@ -4378,4 +4378,4 @@ "value": "[reference('serviceBusNamespace', '2022-10-01-preview', 'full').location]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/migration-configuration/main.json b/avm/res/service-bus/namespace/migration-configuration/main.json index 58dfcc663d..328a794bc1 100644 --- a/avm/res/service-bus/namespace/migration-configuration/main.json +++ b/avm/res/service-bus/namespace/migration-configuration/main.json @@ -67,4 +67,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/network-rule-set/main.json b/avm/res/service-bus/namespace/network-rule-set/main.json index 31d9ccc68e..b38bc9d190 100644 --- a/avm/res/service-bus/namespace/network-rule-set/main.json +++ b/avm/res/service-bus/namespace/network-rule-set/main.json @@ -113,4 +113,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/queue/authorization-rule/main.json b/avm/res/service-bus/namespace/queue/authorization-rule/main.json index 7f4595b2c4..de1f29bfb3 100644 --- a/avm/res/service-bus/namespace/queue/authorization-rule/main.json +++ b/avm/res/service-bus/namespace/queue/authorization-rule/main.json @@ -76,4 +76,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/queue/main.json b/avm/res/service-bus/namespace/queue/main.json index 76db61f294..5d69e04600 100644 --- a/avm/res/service-bus/namespace/queue/main.json +++ b/avm/res/service-bus/namespace/queue/main.json @@ -481,4 +481,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/tests/e2e/with-rule/main.test.bicep b/avm/res/service-bus/namespace/tests/e2e/with-rule/main.test.bicep new file mode 100644 index 0000000000..8e453fa9f5 --- /dev/null +++ b/avm/res/service-bus/namespace/tests/e2e/with-rule/main.test.bicep @@ -0,0 +1,70 @@ +targetScope = 'subscription' + +metadata name = 'Using only defaults' +metadata description = 'This instance deploys the module with the minimum set of required parameters.' + +// ========== // +// Parameters // +// ========== // + +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'dep-${namePrefix}-servicebus.namespaces-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to.') +param resourceLocation string = deployment().location + +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') +param serviceShort string = 'sbnmin' + +@description('Optional. A token to inject into the name of each resource.') +param namePrefix string = '#_namePrefix_#' + +// ============ // +// Dependencies // +// ============ // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: resourceLocation +} + +// ============== // +// Test Execution // +// ============== // + +@batchSize(1) +module testDeployment '../../../main.bicep' = [ + for iteration in ['init', 'idem']: { + scope: resourceGroup + name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}-${iteration}' + params: { + name: '${namePrefix}${serviceShort}001' + location: resourceLocation + skuObject: { + name: 'Standard' + } + topics: [ + { + name: 'sbt-${namePrefix}-test' + subscriptions: [ + { + name: 'sbt-${namePrefix}-test-subsc' + rules: [ + { + name: '${namePrefix}-test-filter' + filterType: 'SqlFilter' + sqlFilter: { + sqlExpression: 'Test=1' + } + } + ] + } + ] + } + ] + } + } +] diff --git a/avm/res/service-bus/namespace/topic/authorization-rule/main.json b/avm/res/service-bus/namespace/topic/authorization-rule/main.json index f3ac22d34d..8e59073eb3 100644 --- a/avm/res/service-bus/namespace/topic/authorization-rule/main.json +++ b/avm/res/service-bus/namespace/topic/authorization-rule/main.json @@ -76,4 +76,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/topic/main.json b/avm/res/service-bus/namespace/topic/main.json index 35e3180049..0cc4e9bfe1 100644 --- a/avm/res/service-bus/namespace/topic/main.json +++ b/avm/res/service-bus/namespace/topic/main.json @@ -970,4 +970,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/topic/subscription/main.bicep b/avm/res/service-bus/namespace/topic/subscription/main.bicep index 44743b0c5e..6f071e5042 100644 --- a/avm/res/service-bus/namespace/topic/subscription/main.bicep +++ b/avm/res/service-bus/namespace/topic/subscription/main.bicep @@ -102,6 +102,12 @@ module subscription_rule 'rule/main.bicep' = [ params: { name: rule.name subscriptionName: subscription.name + namespaceName: namespaceName + topicName: topicName + action: rule.?action + correlationFilter: rule.?correlationFilter + filterType: rule.?filterType + sqlFilter: rule.?sqlFilter } } ] diff --git a/avm/res/service-bus/namespace/topic/subscription/main.json b/avm/res/service-bus/namespace/topic/subscription/main.json index 7e663594aa..6b49d540d9 100644 --- a/avm/res/service-bus/namespace/topic/subscription/main.json +++ b/avm/res/service-bus/namespace/topic/subscription/main.json @@ -302,4 +302,4 @@ "value": "[resourceGroup().name]" } } -} \ No newline at end of file +} diff --git a/avm/res/service-bus/namespace/topic/subscription/rule/main.bicep b/avm/res/service-bus/namespace/topic/subscription/rule/main.bicep index d09290c093..94ba855f69 100644 --- a/avm/res/service-bus/namespace/topic/subscription/rule/main.bicep +++ b/avm/res/service-bus/namespace/topic/subscription/rule/main.bicep @@ -5,6 +5,12 @@ metadata owner = 'Azure/module-maintainers' @description('Required. The name of the service bus namespace topic subscription rule.') param name string +@description('Conditional. The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment.') +param namespaceName string + +@description('Conditional. The name of the parent Service Bus Namespace Topic. Required if the template is used in a standalone deployment.') +param topicName string + @description('Conditional. The name of the parent Service Bus Namespace. Required if the template is used in a standalone deployment.') param subscriptionName string @@ -24,13 +30,21 @@ param filterType string? @description('Opional. Properties of sqlFilter') param sqlFilter object = {} -resource subscription 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2022-10-01-preview' existing = { - name: subscriptionName +resource namespace 'Microsoft.ServiceBus/namespaces@2022-10-01-preview' existing = { + name: namespaceName + + resource topic 'topics@2022-10-01-preview' existing = { + name: topicName + + resource subscription 'subscriptions@2021-11-01' existing = { + name: subscriptionName + } + } } resource symbolicname 'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2022-10-01-preview' = { name: name - parent: subscription + parent: namespace::topic::subscription properties: { action: action correlationFilter: correlationFilter diff --git a/avm/res/service-bus/namespace/topic/subscription/rule/main.json b/avm/res/service-bus/namespace/topic/subscription/rule/main.json index dee0a6c895..f813193586 100644 --- a/avm/res/service-bus/namespace/topic/subscription/rule/main.json +++ b/avm/res/service-bus/namespace/topic/subscription/rule/main.json @@ -80,4 +80,4 @@ ] } } -} \ No newline at end of file +}