Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding rules for subscriptions in avm/res/service-bus/namespace #3558

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 215 additions & 0 deletions avm/res/service-bus/namespace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions avm/res/service-bus/namespace/authorization-rule/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -72,4 +72,4 @@
"value": "[resourceGroup().name]"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -76,4 +76,4 @@
"value": "[resourceGroup().name]"
}
}
}
}
66 changes: 66 additions & 0 deletions avm/res/service-bus/namespace/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading