Skip to content

Commit

Permalink
feat: api-management.service new v0.2 (#2453)
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 #123
Fixes #456
Closes #123
Closes #456
-->

Closes #2075 
Closes #1929 
Closes #1124 
Closes #1104 
Closes #2362 
Closes #2444 

Big update v0.2 release:

- update all APIM apis to newer versions
- new feat: Add PublicIP
- new feat: add API Loggers
- new feat: add API Diagnostics
- new feat: add v2sku options
- add test case for v2sku
- updates to many default params to better align with PSRule suggestions
for better reliability and security

## 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=v0.2)](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:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [x] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [x] 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 <tobox@microsoft.com>
  • Loading branch information
tony-box and Tony Box authored Jun 19, 2024
1 parent 294aac2 commit 8a869fa
Show file tree
Hide file tree
Showing 59 changed files with 2,864 additions and 290 deletions.
320 changes: 287 additions & 33 deletions avm/res/api-management/service/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion avm/res/api-management/service/api-version-set/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This module deploys an API Management Service API Version Set.

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.ApiManagement/service/apiVersionSets` | [2021-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2021-08-01/service/apiVersionSets) |
| `Microsoft.ApiManagement/service/apiVersionSets` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apiVersionSets) |

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions avm/res/api-management/service/api-version-set/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ param name string = 'default'
@description('Optional. API Version set properties.')
param properties object = {}

resource service 'Microsoft.ApiManagement/service@2021-08-01' existing = {
resource service 'Microsoft.ApiManagement/service@2023-05-01-preview' existing = {
name: apiManagementServiceName
}

resource apiVersionSet 'Microsoft.ApiManagement/service/apiVersionSets@2021-08-01' = {
resource apiVersionSet 'Microsoft.ApiManagement/service/apiVersionSets@2022-08-01' = {
name: name
parent: service
properties: properties
Expand Down
6 changes: 3 additions & 3 deletions avm/res/api-management/service/api-version-set/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "14411287735172753559"
"version": "0.28.1.47646",
"templateHash": "2869637630248924190"
},
"name": "API Management Service API Version Sets",
"description": "This module deploys an API Management Service API Version Set.",
Expand Down Expand Up @@ -36,7 +36,7 @@
"resources": [
{
"type": "Microsoft.ApiManagement/service/apiVersionSets",
"apiVersion": "2021-08-01",
"apiVersion": "2022-08-01",
"name": "[format('{0}/{1}', parameters('apiManagementServiceName'), parameters('name'))]",
"properties": "[parameters('properties')]"
}
Expand Down
38 changes: 28 additions & 10 deletions avm/res/api-management/service/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ This module deploys an API Management Service API.

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.ApiManagement/service/apis` | [2021-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2021-08-01/service/apis) |
| `Microsoft.ApiManagement/service/apis/policies` | [2021-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2021-08-01/service/apis/policies) |
| `Microsoft.ApiManagement/service/apis` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apis) |
| `Microsoft.ApiManagement/service/apis/diagnostics` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apis/diagnostics) |
| `Microsoft.ApiManagement/service/apis/policies` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apis/policies) |

## Parameters

**Required parameters**

| 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**

Expand All @@ -45,8 +46,10 @@ This module deploys an API Management Service API.
| [`apiVersionDescription`](#parameter-apiversiondescription) | string | Description of the API Version. |
| [`apiVersionSetId`](#parameter-apiversionsetid) | string | Indicates the Version identifier of the API version set. |
| [`authenticationSettings`](#parameter-authenticationsettings) | object | Collection of authentication settings included into this 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 @@ -57,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: `displayName`
### Parameter: `apiName`

API name. Must be 1 to 300 characters long.
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: `name`
### Parameter: `apiPath`

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.
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

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

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 name. Must be 1 to 300 characters long.

- Required: Yes
- Type: string
Expand Down Expand Up @@ -151,6 +154,13 @@ Collection of authentication settings included into this API.
- Required: No
- Type: object

### Parameter: `diagnostics`

Array of diagnostics to apply to the Service API.

- Required: No
- Type: array

### Parameter: `format`

Format of the Content in which the API is getting imported.
Expand Down Expand Up @@ -182,6 +192,14 @@ 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
196 changes: 196 additions & 0 deletions avm/res/api-management/service/api/diagnostics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# API Management Service APIs Diagnostics. `[Microsoft.ApiManagement/service/apis/diagnostics]`

This module deploys an API Management Service API Diagnostics.

## 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.ApiManagement/service/apis/diagnostics` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apis/diagnostics) |

## Parameters

**Required parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`apiManagementServiceName`](#parameter-apimanagementservicename) | string | The name of the parent API Management service. |
| [`apiName`](#parameter-apiname) | string | The name of the parent API. |
| [`loggerName`](#parameter-loggername) | string | The name of the logger. |

**Conditional parameters**

| 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. |

**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". |

### Parameter: `apiManagementServiceName`

The name of the parent API Management service.

- Required: Yes
- Type: string

### Parameter: `apiName`

The name of the parent API.

- Required: Yes
- Type: string

### Parameter: `loggerName`

The name of the logger.

- Required: Yes
- Type: string

### Parameter: `httpCorrelationProtocol`

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

- Required: No
- Type: string
- Default: `'Legacy'`
- Allowed:
```Bicep
[
'Legacy'
'None'
'W3C'
]
```

### Parameter: `metrics`

Emit custom metrics via emit-metric policy. Default is false. 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.

- Required: No
- Type: string
- Default: `'Name'`
- Allowed:
```Bicep
[
'Name'
'URI'
]
```

### Parameter: `alwaysLog`

Specifies for what type of messages sampling settings should not apply.

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

### Parameter: `backend`

Diagnostic settings for incoming/outgoing HTTP messages to the Backend.

- Required: No
- 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.

- Required: No
- Type: object
- Default: `{}`

### Parameter: `logClientIp`

Log the ClientIP. Default is false.

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

### 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.

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

### Parameter: `verbosity`

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

- Required: No
- Type: string
- Default: `'error'`
- Allowed:
```Bicep
[
'error'
'information'
'verbose'
]
```


## Outputs

| Output | Type | Description |
| :-- | :-- | :-- |
| `name` | string | The name of the API diagnostic. |
| `resourceGroupName` | string | The resource group the API diagnostic was deployed into. |
| `resourceId` | string | The resource ID of the API diagnostic. |

## 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 <https://go.microsoft.com/fwlink/?LinkID=824704>. 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.
Loading

0 comments on commit 8a869fa

Please sign in to comment.