Skip to content

Commit a04228c

Browse files
Move Monitor to main
1 parent 74b7217 commit a04228c

File tree

230 files changed

+33752
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+33752
-26
lines changed

src/Monitor/ActionGroup.Autorest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ For information on how to develop for `Az.ActionGroup`, see [how-to.md](how-to.m
3434
require:
3535
# readme.azure.noprofile.md is the common configuration file
3636
- $(this-folder)/../../readme.azure.noprofile.md
37-
branch: 47d1d82108a0db0395ed4eca106622becee7fbb4
37+
commit: 47d1d82108a0db0395ed4eca106622becee7fbb4
3838

3939
input-file:
4040
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/actionGroups_API.json

src/Monitor/ActionGroup.Autorest/generate-portal-ux.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ $instance = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.ActionGroup.Module]::Ins
4242
$moduleInfo = Get-Module -Name $moduleName
4343
$parameterSetsInfo = Get-Module -Name "$moduleName.private"
4444

45-
$buildinFunctions = @("Export-CmdletSurface", "Export-ExampleStub", "Export-FormatPs1xml", "Export-HelpMarkdown", "Export-ModelSurface", "Export-ProxyCmdlet", "Export-Psd1", "Export-TestStub", "Get-CommonParameter", "Get-ModuleGuid", "Get-ScriptCmdlet")
46-
4745
function Test-FunctionSupported()
4846
{
4947
[CmdletBinding()]
@@ -53,12 +51,12 @@ function Test-FunctionSupported()
5351
$FunctionName
5452
)
5553

56-
If ($buildinfunctions.Contains($FunctionName)) {
54+
If (-not $FunctionName.Contains("_")) {
5755
return $false
5856
}
5957

6058
$cmdletName, $parameterSetName = $FunctionName.Split("_")
61-
If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity")) {
59+
If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity") -or $parameterSetName.Contains("ViaJson")) {
6260
return $false
6361
}
6462
If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) {
@@ -311,7 +309,7 @@ function New-MetadataForCmdlet()
311309
return $result
312310
}
313311

314-
$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-functionSupported($_) }
312+
$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-FunctionSupported($_) }
315313
$resourceTypes = @{}
316314
foreach ($parameterSetName in $parameterSets)
317315
{

src/Monitor/ActionGroup.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,31 @@ protected override void ProcessRecord()
5656
return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_})
5757
}
5858
}
59+
function Start-TestSleep {
60+
[CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')]
61+
param(
62+
[parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')]
63+
[ValidateRange(0.0, 2147483.0)]
64+
[double] $Seconds,
65+
66+
[parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')]
67+
[ValidateRange('NonNegative')]
68+
[Alias('ms')]
69+
[int] $Milliseconds
70+
)
71+
72+
if ($TestMode -ne 'playback') {
73+
switch ($PSCmdlet.ParameterSetName) {
74+
'SleepBySeconds' {
75+
Start-Sleep -Seconds $Seconds
76+
}
77+
'SleepByMilliseconds' {
78+
Start-Sleep -Milliseconds $Milliseconds
79+
}
80+
}
81+
}
82+
}
83+
5984
$env = @{}
6085
if ($UsePreviousConfigForRecord) {
6186
$previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json

src/Monitor/ActivityLogAlert.Autorest/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ For information on how to develop for `Az.ActivityLogAlert`, see [how-to.md](how
2929
### AutoRest Configuration
3030
> see https://aka.ms/autorest
3131
``` yaml
32+
commit: e94b0da0c7f80e2986af90c1dd7e9c8f4c336c61
3233
require:
3334
# readme.azure.noprofile.md is the common configuration file
3435
- $(this-folder)/../../readme.azure.noprofile.md
3536
input-file:
3637
# You need to specify your swagger files here.
37-
- https://github.com/Azure/azure-rest-api-specs/blob/e94b0da0c7f80e2986af90c1dd7e9c8f4c336c61/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/activityLogAlerts_API.json
38+
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/activityLogAlerts_API.json
3839

3940
root-module-name: $(prefix).Monitor
4041
title: ActivityLogAlert
@@ -48,6 +49,10 @@ nested-object-to-string: true
4849
# uncomment following line to support viaIdentity for these post APIs
4950
# identity-correction-for-post: true
5051

52+
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
53+
use-extension:
54+
"@autorest/powershell": "3.x"
55+
5156
directive:
5257
# Following is two common directive which are normally required in all the RPs
5358
# 1. Remove the unexpanded parameter set

src/Monitor/Autoscale.Autorest/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ For information on how to develop for `Az.Autoscale`, see [how-to.md](how-to.md)
2929
### AutoRest Configuration
3030
> see https://aka.ms/autorest
3131
``` yaml
32+
commit: 9ae616c4a5447e9cae43752b68f089bff2e46398
3233
require:
3334
# readme.azure.noprofile.md is the common configuration file
3435
- $(this-folder)/../../readme.azure.noprofile.md
3536
input-file:
3637
# You need to specify your swagger files here.
37-
- https://github.com/Azure/azure-rest-api-specs/blob/9ae616c4a5447e9cae43752b68f089bff2e46398/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/autoscale_API.json
38+
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/autoscale_API.json
3839

3940
root-module-name: $(prefix).Monitor
4041
title: Autoscale
@@ -47,6 +48,10 @@ nested-object-to-string: true
4748
# uncomment following line to support viaIdentity for these post APIs
4849
# identity-correction-for-post: true
4950

51+
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
52+
use-extension:
53+
"@autorest/powershell": "3.x"
54+
5055
directive:
5156
# Following is two common directive which are normally required in all the RPs
5257
# 1. Remove the unexpanded parameter set

src/Monitor/Autoscale.Autorest/test/utils.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ function RandomString([bool]$allChars, [int32]$len) {
55
return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_})
66
}
77
}
8+
function Start-TestSleep {
9+
[CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')]
10+
param(
11+
[parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')]
12+
[ValidateRange(0.0, 2147483.0)]
13+
[double] $Seconds,
14+
15+
[parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')]
16+
[ValidateRange('NonNegative')]
17+
[Alias('ms')]
18+
[int] $Milliseconds
19+
)
20+
21+
if ($TestMode -ne 'playback') {
22+
switch ($PSCmdlet.ParameterSetName) {
23+
'SleepBySeconds' {
24+
Start-Sleep -Seconds $Seconds
25+
}
26+
'SleepByMilliseconds' {
27+
Start-Sleep -Milliseconds $Milliseconds
28+
}
29+
}
30+
}
31+
}
32+
833
$env = @{}
934
if ($UsePreviousConfigForRecord) {
1035
$previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json

src/Monitor/DataCollectionRule.Autorest/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ For information on how to develop for `Az.DataCollectionRule`, see [how-to.md](h
3434
require:
3535
# readme.azure.noprofile.md is the common configuration file
3636
- $(this-folder)/../../readme.azure.noprofile.md
37-
branch: 4f4044394791773e6e7e82a9bd90d3935caaca1b
37+
commit: 4f4044394791773e6e7e82a9bd90d3935caaca1b
3838

3939
input-file:
4040
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/dataCollectionEndpoints_API.json
@@ -49,9 +49,6 @@ subject-prefix: ''
4949
resourcegroup-append: true
5050
nested-object-to-string: true
5151

52-
use-extension:
53-
"@autorest/powershell": "4.x"
54-
5552
directive:
5653
- remove-operation: DataCollectionRules_Update
5754
# # Following is two common directive which are normally required in all the RPs

src/Monitor/DataCollectionRule.Autorest/generate-portal-ux.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ $instance = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.DataCollection.Module]::
4242
$moduleInfo = Get-Module -Name $moduleName
4343
$parameterSetsInfo = Get-Module -Name "$moduleName.private"
4444

45-
$buildinFunctions = @("Export-CmdletSurface", "Export-ExampleStub", "Export-FormatPs1xml", "Export-HelpMarkdown", "Export-ModelSurface", "Export-ProxyCmdlet", "Export-Psd1", "Export-TestStub", "Get-CommonParameter", "Get-ModuleGuid", "Get-ScriptCmdlet")
46-
4745
function Test-FunctionSupported()
4846
{
4947
[CmdletBinding()]
@@ -53,12 +51,12 @@ function Test-FunctionSupported()
5351
$FunctionName
5452
)
5553

56-
If ($buildinfunctions.Contains($FunctionName)) {
54+
If (-not $FunctionName.Contains("_")) {
5755
return $false
5856
}
5957

6058
$cmdletName, $parameterSetName = $FunctionName.Split("_")
61-
If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity")) {
59+
If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity") -or $parameterSetName.Contains("ViaJson")) {
6260
return $false
6361
}
6462
If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) {
@@ -311,7 +309,7 @@ function New-MetadataForCmdlet()
311309
return $result
312310
}
313311

314-
$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-functionSupported($_) }
312+
$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-FunctionSupported($_) }
315313
$resourceTypes = @{}
316314
foreach ($parameterSetName in $parameterSets)
317315
{

src/Monitor/DataCollectionRule.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,31 @@ protected override void ProcessRecord()
5656
return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_})
5757
}
5858
}
59+
function Start-TestSleep {
60+
[CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')]
61+
param(
62+
[parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')]
63+
[ValidateRange(0.0, 2147483.0)]
64+
[double] $Seconds,
65+
66+
[parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')]
67+
[ValidateRange('NonNegative')]
68+
[Alias('ms')]
69+
[int] $Milliseconds
70+
)
71+
72+
if ($TestMode -ne 'playback') {
73+
switch ($PSCmdlet.ParameterSetName) {
74+
'SleepBySeconds' {
75+
Start-Sleep -Seconds $Seconds
76+
}
77+
'SleepByMilliseconds' {
78+
Start-Sleep -Milliseconds $Milliseconds
79+
}
80+
}
81+
}
82+
}
83+
5984
$env = @{}
6085
if ($UsePreviousConfigForRecord) {
6186
$previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json

src/Monitor/DiagnosticSetting.Autorest/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ For information on how to develop for `Az.DiagnosticSetting`, see [how-to.md](ho
2929
### AutoRest Configuration
3030
> see https://aka.ms/autorest
3131
``` yaml
32+
commit: e94b0da0c7f80e2986af90c1dd7e9c8f4c336c61
3233
require:
3334
# readme.azure.noprofile.md is the common configuration file
3435
- $(this-folder)/../../readme.azure.noprofile.md
3536
input-file:
3637
# You need to specify your swagger files here.
37-
- https://github.com/Azure/azure-rest-api-specs/blob/62ec79080af0d0d609650d67155ef4a93ae11482/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettings_API.json
38-
- https://github.com/Azure/azure-rest-api-specs/blob/62ec79080af0d0d609650d67155ef4a93ae11482/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettingsCategories_API.json
39-
- https://github.com/Azure/azure-rest-api-specs/blob/62ec79080af0d0d609650d67155ef4a93ae11482/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/subscriptionDiagnosticsSettings_API.json
40-
- https://github.com/Azure/azure-rest-api-specs/blob/e94b0da0c7f80e2986af90c1dd7e9c8f4c336c61/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/eventCategories_API.json
38+
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettings_API.json
39+
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettingsCategories_API.json
40+
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/subscriptionDiagnosticsSettings_API.json
41+
- $(repo)/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/eventCategories_API.json
4142

4243
root-module-name: $(prefix).Monitor
4344
title: DiagnosticSetting
@@ -50,6 +51,10 @@ nested-object-to-string: true
5051
# uncomment following line to support viaIdentity for these post APIs
5152
# identity-correction-for-post: true
5253

54+
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
55+
use-extension:
56+
"@autorest/powershell": "3.x"
57+
5358
directive:
5459
# Following is two common directive which are normally required in all the RPs
5560
# 1. Remove the unexpanded parameter set
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<PsModuleName>Metric</PsModuleName>
4+
<PsRootModuleName>Monitor</PsRootModuleName>
5+
<PsModuleFolder>Metrics.Autorest</PsModuleFolder>
6+
</PropertyGroup>
7+
8+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.proj))\src\Az.autorest.props" />
9+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.proj))\src\Az.Post.props" />
10+
</Project>

0 commit comments

Comments
 (0)