Skip to content

Commit

Permalink
fix: apim v0.2 pipeline issues (Azure#2530)
Browse files Browse the repository at this point in the history
## Description

<!--
>Thank you for your contribution !
> Please include a summary of the change and which issue is fixed.
> Please also include the context.
> List any dependencies that are required for this change.

Fixes Azure#123
Fixes Azure#456
Closes Azure#123
Closes Azure#456
-->

Fixes issues from the previous PR: Azure#2453 

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.api-management.service](https://github.com/tony-box/bicep-registry-modules/actions/workflows/avm.res.api-management.service.yml/badge.svg?branch=fix%2Fapim)](https://github.com/tony-box/bicep-registry-modules/actions/workflows/avm.res.api-management.service.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [X] Update to CI Environment or utilities (Non-module affecting
changes)
- [X] Azure Verified Module updates:
- [X] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [X] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [X] Update to documentation

## Checklist

- [X] I'm sure there are no other open Pull Requests for the same
update/change
- [X] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [X] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->

---------

Co-authored-by: Tony Box <[email protected]>
  • Loading branch information
tony-box and Tony Box authored Jun 23, 2024
1 parent b9e998a commit b5badc9
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 187 deletions.
14 changes: 7 additions & 7 deletions avm/res/api-management/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ module service 'br/public:avm/res/api-management/service:<version>' = {
apiDiagnostics: [
{
apiName: 'echo-api'
diagnosticName: 'applicationinsights'
loggerName: 'logger'
metrics: true
name: 'applicationinsights'
}
]
apis: [
Expand Down Expand Up @@ -369,9 +369,9 @@ module service 'br/public:avm/res/api-management/service:<version>' = {
"value": [
{
"apiName": "echo-api",
"diagnosticName": "applicationinsights",
"loggerName": "logger",
"metrics": true
"metrics": true,
"name": "applicationinsights"
}
]
},
Expand Down Expand Up @@ -1146,8 +1146,8 @@ module service 'br/public:avm/res/api-management/service:<version>' = {
| [`publicIpAddressResourceId`](#parameter-publicipaddressresourceid) | string | Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network. |
| [`restore`](#parameter-restore) | bool | Undelete API Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. |
| [`roleAssignments`](#parameter-roleassignments) | array | Array of role assignments to create. |
| [`sku`](#parameter-sku) | string | The pricing tier of this API Management service. Default is Premium. |
| [`skuCount`](#parameter-skucount) | int | The instance size of this API Management service. Default is 2. Not supported with V2 SKUs. If using Consumption, sku should = 0. |
| [`sku`](#parameter-sku) | string | The pricing tier of this API Management service. |
| [`skuCount`](#parameter-skucount) | int | The instance size of this API Management service. Not supported with V2 SKUs. If using Consumption, sku should = 0. |
| [`subnetResourceId`](#parameter-subnetresourceid) | string | The full resource ID of a subnet in a virtual network to deploy the API Management service in. |
| [`subscriptions`](#parameter-subscriptions) | array | Subscriptions. |
| [`tags`](#parameter-tags) | object | Tags of the resource. |
Expand Down Expand Up @@ -1686,7 +1686,7 @@ The principal type of the assigned principal ID.

### Parameter: `sku`

The pricing tier of this API Management service. Default is Premium.
The pricing tier of this API Management service.

- Required: No
- Type: string
Expand All @@ -1706,7 +1706,7 @@ The pricing tier of this API Management service. Default is Premium.

### Parameter: `skuCount`

The instance size of this API Management service. Default is 2. Not supported with V2 SKUs. If using Consumption, sku should = 0.
The instance size of this API Management service. Not supported with V2 SKUs. If using Consumption, sku should = 0.

- Required: No
- Type: int
Expand Down
34 changes: 17 additions & 17 deletions avm/res/api-management/service/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ This module deploys an API Management Service API.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`apiName`](#parameter-apiname) | string | API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. |
| [`apiPath`](#parameter-apipath) | string | Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. |
| [`displayName`](#parameter-displayname) | string | API name. Must be 1 to 300 characters long. |
| [`name`](#parameter-name) | string | API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. |
| [`path`](#parameter-path) | string | Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. |

**Conditional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`apiManagementServiceName`](#parameter-apimanagementservicename) | string | The name of the parent API Management service. Required if the template is used in a standalone deployment. |
| [`loggerName`](#parameter-loggername) | string | The name of the API management service logger. Required if using api/diagnostics. |

**Optional parameters**

Expand All @@ -49,7 +50,6 @@ This module deploys an API Management Service API.
| [`diagnostics`](#parameter-diagnostics) | array | Array of diagnostics to apply to the Service API. |
| [`format`](#parameter-format) | string | Format of the Content in which the API is getting imported. |
| [`isCurrent`](#parameter-iscurrent) | bool | Indicates if API revision is current API revision. |
| [`loggerName`](#parameter-loggername) | string | The name of the API management service logger. |
| [`policies`](#parameter-policies) | array | Array of Policies to apply to the Service API. |
| [`protocols`](#parameter-protocols) | array | Describes on which protocols the operations in this API can be invoked. - HTTP or HTTPS. |
| [`serviceUrl`](#parameter-serviceurl) | string | Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. |
Expand All @@ -60,23 +60,23 @@ This module deploys an API Management Service API.
| [`value`](#parameter-value) | string | Content value when Importing an API. |
| [`wsdlSelector`](#parameter-wsdlselector) | object | Criteria to limit import of WSDL to a subset of the document. |

### Parameter: `apiName`
### Parameter: `displayName`

API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.
API name. Must be 1 to 300 characters long.

- Required: Yes
- Type: string

### Parameter: `apiPath`
### Parameter: `name`

Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.
API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.

- Required: Yes
- Type: string

### Parameter: `displayName`
### Parameter: `path`

API name. Must be 1 to 300 characters long.
Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.

- Required: Yes
- Type: string
Expand All @@ -88,6 +88,14 @@ The name of the parent API Management service. Required if the template is used
- Required: Yes
- Type: string

### Parameter: `loggerName`

The name of the API management service logger. Required if using api/diagnostics.

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

### Parameter: `apiDescription`

Description of the API. May include HTML formatting tags.
Expand Down Expand Up @@ -192,14 +200,6 @@ Indicates if API revision is current API revision.
- Type: bool
- Default: `True`

### Parameter: `loggerName`

The name of the API management service logger.

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

### Parameter: `policies`

Array of Policies to apply to the Service API.
Expand Down
58 changes: 29 additions & 29 deletions avm/res/api-management/service/api/diagnostics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ This module deploys an API Management Service API Diagnostics.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`httpCorrelationProtocol`](#parameter-httpcorrelationprotocol) | string | Sets correlation protocol to use for Application Insights diagnostics. Default is Legacy. Required if using Application Insights. |
| [`metrics`](#parameter-metrics) | bool | Emit custom metrics via emit-metric policy. Default is false. Required if using Application Insights. |
| [`operationNameFormat`](#parameter-operationnameformat) | string | The format of the Operation Name for Application Insights telemetries. Default is Name. Required if using Application Insights. |
| [`httpCorrelationProtocol`](#parameter-httpcorrelationprotocol) | string | Sets correlation protocol to use for Application Insights diagnostics. Required if using Application Insights. |
| [`metrics`](#parameter-metrics) | bool | Emit custom metrics via emit-metric policy. Required if using Application Insights. |
| [`operationNameFormat`](#parameter-operationnameformat) | string | The format of the Operation Name for Application Insights telemetries. Required if using Application Insights. |

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`alwaysLog`](#parameter-alwayslog) | string | Specifies for what type of messages sampling settings should not apply. |
| [`backend`](#parameter-backend) | object | Diagnostic settings for incoming/outgoing HTTP messages to the Backend. |
| [`diagnosticName`](#parameter-diagnosticname) | string | Type of diagnostic resource. Default is local. |
| [`frontend`](#parameter-frontend) | object | Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. |
| [`logClientIp`](#parameter-logclientip) | bool | Log the ClientIP. Default is false. |
| [`samplingPercentage`](#parameter-samplingpercentage) | int | Rate of sampling for fixed-rate sampling. Specifies the percentage of requests that are logged. 0% sampling means zero requests logged, while 100% sampling means all requests logged. Default is 100. |
| [`verbosity`](#parameter-verbosity) | string | The verbosity level applied to traces emitted by trace policies. Default is "error". |
| [`logClientIp`](#parameter-logclientip) | bool | Log the ClientIP. |
| [`name`](#parameter-name) | string | Type of diagnostic resource. |
| [`samplingPercentage`](#parameter-samplingpercentage) | int | Rate of sampling for fixed-rate sampling. Specifies the percentage of requests that are logged. 0% sampling means zero requests logged, while 100% sampling means all requests logged. |
| [`verbosity`](#parameter-verbosity) | string | The verbosity level applied to traces emitted by trace policies. |

### Parameter: `apiManagementServiceName`

Expand All @@ -69,7 +69,7 @@ The name of the logger.

### Parameter: `httpCorrelationProtocol`

Sets correlation protocol to use for Application Insights diagnostics. Default is Legacy. Required if using Application Insights.
Sets correlation protocol to use for Application Insights diagnostics. Required if using Application Insights.

- Required: No
- Type: string
Expand All @@ -85,15 +85,15 @@ Sets correlation protocol to use for Application Insights diagnostics. Default i

### Parameter: `metrics`

Emit custom metrics via emit-metric policy. Default is false. Required if using Application Insights.
Emit custom metrics via emit-metric policy. Required if using Application Insights.

- Required: No
- Type: bool
- Default: `False`

### Parameter: `operationNameFormat`

The format of the Operation Name for Application Insights telemetries. Default is Name. Required if using Application Insights.
The format of the Operation Name for Application Insights telemetries. Required if using Application Insights.

- Required: No
- Type: string
Expand Down Expand Up @@ -122,22 +122,6 @@ Diagnostic settings for incoming/outgoing HTTP messages to the Backend.
- Type: object
- Default: `{}`

### Parameter: `diagnosticName`

Type of diagnostic resource. Default is local.

- Required: No
- Type: string
- Default: `'local'`
- Allowed:
```Bicep
[
'applicationinsights'
'azuremonitor'
'local'
]
```

### Parameter: `frontend`

Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.
Expand All @@ -148,23 +132,39 @@ Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.

### Parameter: `logClientIp`

Log the ClientIP. Default is false.
Log the ClientIP.

- Required: No
- Type: bool
- Default: `False`

### Parameter: `name`

Type of diagnostic resource.

- Required: No
- Type: string
- Default: `'local'`
- Allowed:
```Bicep
[
'applicationinsights'
'azuremonitor'
'local'
]
```

### Parameter: `samplingPercentage`

Rate of sampling for fixed-rate sampling. Specifies the percentage of requests that are logged. 0% sampling means zero requests logged, while 100% sampling means all requests logged. Default is 100.
Rate of sampling for fixed-rate sampling. Specifies the percentage of requests that are logged. 0% sampling means zero requests logged, while 100% sampling means all requests logged.

- Required: No
- Type: int
- Default: `100`

### Parameter: `verbosity`

The verbosity level applied to traces emitted by trace policies. Default is "error".
The verbosity level applied to traces emitted by trace policies.

- Required: No
- Type: string
Expand Down
18 changes: 9 additions & 9 deletions avm/res/api-management/service/api/diagnostics/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ param loggerName string
'applicationinsights'
'local'
])
@description('Optional. Type of diagnostic resource. Default is local.')
param diagnosticName string = 'local'
@description('Optional. Type of diagnostic resource.')
param name string = 'local'

@description('Optional. Specifies for what type of messages sampling settings should not apply.')
param alwaysLog string = 'allErrors'
Expand All @@ -33,31 +33,31 @@ param frontend object = {}
'None'
'W3C'
])
@description('Conditional. Sets correlation protocol to use for Application Insights diagnostics. Default is Legacy. Required if using Application Insights.')
@description('Conditional. Sets correlation protocol to use for Application Insights diagnostics. Required if using Application Insights.')
param httpCorrelationProtocol string = 'Legacy'

@description('Optional. Log the ClientIP. Default is false.')
@description('Optional. Log the ClientIP.')
param logClientIp bool = false

@description('Conditional. Emit custom metrics via emit-metric policy. Default is false. Required if using Application Insights.')
@description('Conditional. Emit custom metrics via emit-metric policy. Required if using Application Insights.')
param metrics bool = false

@allowed([
'Name'
'URI'
])
@description('Conditional. The format of the Operation Name for Application Insights telemetries. Default is Name. Required if using Application Insights.')
@description('Conditional. The format of the Operation Name for Application Insights telemetries. Required if using Application Insights.')
param operationNameFormat string = 'Name'

@description('Optional. Rate of sampling for fixed-rate sampling. Specifies the percentage of requests that are logged. 0% sampling means zero requests logged, while 100% sampling means all requests logged. Default is 100.')
@description('Optional. Rate of sampling for fixed-rate sampling. Specifies the percentage of requests that are logged. 0% sampling means zero requests logged, while 100% sampling means all requests logged.')
param samplingPercentage int = 100

@allowed([
'error'
'information'
'verbose'
])
@description('Optional. The verbosity level applied to traces emitted by trace policies. Default is "error".')
@description('Optional. The verbosity level applied to traces emitted by trace policies.')
param verbosity string = 'error'

resource service 'Microsoft.ApiManagement/service@2021-08-01' existing = {
Expand All @@ -73,7 +73,7 @@ resource service 'Microsoft.ApiManagement/service@2021-08-01' existing = {
}

resource diagnostic 'Microsoft.ApiManagement/service/apis/diagnostics@2022-08-01' = {
name: diagnosticName
name: name
parent: service::api
properties: {
alwaysLog: alwaysLog
Expand Down
Loading

0 comments on commit b5badc9

Please sign in to comment.