Skip to content

Commit 3fb1575

Browse files
authored
mgmt, refactor autocent.js to reading from eng/mgmt/automation/api-specs.yaml (Azure#29096)
* change specs mapping from script to reading from eng/mgmt/automation/api-specs.yaml * use absolute path
1 parent 99a587f commit 3fb1575

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

sdk/resourcemanager/autocent.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
const fs = require('fs');
22
const path = require('path');
33
const request = require('request-promise');
4+
const yaml = require('yaml')
45

56
// mapping for services with different spec folder names
6-
const specs = {
7-
'appcontainers': 'app',
8-
'avs': 'vmware',
9-
'cosmos': 'cosmos-db',
10-
'costmanagement': 'cost-management',
11-
'customerinsights': 'customer-insights',
12-
'datalakeanalytics': 'datalake-analytics',
13-
'datalakestore': 'datalake-store',
14-
'delegatednetwork': 'dnc',
15-
'eventhubs': 'eventhub',
16-
'loganalytics': 'operationalinsights',
17-
'kusto': 'azure-kusto',
18-
'servicemap': 'service-map',
19-
'managedapplications': 'resources',
20-
'mysqlflexibleserver': 'mysql',
21-
'postgresqlflexibleserver': 'postgresql'
22-
};
7+
const specs = getSpecsMapping()
238
const groupUrl = 'https://repo1.maven.org/maven2/com/azure/resourcemanager/';
249
const artiRegEx = /<a href="(azure-resourcemanager-[-\w]+)\/"/g;
2510
const verRegEx = /<version>(.+)<\/version>/g;
@@ -194,4 +179,14 @@ async function sendRequest(url) {
194179
})
195180
}
196181

182+
function getSpecsMapping() {
183+
const api_specs_file = path.join(__dirname, "../../eng/mgmt/automation/api-specs.yaml")
184+
const data = fs.readFileSync(api_specs_file, 'utf-8')
185+
let specs = {"managedapplications": "resources"}
186+
Object.entries(yaml.parse(data))
187+
.filter(([, service]) => service.hasOwnProperty("service"))
188+
.forEach(([rp, service]) => specs[service["service"]] = rp)
189+
return specs
190+
}
191+
197192
autocent();

sdk/resourcemanager/docs/SINGLE_SERVICE_PACKAGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ service
214214
<details>
215215
<summary> communication </summary>
216216

217+
* [package-2021-10-01-preview](https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager#tag-package-2021-10-01-preview)
218+
* [1.1.0-beta.2](https://search.maven.org/artifact/com.azure.resourcemanager/azure-resourcemanager-communication/1.1.0-beta.2/jar)
217219
* [package-2020-08-20](https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager#tag-package-2020-08-20)
218220
* [1.1.0-beta.1](https://search.maven.org/artifact/com.azure.resourcemanager/azure-resourcemanager-communication/1.1.0-beta.1/jar)
219221
* [1.0.0-beta.1](https://search.maven.org/artifact/com.azure.resourcemanager/azure-resourcemanager-communication/1.0.0-beta.1/jar)

sdk/resourcemanager/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"npm-run-all": "4.1.5",
6060
"pom-parser": "1.2.0",
6161
"request": "2.88.2",
62-
"request-promise": "4.2.6"
62+
"request-promise": "4.2.6",
63+
"yaml": "2.1.0"
6364
}
6465
}

0 commit comments

Comments
 (0)