1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151
|
# Azure Metrics Advisor for Python
> see https://aka.ms/autorest
### Setup
Install Autorest v3
```ps
npm install -g autorest
```
### Generation
```ps
cd <swagger-folder>
autorest
```
### Settings
```yaml
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cognitiveservices/data-plane/MetricsAdvisor/stable/v1.0/MetricsAdvisor.json
output-folder: ../azure/ai/metricsadvisor/
namespace: azure.ai.metricsadvisor
package-name: azure-ai-metricsadvisor
license-header: MICROSOFT_MIT_NO_VERSION
clear-output-folder: true
no-namespace-folders: true
python: true
title: MetricsAdvisorClient
head-as-boolean: true
package-version: 1.1.0
add-credential: true
credential-scopes: https://cognitiveservices.azure.com/.default
want-operation-metadata: false
keep-version-file: true
version-tolerant: true
black: true
models-mode: msrest
modelerfour:
flatten-models: true
```
```yaml
directive:
- rename-operation:
from: createMetricFeedback
to: addFeedback
- rename-operation:
from: getMetricFeedback
to: getFeedback
- rename-operation:
from: listMetricFeedbacks
to: listFeedback
- rename-operation:
from: getRootCauseOfIncidentByAnomalyDetectionConfiguration
to: listIncidentRootCauses
- rename-operation:
from: getSeriesByAnomalyDetectionConfiguration
to: listMetricEnrichedSeriesData
- rename-operation:
from: getAlertsByAnomalyAlertingConfiguration
to: listAlerts
- rename-operation:
from: getDimensionOfAnomaliesByAnomalyDetectionConfiguration
to: listAnomalyDimensionValues
- rename-operation:
from: getMetricDimension
to: listMetricDimensionValues
- rename-operation:
from: getMetricData
to: listMetricSeriesData
- rename-operation:
from: getMetricSeries
to: listMetricSeriesDefinitions
- rename-operation:
from: getEnrichmentStatusByMetric
to: listMetricEnrichmentStatus
- rename-operation:
from: createAnomalyAlertingConfiguration
to: createAlertConfiguration
- rename-operation:
from: createAnomalyDetectionConfiguration
to: createDetectionConfiguration
- rename-operation:
from: getDataFeedById
to: getDataFeed
- rename-operation:
from: getAnomalyAlertingConfiguration
to: getAlertConfiguration
- rename-operation:
from: getAnomalyDetectionConfiguration
to: getDetectionConfiguration
- rename-operation:
from: getIngestionProgress
to: getDataFeedIngestionProgress
- rename-operation:
from: resetDataFeedIngestionStatus
to: refreshDataFeedIngestion
- rename-operation:
from: deleteAnomalyAlertingConfiguration
to: deleteAlertConfiguration
- rename-operation:
from: deleteAnomalyDetectionConfiguration
to: deleteDetectionConfiguration
- rename-operation:
from: updateAnomalyAlertingConfiguration
to: updateAlertConfiguration
- rename-operation:
from: getAnomalyAlertingConfigurationsByAnomalyDetectionConfiguration
to: listAlertConfigurations
- rename-operation:
from: getAnomalyDetectionConfigurationsByMetric
to: listDetectionConfigurations
- rename-operation:
from: getDataFeedIngestionStatus
to: listDataFeedIngestionStatus
- rename-operation:
from: getCredential
to: getDatasourceCredential
- rename-operation:
from: createCredential
to: createDatasourceCredential
- rename-operation:
from: listCredentials
to: listDatasourceCredentials
- rename-operation:
from: updateCredential
to: updateDatasourceCredential
- rename-operation:
from: deleteCredential
to: deleteDatasourceCredential
- rename-operation:
from: updateAnomalyDetectionConfiguration
to: updateDetectionConfiguration
- rename-operation:
from: getAnomaliesFromAlertByAnomalyAlertingConfiguration
to: listAnomaliesForAlert
- rename-operation:
from: getIncidentsFromAlertByAnomalyAlertingConfiguration
to: listIncidentsForAlert
```
### Add empty Anything object to definitions
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["Anything"] = {}
```
### Severity -> AnomalySeverity
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["SeverityCondition"]["properties"]["minAlertSeverity"]["x-ms-enum"]["name"] = "AnomalySeverity";
$["SeverityCondition"]["properties"]["maxAlertSeverity"]["x-ms-enum"]["name"] = "AnomalySeverity";
$["AnomalyProperty"]["properties"]["anomalySeverity"]["x-ms-enum"]["name"] = "AnomalySeverity";
$["IncidentProperty"]["properties"]["maxSeverity"]["x-ms-enum"]["name"] = "AnomalySeverity";
$["SeverityFilterCondition"]["properties"]["min"]["x-ms-enum"]["name"] = "AnomalySeverity";
$["SeverityFilterCondition"]["properties"]["max"]["x-ms-enum"]["name"] = "AnomalySeverity";
```
### AnomalyDetectionConfigurationLogicType -> DetectionConditionOperator
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["WholeMetricConfiguration"]["properties"]["conditionOperator"]["x-ms-enum"]["name"] = "DetectionConditionOperator";
$["DimensionGroupConfiguration"]["properties"]["conditionOperator"]["x-ms-enum"]["name"] = "DetectionConditionOperator";
$["SeriesConfiguration"]["properties"]["conditionOperator"]["x-ms-enum"]["name"] = "DetectionConditionOperator";
$["WholeMetricConfigurationPatch"]["properties"]["conditionOperator"]["x-ms-enum"]["name"] = "DetectionConditionOperator";
```
### DataSourceType -> DatasourceType
```yaml
directive:
- from: swagger-document
where: $["paths"]
transform: >
$["/dataFeeds"]["get"]["parameters"][1]["x-ms-enum"]["name"] = "DatasourceType";
- from: swagger-document
where: $["definitions"]
transform: >
$["DataFeedDetail"]["properties"]["dataSourceType"]["x-ms-enum"]["name"] = "DatasourceType";
$["DataFeedDetailPatch"]["properties"]["dataSourceType"]["x-ms-enum"]["name"] = "DatasourceType";
```
### AnomalyAlertingConfigurationLogicType -> MetricAnomalyAlertConfigurationsOperator
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["AnomalyAlertingConfiguration"]["properties"]["crossMetricsOperator"]["x-ms-enum"]["name"] = "MetricAnomalyAlertConfigurationsOperator";
```
### ViewMode -> DataFeedAccessMode
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataFeedDetail"]["properties"]["viewMode"]["x-ms-enum"]["name"] = "DataFeedAccessMode";
```
### RollUpMethod -> DataFeedAutoRollupMethod
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataFeedDetail"]["properties"]["rollUpMethod"]["x-ms-enum"]["name"] = "DataFeedAutoRollupMethod";
```
### FillMissingPointType -> DatasourceMissingDataPointFillType
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataFeedDetail"]["properties"]["fillMissingPointType"]["x-ms-enum"]["name"] = "DatasourceMissingDataPointFillType";
```
### IncidentStatus -> AnomalyIncidentStatus
```yaml
directive:
- from: swagger-document
where: $["definitions"]["IncidentProperty"]["properties"]["incidentStatus"]["x-ms-enum"]
transform: >
$["name"] = "AnomalyIncidentStatus";
```
### Granularity -> DataFeedGranularityType
```yaml
directive:
- from: swagger-document
where: $["paths"]["/dataFeeds"]["get"]["parameters"][2]["x-ms-enum"]
transform: >
$["name"] = "DataFeedGranularityType";
- from: swagger-document
where: $["definitions"]["DataFeedDetail"]["properties"]["granularityName"]["x-ms-enum"]
transform: >
$["name"] = "DataFeedGranularityType";
```
### EntityStatus -> DataFeedStatus
```yaml
directive:
- from: swagger-document
where: $["paths"]
transform: >
$["/dataFeeds"]["get"]["parameters"][3]["x-ms-enum"]["name"] = "DataFeedStatus";
```
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataFeedDetail"]["properties"]["status"]["x-ms-enum"]["name"] = "DataFeedStatus";
```
### DataSourceCredentialType -> DatasourceCredentialType
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataSourceCredential"]["properties"]["dataSourceCredentialType"]["x-ms-enum"]["name"] = "DatasourceCredentialType";
```
### DataSourceCredential -> DatasourceCredential
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataSourceCredential"]["x-ms-client-name"] = "DatasourceCredential";
```
### AuthenticationTypeEnum -> DatasourceAuthenticationType
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataFeedDetail"]["properties"]["authenticationType"]["x-ms-enum"]["name"] = "DatasourceAuthenticationType";
```
### Rename models
```yaml
directive:
- rename-model:
from: MetricSeriesItem
to: MetricSeriesDefinition
- rename-model:
from: IngestionStatus
to: DataFeedIngestionStatus
- rename-model:
from: AlertSnoozeCondition
to: MetricAnomalyAlertSnoozeCondition
- rename-model:
from: AnomalyAlertingConfiguration
to: AnomalyAlertConfiguration
- rename-model:
from: DataFeedDetail
to: DataFeed
- rename-model:
from: HookInfo
to: NotificationHook
- rename-model:
from: EmailHookInfo
to: EmailNotificationHook
- rename-model:
from: WebhookHookInfo
to: WebNotificationHook
- rename-model:
from: WholeMetricConfiguration
to: MetricDetectionCondition
- rename-model:
from: DimensionGroupConfiguration
to: MetricSeriesGroupDetectionCondition
- rename-model:
from: SeriesConfiguration
to: MetricSingleSeriesDetectionCondition
- rename-model:
from: Metric
to: DataFeedMetric
- rename-model:
from: Dimension
to: DataFeedDimension
- rename-model:
from: SeriesResult
to: MetricEnrichedSeriesData
- rename-model:
from: AlertResult
to: AnomalyAlert
- rename-model:
from: AnomalyResult
to: DataPointAnomaly
- rename-model:
from: IncidentResult
to: AnomalyIncident
- rename-model:
from: RootCause
to: IncidentRootCause
- rename-model:
from: AzureSQLConnectionStringCredential
to: DatasourceSqlConnectionString
- rename-model:
from: DataLakeGen2SharedKeyCredential
to: DatasourceDataLakeGen2SharedKey
- rename-model:
from: ServicePrincipalCredential
to: DatasourceServicePrincipal
- rename-model:
from: ServicePrincipalInKVCredential
to: DatasourceServicePrincipalInKeyVault
- rename-model:
from: AzureApplicationInsightsParameter
to: AzureApplicationInsightsDataFeedSource
- rename-model:
from: AzureBlobParameter
to: AzureBlobDataFeedSource
- rename-model:
from: AzureCosmosDBParameter
to: AzureCosmosDbDataFeedSource
- rename-model:
from: SqlSourceParameter
to: AzureDataExplorerDataFeedSource
- rename-model:
from: AzureTableParameter
to: AzureTableDataFeedSource
- rename-model:
from: AzureEventHubsParameter
to: AzureEventHubsDataFeedSource
- rename-model:
from: InfluxDBParameter
to: InfluxDbDataFeedSource
- rename-model:
from: AzureDataLakeStorageGen2Parameter
to: AzureDataLakeStorageGen2DataFeedSource
- rename-model:
from: AzureLogAnalyticsParameter
to: AzureLogAnalyticsDataFeedSource
- rename-model:
from: MongoDBParameter
to: MongoDbDataFeedSource
- rename-model:
from: MetricAlertingConfiguration
to: MetricAlertConfiguration
- rename-model:
from: ValueCondition
to: MetricBoundaryCondition
- rename-model:
from: MetricDataItem
to: MetricSeriesData
```
### Change DimensionGroupIdentity just for MetricSeriesGroupDetectionCondition
```yaml
directive:
- from: swagger-document
where: $["definitions"]["MetricSeriesGroupDetectionCondition"]
transform: >
$.properties["group"] = {"required": ["dimension"], "type": "object", "properties": { "dimension": { "x-ms-client-name": "seriesGroupKey", "description": "dimension specified for series group", "type": "object", "additionalProperties": { "type": "string" }}}};
```
### Change SeriesIdentity just for AnomalyIncident
```yaml
directive:
- from: swagger-document
where: $["definitions"]["AnomalyIncident"]
transform: >
$.properties["rootNode"] = {"required": ["dimension"], "type": "object", "properties": { "dimension": { "x-ms-client-name": "dimensionKey", "description": "dimension specified for series group", "type": "object", "additionalProperties": { "type": "string" }}}};
```
### Change SeriesIdentity just for MetricSingleSeriesDetectionCondition
```yaml
directive:
- from: swagger-document
where: $["definitions"]["MetricSingleSeriesDetectionCondition"]
transform: >
$.properties["series"] = {"required": ["dimension"], "type": "object", "properties": { "dimension": { "x-ms-client-name": "seriesKey", "description": "dimension specified for series group", "type": "object", "additionalProperties": { "type": "string" }}}};
```
### Change SeriesIdentity just for MetricEnrichedSeriesData
```yaml
directive:
- from: swagger-document
where: $["definitions"]["MetricEnrichedSeriesData"]
transform: >
$.properties["series"] = {"required": ["dimension"], "type": "object", "properties": { "dimension": { "x-ms-client-name": "seriesKey", "description": "dimension specified for series group", "type": "object", "additionalProperties": { "type": "string" }}}};
```
### Change SeriesKey just for MetricSeriesData
```yaml
directive:
- from: swagger-document
where: $["definitions"]["MetricSeriesData"]
transform: >
$.properties["id"] = {"type": "object", "properties": { "dimension": { "x-ms-client-name": "seriesKey", "description": "dimension specified for series group", "type": "object", "additionalProperties": { "type": "string" }}, "metricId": {"format": "uuid", "type": "string", "readOnly": true}}};
```
### Make get_root_cause_of_incident_by_anomaly_detection_configuration pageable
```yaml
directive:
- from: swagger-document
where: '$.paths["/enrichment/anomalyDetection/configurations/{configurationId}/incidents/{incidentId}/rootCause"].get'
transform: >
$["x-ms-pageable"] = {"nextLinkName": null};
```
### Make get_series_by_anomaly_detection_configuration pageable
```yaml
directive:
- from: swagger-document
where: '$.paths["/enrichment/anomalyDetection/configurations/{configurationId}/series/query"].post'
transform: >
$["x-ms-pageable"] = {"nextLinkName": null};
```
### Make get_metric_data pageable
```yaml
directive:
- from: swagger-document
where: '$.paths["/metrics/{metricId}/data/query"].post'
transform: >
$["x-ms-pageable"] = {"nextLinkName": null};
```
### anomalyScopeType enum -> metricAnomalyAlertScopeType, change enum values
```yaml
directive:
- from: swagger-document
where: $["definitions"]["MetricAlertConfiguration"]["properties"]["anomalyScopeType"]
transform: >
$["x-ms-enum"]["name"] = "MetricAnomalyAlertScopeType";
```
### NeedRollupEnum -> DataFeedRollupType, change enum values
```yaml
directive:
- from: swagger-document
where: $["definitions"]
transform: >
$["DataFeed"]["properties"]["needRollup"]["x-ms-enum"]["name"] = "DataFeedRollupType";
```
```yaml
declare-directive:
where-parameter: >-
(() => {
switch ($context.from) {
case "code-model-v1":
throw "not implemented";
case "code-model-v3":
return {from: "code-model-v3", where: `$.parameters.filter(p => p["name"] == ${JSON.stringify($)})[0]`};
case "openapi-document":
return { from: "openapi-document", where: `$.parameters.filter(p => p["name"] == ${JSON.stringify($)})[0]` };
case "swagger-document":
default:
return { from: "swagger-document", where: `$.parameters.filter(p => p["name"] == ${JSON.stringify($)})[0]` };
}
})()
```
```yaml
declare-directive:
change-parameter-schema: >-
[{
from: 'swagger-document',
transform: `$.schema["$ref"] = "#/definitions/" + JSON.stringify($)`
},
{
from: 'openapi-document',
transform: `$.schema["$ref"] = "#/definitions/" + JSON.stringify($)`
}]
```
### Change parameter types
```yaml
directive:
- where-operation: updateHook
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: updateDetectionConfiguration
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listAlerts
transform: >
$["parameters"][3]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listMetricSeriesData
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listMetricDimensionValues
transform: >
$["parameters"][3]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listMetricSeriesDefinitions
transform: >
$["parameters"][3]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: updateAlertConfiguration
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: updateDatasourceCredential
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: updateDataFeed
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listAnomalyDimensionValues
transform: >
$["parameters"][3]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: getAnomaliesByAnomalyDetectionConfiguration
transform: >
$["parameters"][3]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: getIncidentsByAnomalyDetectionConfiguration
transform: >
$["parameters"][2]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listMetricEnrichedSeriesData
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listMetricEnrichmentStatus
transform: >
$["parameters"][3]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listFeedback
transform: >
$["parameters"][2]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: refreshDataFeedIngestion
transform: >
$["parameters"][1]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: listDataFeedIngestionStatus
transform: >
$["parameters"][3]["schema"]["$ref"] = "#/definitions/Anything";
```
### Change Property Types
```yaml
directive:
- where-model: MetricBoundaryCondition
transform: >
$["properties"]["direction"]["x-ms-enum"] = undefined;
$["properties"]["direction"]["enum"] = undefined;
- where-model: AnomalyAlertingConfiguration
transform: >
$["properties"]["crossMetricsOperator"]["x-ms-enum"] = undefined;
$["properties"]["crossMetricsOperator"]["enum"] = undefined;
- where-model: AnomalyProperty
transform: >
$["properties"]["anomalyStatus"]["x-ms-enum"] = undefined;
$["properties"]["anomalyStatus"]["enum"] = undefined;
- where-model: NotificationHook
transform: >
$["properties"]["hookType"]["x-ms-enum"] = undefined;
$["properties"]["hookType"]["enum"] = undefined;
- where-model: DataFeedIngestionStatus
transform: >
$["properties"]["status"]["x-ms-enum"] = undefined;
$["properties"]["status"]["enum"] = undefined;
```
### Change Response Types
```yaml
directive:
- where-operation: updateDataFeed
transform: >
$["responses"]["200"]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: getDatasourceCredential
transform: >
$["responses"]["200"]["schema"]["$ref"] = "#/definitions/Anything";
- where-operation: updateDatasourceCredential
transform: >
$["responses"]["200"]["schema"]["$ref"] = "#/definitions/Anything";
```
### Remove ErrorCode
```yaml
directive:
- from: swagger-document
where: $["paths"][*]
transform: >
for (var op of Object.values($)) {
op["responses"]["default"]["schema"]["$ref"] = "#/definitions/Anything";
}
```
### Remove Models
```yaml
directive:
- remove-model: HookInfoPatch
- remove-model: EmailHookInfoPatch
- remove-model: WebhookHookInfoPatch
- remove-model: AzureApplicationInsightsDataFeed
- remove-model: AzureApplicationInsightsDataFeedPatch
- remove-model: AzureBlobDataFeed
- remove-model: AzureBlobDataFeedPatch
- remove-model: AzureCosmosDBDataFeed
- remove-model: AzureCosmosDBDataFeedPatch
- remove-model: AzureDataExplorerDataFeed
- remove-model: AzureDataExplorerDataFeedPatch
- remove-model: AzureTableDataFeed
- remove-model: AzureTableDataFeedPatch
- remove-model: AzureEventHubsDataFeed
- remove-model: AzureEventHubsDataFeedPatch
- remove-model: InfluxDBDataFeed
- remove-model: InfluxDBDataFeedPatch
- remove-model: MySqlDataFeed
- remove-model: MySqlDataFeedPatch
- remove-model: PostgreSqlDataFeed
- remove-model: PostgreSqlDataFeedPatch
- remove-model: SQLServerDataFeed
- remove-model: SQLServerDataFeedPatch
- remove-model: AzureDataLakeStorageGen2DataFeed
- remove-model: AzureDataLakeStorageGen2DataFeedPatch
- remove-model: AzureLogAnalyticsDataFeed
- remove-model: AzureLogAnalyticsDataFeedPatch
- remove-model: MongoDBDataFeed
- remove-model: MongoDBDataFeedPatch
- remove-model: AzureApplicationInsightsParameterPatch
- remove-model: AzureBlobParameterPatch
- remove-model: AzureCosmosDBParameterPatch
- remove-model: AzureTableParameterPatch
- remove-model: AzureEventHubsParameterPatch
- remove-model: InfluxDBParameterPatch
- remove-model: SQLSourceParameterPatch
- remove-model: AzureDataLakeStorageGen2ParameterPatch
- remove-model: AzureLogAnalyticsParameterPatch
- remove-model: MongoDBParameterPatch
- remove-model: SuppressConditionPatch
- remove-model: SmartDetectionConditionPatch
- remove-model: HardThresholdConditionPatch
- remove-model: ChangeThresholdConditionPatch
- remove-model: AnomalyDetectionConfigurationPatch
- remove-model: WholeMetricConfigurationPatch
- remove-model: AlertingResultQuery
- remove-model: MetricDataQueryOptions
- remove-model: MetricDimensionQueryOptions
- remove-model: MetricSeriesQueryOptions
- remove-model: ServicePrincipalCredentialPatch
- remove-model: ServicePrincipalInKVCredentialPatch
- remove-model: ServicePrincipalInKVParamPatch
- remove-model: ServicePrincipalParamPatch
- remove-model: WebhookHookInfoPatch
- remove-model: WebhookHookParameterPatch
- remove-model: AnomalyAlertingConfigurationPatch
- remove-model: DataSourceCredentialPatch
- remove-model: AzureSQLConnectionStringCredentialPatch
- remove-model: AzureSQLConnectionStringParamPatch
- remove-model: DataFeedDetailPatch
- remove-model: DataLakeGen2SharedKeyCredentialPatch
- remove-model: DataLakeGen2SharedKeyParamPatch
- remove-model: EmailHookParameterPatch
- remove-model: UsageStats
- remove-model: AnomalyDimensionQuery
- remove-model: DetectionAnomalyResultQuery
- remove-model: DetectionIncidentResultQuery
- remove-model: DetectionSeriesQuery
- remove-model: EnrichmentStatusQueryOption
- remove-model: ErrorCode
- remove-model: MetricFeedbackFilter
- remove-model: IngestionProgressResetOptions
- remove-model: IngestionStatusQueryOptions
```
### Remove Operations
```yaml
directive:
- remove-operation: getActiveSeriesCount
```
### Rename Properties
```yaml
declare-directive:
rename-property: >-
[{
from: 'swagger-document',
transform: `if ($.properties[${JSON.stringify($.from)}]) { $.properties[${JSON.stringify($.from)}]["x-ms-client-name"] = ${JSON.stringify($.to)}; }`
},
{
from: 'openapi-document',
transform: `if ($.properties[${JSON.stringify($.from)}]) { $.properties[${JSON.stringify($.from)}]["x-ms-client-name"] = ${JSON.stringify($.to)}; }`
}]
```
```yaml
directive:
- where-model: AnomalyAlertConfiguration
rename-property:
from: anomalyAlertingConfigurationId
to: id
- where-model: AnomalyAlertConfiguration
rename-property:
from: metricAlertingConfigurations
to: metricAlertConfigurations
- where-model: AnomalyAlertConfiguration
rename-property:
from: splitAlertByDimensions
to: dimensionsToSplitAlert
- where-model: MetricAlertConfiguration
rename-property:
from: anomalyDetectionConfigurationId
to: detectionConfigurationId
- where-model: MetricAlertConfiguration
rename-property:
from: snoozeFilter
to: alertSnoozeCondition
- where-model: FeedbackDimensionFilter
rename-property:
from: dimension
to: dimensionKey
- where-model: NotificationHook
rename-property:
from: hookName
to: name
- where-model: NotificationHook
rename-property:
from: hookId
to: id
- where-model: EmailHookParameter
rename-property:
from: toList
to: emailsToAlert
- where-model: WebhookHookParameter
remove-property: headers
- where-model: DataFeedMetric
rename-property:
from: metricName
to: name
- where-model: DataFeedMetric
rename-property:
from: metricId
to: id
- where-model: DataFeedMetric
rename-property:
from: metricDisplayName
to: displayName
- where-model: DataFeedMetric
rename-property:
from: metricDescription
to: description
- where-model: DataFeedDimension
rename-property:
from: dimensionName
to: name
- where-model: DataFeedDimension
rename-property:
from: dimensionDisplayName
to: displayName
- where-model: DataFeed
rename-property:
from: dataFeedName
to: name
- where-model: DataFeed
rename-property:
from: dataFeedId
to: id
- where-model: DataFeed
rename-property:
from: viewMode
to: accessMode
- where-model: AnomalyDetectionConfiguration
rename-property:
from: anomalyDetectionConfigurationId
to: id
- where-model: AnomalyDetectionConfiguration
rename-property:
from: wholeMetricConfiguration
to: wholeSeriesDetectionCondition
- where-model: AnomalyDetectionConfiguration
rename-property:
from: dimensionGroupOverrideConfigurations
to: seriesGroupDetectionConditions
- where-model: AnomalyDetectionConfiguration
rename-property:
from: seriesOverrideConfigurations
to: seriesDetectionConditions
- where-model: MetricSeriesGroupDetectionCondition
rename-property:
from: seriesOverrideConfigurations
to: seriesDetectionConditions
- where-model: MetricBoundaryCondition
rename-property:
from: metricId
to: companionMetricId
- where-model: MetricFeedback
rename-property:
from: feedbackId
to: id
- where-model: AnomalyFeedbackValue
rename-property:
from: anomalyValue
to: value
- where-model: ChangePointFeedbackValue
rename-property:
from: changePointValue
to: value
- where-model: CommentFeedbackValue
rename-property:
from: commentValue
to: value
- where-model: PeriodFeedbackValue
rename-property:
from: periodValue
to: value
- where-model: DataSourceCredential
rename-property:
from: dataSourceCredentialType
to: credentialType
- where-model: DataSourceCredential
rename-property:
from: dataSourceCredentialName
to: name
- where-model: DataSourceCredential
rename-property:
from: dataSourceCredentialId
to: id
- where-model: DataSourceCredential
rename-property:
from: dataSourceCredentialDescription
to: description
- where-model: AnomalyProperty
rename-property:
from: anomalySeverity
to: severity
- where-model: AnomalyProperty
rename-property:
from: anomalyStatus
to: status
- where-model: DataPointAnomaly
rename-property:
from: anomalyDetectionConfigurationId
to: detectionConfigurationId
- where-model: AnomalyIncident
rename-property:
from: anomalyDetectionConfigurationId
to: detectionConfigurationId
- where-model: AnomalyIncident
rename-property:
from: incidentId
to: id
- where-model: IncidentProperty
rename-property:
from: maxSeverity
to: severity
- where-model: IncidentProperty
rename-property:
from: incidentStatus
to: status
- where-model: MetricEnrichedSeriesData
rename-property:
from: timestampList
to: timestamps
- where-model: MetricEnrichedSeriesData
rename-property:
from: valueList
to: values
- where-model: MetricEnrichedSeriesData
rename-property:
from: isAnomalyList
to: isAnomaly
- where-model: MetricEnrichedSeriesData
rename-property:
from: periodList
to: periods
- where-model: MetricEnrichedSeriesData
rename-property:
from: expectedValueList
to: expectedValues
- where-model: MetricEnrichedSeriesData
rename-property:
from: lowerBoundaryList
to: lowerBounds
- where-model: MetricEnrichedSeriesData
rename-property:
from: upperBoundaryList
to: upperBounds
- where-model: AnomalyAlert
rename-property:
from: alertId
to: id
- where-model: MetricBoundaryCondition
remove-property: type
- where-model: MetricSeriesData
rename-property:
from: timestampList
to: timestamps
- where-model: MetricSeriesData
rename-property:
from: valueList
to: values
```
```yaml
declare-directive:
make-property-optional: >-
[{
from: 'swagger-document',
transform: `$.required = $.required.filter(item => item !== ${JSON.stringify($)})`
},
{
from: 'openapi-document',
transform: `$.required = $.required.filter(item => item !== ${JSON.stringify($)})`
}]
```
```yaml
directive:
- where-model: NotificationHook
make-property-optional: hookName
- where-model: EmailNotificationHook
make-property-optional: hookParameter
- where-model: WebNotificationHook
make-property-optional: hookParameter
- where-model: WebhookHookParameter
make-property-optional: endpoint
- where-model: EmailHookParameter
make-property-optional: toList
- where-model: AzureLogAnalyticsDataFeedSource
make-property-optional: tenantId
- where-model: AzureLogAnalyticsDataFeedSource
make-property-optional: clientId
- where-model: AzureLogAnalyticsDataFeedSource
make-property-optional: clientSecret
- where-model: SuppressCondition
make-property-optional: minNumber
- where-model: SuppressCondition
make-property-optional: minRatio
- where-model: SmartDetectionCondition
make-property-optional: anomalyDetectorDirection
- where-model: SmartDetectionCondition
make-property-optional: sensitivity
- where-model: SmartDetectionCondition
make-property-optional: suppressCondition
- where-model: HardThresholdCondition
make-property-optional: anomalyDetectorDirection
- where-model: HardThresholdCondition
make-property-optional: suppressCondition
- where-model: ChangeThresholdCondition
make-property-optional: anomalyDetectorDirection
- where-model: ChangeThresholdCondition
make-property-optional: changePercentage
- where-model: ChangeThresholdCondition
make-property-optional: shiftPoint
- where-model: ChangeThresholdCondition
make-property-optional: suppressCondition
- where-model: ChangeThresholdCondition
make-property-optional: withinRange
```
```yaml
declare-directive:
flatten-property: >-
[{
from: 'swagger-document',
transform: `if ($.properties[${JSON.stringify($)}]) { $.properties[${JSON.stringify($)}]["x-ms-client-flatten"] = true; }`
},
{
from: 'openapi-document',
transform: `if ($.properties[${JSON.stringify($)}]) { $.properties[${JSON.stringify($)}]["x-ms-client-flatten"] = true; }`
}]
```
### Flatten properties
```yaml
directive:
- where-model: EmailNotificationHook
flatten-property: hookParameter
- where-model: WebNotificationHook
flatten-property: hookParameter
- where-model: MetricSeriesGroupDetectionCondition
flatten-property: group
- where-model: MetricSingleSeriesDetectionCondition
flatten-property: series
- where-model: MetricFeedback
flatten-property: dimensionFilter
- where-model: AnomalyFeedback
flatten-property: value
- where-model: ChangePointFeedback
flatten-property: value
- where-model: CommentFeedback
flatten-property: value
- where-model: PeriodFeedback
flatten-property: value
- where-model: DatasourceSqlConnectionString
flatten-property: parameters
- where-model: DatasourceDataLakeGen2SharedKey
flatten-property: parameters
- where-model: DatasourceServicePrincipal
flatten-property: parameters
- where-model: DatasourceServicePrincipalInKeyVault
flatten-property: parameters
- where-model: DataPointAnomaly
flatten-property: property
- where-model: AnomalyIncident
flatten-property: rootNode
- where-model: AnomalyIncident
flatten-property: property
- where-model: MetricEnrichedSeriesData
flatten-property: series
- where-model: MetricSeriesData
flatten-property: id
```
```yaml
declare-directive:
rename-parameter: >-
[{
from: 'swagger-document',
transform: `for (const param in $.parameters) { if (param["name"] == ${JSON.stringify($.from)}) { $[param]["x-ms-client-name"] = ${JSON.stringify($.to)}; } }`
},
{
from: 'openapi-document',
transform: `for (const param in $.parameters) { if (param["name"] == ${JSON.stringify($.from)}) { $[param]["x-ms-client-name"] = ${JSON.stringify($.to)}; } }`
}]
```
### Rename parameters
```yaml
directive:
- where-operation: getDetectionConfiguration
transform: >
$.parameters[0]["x-ms-client-name"] = "detectionConfigurationId";
- where-operation: listIncidentRootCauses
transform: >
$.parameters[0]["x-ms-client-name"] = "detectionConfigurationId";
- where-operation: addFeedback
transform: >
$.parameters[0]["x-ms-client-name"] = "feedback";
- where-operation: listAnomaliesForAlert
transform: >
$.parameters[0]["x-ms-client-name"] = "alertConfigurationId";
- where-operation: listIncidentsForAlert
transform: >
$.parameters[0]["x-ms-client-name"] = "alertConfigurationId";
```
### Add DataSourceParameter to DataFeed
```yaml
directive:
- from: swagger-document
where: $["definitions"]["DataFeed"]
transform: >
$.properties["dataSourceParameter"] = {"type": "object"};
```
```yaml
declare-directive:
make-not-readonly: >-
[{
from: 'swagger-document',
transform: `if ($.properties[${JSON.stringify($)}]) { $.properties[${JSON.stringify($)}]["readOnly"] = false; }`
},
{
from: 'openapi-document',
transform: `if ($.properties[${JSON.stringify($)}]) { $.properties[${JSON.stringify($)}]["readOnly"] = false; }`
}]
```
### Make AnomalyAlertConfiguration id property not readonly
```yaml
directive:
- where-model: AnomalyAlertConfiguration
make-not-readonly: anomalyAlertingConfigurationId
- where-model: DataFeed
make-not-readonly: status
```
|