Skip to content

Commit

Permalink
Made module type singular
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Oct 31, 2024
1 parent ebfecf1 commit 7a487e2
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 49 deletions.
35 changes: 18 additions & 17 deletions avm/res/api-management/service/logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ This module deploys an API Management Service Logger.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`loggerType`](#parameter-loggertype) | string | Logger type. |
| [`name`](#parameter-name) | string | Resource Name. |
| [`type`](#parameter-type) | string | Logger type. |

**Conditional parameters**

Expand All @@ -35,10 +35,17 @@ This module deploys an API Management Service Logger.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`description`](#parameter-description) | string | Logger description. |
| [`isBuffered`](#parameter-isbuffered) | bool | Whether records are buffered in the logger before publishing. |
| [`loggerDescription`](#parameter-loggerdescription) | string | Logger description. |

### Parameter: `loggerType`
### Parameter: `name`

Resource Name.

- Required: Yes
- Type: string

### Parameter: `type`

Logger type.

Expand All @@ -53,13 +60,6 @@ Logger type.
]
```

### Parameter: `name`

Resource Name.

- Required: Yes
- Type: string

### Parameter: `apiManagementServiceName`

The name of the parent API Management service. Required if the template is used in a standalone deployment.
Expand All @@ -81,6 +81,14 @@ Required if loggerType = applicationInsights or azureEventHub. Azure Resource Id
- Required: Yes
- Type: string

### Parameter: `description`

Logger description.

- Required: No
- Type: string
- Default: `''`

### Parameter: `isBuffered`

Whether records are buffered in the logger before publishing.
Expand All @@ -89,13 +97,6 @@ Whether records are buffered in the logger before publishing.
- Type: bool
- Default: `True`

### Parameter: `loggerDescription`

Logger description.

- Required: Yes
- Type: string

## Outputs

| Output | Type | Description |
Expand Down
28 changes: 14 additions & 14 deletions avm/res/api-management/service/logger/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ metadata name = 'API Management Service Loggers'
metadata description = 'This module deploys an API Management Service Logger.'
metadata owner = 'Azure/module-maintainers'

@description('Conditional. The name of the parent API Management service. Required if the template is used in a standalone deployment.')
@sys.description('Conditional. The name of the parent API Management service. Required if the template is used in a standalone deployment.')
param apiManagementServiceName string

@description('Required. Resource Name.')
@sys.description('Required. Resource Name.')
param name string

@description('Optional. Logger description.')
param loggerDescription string
@sys.description('Optional. Logger description.')
param description string = ''

@description('Optional. Whether records are buffered in the logger before publishing.')
@sys.description('Optional. Whether records are buffered in the logger before publishing.')
param isBuffered bool = true

@description('Required. Logger type.')
@sys.description('Required. Logger type.')
@allowed([
'applicationInsights'
'azureEventHub'
'azureMonitor'
])
param loggerType string
param type string

@description('Conditional. Required if loggerType = applicationInsights or azureEventHub. Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource).')
@sys.description('Conditional. Required if loggerType = applicationInsights or azureEventHub. Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource).')
param targetResourceId string

@secure()
@description('Conditional. Required if loggerType = applicationInsights or azureEventHub. The name and SendRule connection string of the event hub for azureEventHub logger. Instrumentation key for applicationInsights logger.')
@sys.description('Conditional. Required if loggerType = applicationInsights or azureEventHub. The name and SendRule connection string of the event hub for azureEventHub logger. Instrumentation key for applicationInsights logger.')
param credentials object

resource service 'Microsoft.ApiManagement/service@2021-08-01' existing = {
Expand All @@ -38,18 +38,18 @@ resource loggers 'Microsoft.ApiManagement/service/loggers@2022-08-01' = {
parent: service
properties: {
credentials: credentials
description: loggerDescription
description: description
isBuffered: isBuffered
loggerType: loggerType
loggerType: type
resourceId: targetResourceId
}
}

@description('The resource ID of the logger.')
@sys.description('The resource ID of the logger.')
output resourceId string = loggers.id

@description('The name of the logger.')
@sys.description('The name of the logger.')
output name string = loggers.name

@description('The resource group the named value was deployed into.')
@sys.description('The resource group the named value was deployed into.')
output resourceGroupName string = resourceGroup().name
11 changes: 6 additions & 5 deletions avm/res/api-management/service/logger/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "12834599511984803283"
"templateHash": "11939692347898757759"
},
"name": "API Management Service Loggers",
"description": "This module deploys an API Management Service Logger.",
Expand All @@ -24,8 +24,9 @@
"description": "Required. Resource Name."
}
},
"loggerDescription": {
"description": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Optional. Logger description."
}
Expand All @@ -37,7 +38,7 @@
"description": "Optional. Whether records are buffered in the logger before publishing."
}
},
"loggerType": {
"type": {
"type": "string",
"allowedValues": [
"applicationInsights",
Expand Down Expand Up @@ -68,9 +69,9 @@
"name": "[format('{0}/{1}', parameters('apiManagementServiceName'), parameters('name'))]",
"properties": {
"credentials": "[parameters('credentials')]",
"description": "[parameters('loggerDescription')]",
"description": "[parameters('description')]",
"isBuffered": "[parameters('isBuffered')]",
"loggerType": "[parameters('loggerType')]",
"loggerType": "[parameters('type')]",
"resourceId": "[parameters('targetResourceId')]"
}
}
Expand Down
6 changes: 3 additions & 3 deletions avm/res/api-management/service/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ module service_loggers 'logger/main.bicep' = [
name: logger.name
apiManagementServiceName: service.name
credentials: logger.?credentials ?? {}
isBuffered: logger.?isBuffered ?? true
loggerDescription: logger.?loggerDescription ?? ''
loggerType: logger.?loggerType ?? 'azureMonitor'
isBuffered: logger.?isBuffered
description: logger.?loggerDescription
type: logger.?loggerType ?? 'azureMonitor'
targetResourceId: logger.?targetResourceId ?? ''
}
dependsOn: [
Expand Down
21 changes: 11 additions & 10 deletions avm/res/api-management/service/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "7676062632439815762"
"templateHash": "17391549919743437794"
},
"name": "API Management Services",
"description": "This module deploys an API Management Service. The default deployment is set to use a Premium SKU to align with Microsoft WAF-aligned best practices. In most cases, non-prod deployments should use a lower-tier SKU.",
Expand Down Expand Up @@ -2602,12 +2602,12 @@
"value": "[coalesce(tryGet(parameters('loggers')[copyIndex()], 'credentials'), createObject())]"
},
"isBuffered": {
"value": "[coalesce(tryGet(parameters('loggers')[copyIndex()], 'isBuffered'), true())]"
"value": "[tryGet(parameters('loggers')[copyIndex()], 'isBuffered')]"
},
"loggerDescription": {
"value": "[coalesce(tryGet(parameters('loggers')[copyIndex()], 'loggerDescription'), '')]"
"description": {
"value": "[tryGet(parameters('loggers')[copyIndex()], 'loggerDescription')]"
},
"loggerType": {
"type": {
"value": "[coalesce(tryGet(parameters('loggers')[copyIndex()], 'loggerType'), 'azureMonitor')]"
},
"targetResourceId": {
Expand All @@ -2621,7 +2621,7 @@
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "12834599511984803283"
"templateHash": "11939692347898757759"
},
"name": "API Management Service Loggers",
"description": "This module deploys an API Management Service Logger.",
Expand All @@ -2640,8 +2640,9 @@
"description": "Required. Resource Name."
}
},
"loggerDescription": {
"description": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Optional. Logger description."
}
Expand All @@ -2653,7 +2654,7 @@
"description": "Optional. Whether records are buffered in the logger before publishing."
}
},
"loggerType": {
"type": {
"type": "string",
"allowedValues": [
"applicationInsights",
Expand Down Expand Up @@ -2684,9 +2685,9 @@
"name": "[format('{0}/{1}', parameters('apiManagementServiceName'), parameters('name'))]",
"properties": {
"credentials": "[parameters('credentials')]",
"description": "[parameters('loggerDescription')]",
"description": "[parameters('description')]",
"isBuffered": "[parameters('isBuffered')]",
"loggerType": "[parameters('loggerType')]",
"loggerType": "[parameters('type')]",
"resourceId": "[parameters('targetResourceId')]"
}
}
Expand Down

0 comments on commit 7a487e2

Please sign in to comment.