Skip to content

Commit f62ad7c

Browse files
Migrate Compute from generation to main (#24631)
* Move Compute to main * Update ChangeLog.md * Update ChangeLog.md * Update ChangeLog.md --------- Co-authored-by: NanxiangLiu <33285578+Nickcandy@users.noreply.github.com>
1 parent 4b94eea commit f62ad7c

File tree

435 files changed

+24324
-1952
lines changed

Some content is hidden

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

435 files changed

+24324
-1952
lines changed

src/Compute/Compute.Autorest/Az.Compute.format.ps1xml

Lines changed: 594 additions & 4 deletions
Large diffs are not rendered by default.

src/Compute/Compute.Autorest/Az.Compute.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
DotNetFrameworkVersion = '4.7.2'
1212
RequiredAssemblies = './bin/Az.Compute.private.dll'
1313
FormatsToProcess = './Az.Compute.format.ps1xml'
14-
FunctionsToExport = 'Get-AzGalleryApplication', 'Get-AzGalleryApplicationVersion', 'New-AzGalleryApplication', 'New-AzGalleryApplicationVersion', 'Remove-AzGalleryApplication', 'Remove-AzGalleryApplicationVersion', 'Remove-AzVMRunCommand', 'Remove-AzVmssVMRunCommand', 'Set-AzVMRunCommand', 'Set-AzVmssVMRunCommand', 'Update-AzGalleryApplication', 'Update-AzGalleryApplicationVersion', '*'
14+
FunctionsToExport = 'Get-AzGalleryApplication', 'Get-AzGalleryApplicationVersion', 'Invoke-AzSpotPlacementRecommender', 'New-AzGalleryApplication', 'New-AzGalleryApplicationVersion', 'Remove-AzGalleryApplication', 'Remove-AzGalleryApplicationVersion', 'Remove-AzVMRunCommand', 'Remove-AzVmssVMRunCommand', 'Set-AzVMRunCommand', 'Set-AzVmssVMRunCommand', 'Update-AzGalleryApplication', 'Update-AzGalleryApplicationVersion', '*'
1515
AliasesToExport = '*'
1616
PrivateData = @{
1717
PSData = @{

src/Compute/Compute.Autorest/Az.Compute.psm1

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,41 @@
4747

4848
# Ask for the shared functionality table
4949
$VTable = Register-AzModule
50-
50+
5151
# Tweaks the pipeline on module load
5252
$instance.OnModuleLoad = $VTable.OnModuleLoad
5353

5454
# Following two delegates are added for telemetry
5555
$instance.GetTelemetryId = $VTable.GetTelemetryId
5656
$instance.Telemetry = $VTable.Telemetry
57-
57+
58+
# Delegate to sanitize the output object
59+
$instance.SanitizeOutput = $VTable.SanitizerHandler
60+
61+
# Delegate to get the telemetry info
62+
$instance.GetTelemetryInfo = $VTable.GetTelemetryInfo
5863

5964
# Tweaks the pipeline per call
6065
$instance.OnNewRequest = $VTable.OnNewRequest
61-
66+
6267
# Gets shared parameter values
6368
$instance.GetParameterValue = $VTable.GetParameterValue
64-
69+
6570
# Allows shared module to listen to events from this module
6671
$instance.EventListener = $VTable.EventListener
67-
72+
6873
# Gets shared argument completers
6974
$instance.ArgumentCompleter = $VTable.ArgumentCompleter
70-
75+
7176
# The name of the currently selected Azure profile
7277
$instance.ProfileName = $VTable.ProfileName
7378

74-
7579
# Load the custom module
7680
$customModulePath = Join-Path $PSScriptRoot './custom/Az.Compute.custom.psm1'
7781
if(Test-Path $customModulePath) {
7882
$null = Import-Module -Name $customModulePath
7983
}
80-
84+
8185
# Export nothing to clear implicit exports
8286
Export-ModuleMember
8387

@@ -97,12 +101,12 @@
97101
# Load the last folder if no profile is selected
98102
$profileDirectory = $directories | Select-Object -Last 1
99103
}
100-
104+
101105
if($profileDirectory) {
102106
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
103107
$exportsPath = $profileDirectory.FullName
104108
}
105-
109+
106110
if($exportsPath) {
107111
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
108112
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath

src/Compute/Compute.Autorest/README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ For information on how to develop for `Az.Compute`, see [how-to.md](how-to.md).
2626
### AutoRest Configuration
2727
> see https://aka.ms/autorest
2828
``` yaml
29-
commit: 1a925d1afe288a5f20d078bbc89214a36a0e4287
29+
commit: 77c47a7fba8d8b900595966b81d6bb92a0308370
3030
require:
3131
# readme.azure.noprofile.md is the common configuration file
3232
- $(this-folder)/../../readme.azure.noprofile.md
@@ -35,6 +35,7 @@ input-file:
3535
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-01-03/gallery.json
3636
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/runCommand.json
3737
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/common-types/v1/common.json
38+
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/preview/2024-03-01-preview/diagnostic.json
3839
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
3940
module-version: 0.3.0
4041
# Normally, title is the service name
@@ -232,4 +233,33 @@ directive:
232233
subject: VMRunCommand|VmssVMRunCommand
233234
verb: Get
234235
remove: true
236+
### Remove All Diagnostic cmdlets aside from Invoke Spot Placement Recommender - generate ONLY SpotPlacementRecommender cmdlets
237+
- where:
238+
verb: Get
239+
subject: Diagnostic
240+
remove: true
241+
- where:
242+
verb: Get
243+
subject: DiskInspection
244+
remove: true
245+
- where:
246+
verb: New
247+
subject: DiskInspection
248+
remove: true
249+
- where:
250+
verb: Read
251+
subject: DiagnosticOperation
252+
remove: true
253+
- where:
254+
verb: Register
255+
subject: DiskInspectionStorageConfiguration
256+
remove: true
257+
- where:
258+
verb: Test
259+
subject: DiskInspectionStorageConfiguration
260+
remove: true
261+
- where:
262+
verb: Get
263+
subject: SpotPlacementRecommender
264+
remove: true
235265
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"resourceType": "locations",
3+
"apiVersion": "2024-03-01-preview",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.compute"
6+
},
7+
"commands": [
8+
{
9+
"name": "Invoke-AzSpotPlacementRecommender",
10+
"description": "Generates placement scores for Spot VM skus.",
11+
"path": "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnostics/spotPlacementRecommender/generate",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.compute/invoke-azspotplacementrecommender"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-Location <String>",
20+
"[-SubscriptionId <String>]"
21+
]
22+
}
23+
]
24+
},
25+
"examples": [
26+
{
27+
"description": "Generates placement scores for Spot VM skus.",
28+
"parameters": [
29+
{
30+
"name": "-Location",
31+
"value": "[Path.location]"
32+
},
33+
{
34+
"name": "-SubscriptionId",
35+
"value": "[Path.subscriptionId]"
36+
}
37+
]
38+
}
39+
]
40+
}
41+
]
42+
}
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
### Example 1: Regionally scoped Spot Placement Recommender scores
2+
```powershell
3+
$resourceSku1 = @{sku = "Standard_D2_v3"}
4+
$resourceSku2 = @{sku = "Standard_D2_v2"}
5+
$resourceSku3 = @{sku = "Standard_D4_v3"}
6+
$desiredSizes = $resourceSku1,$resourceSku2,$resourceSku3
7+
$desiredLocations = 'japaneast','southcentralus','centralus'
8+
9+
$response = Invoke-AzSpotPlacementRecommender -Location eastus -DesiredCount 1 -DesiredLocation $desiredLocations -DesiredSize $desiredSizes
10+
$response.PlacementScore
11+
```
12+
13+
```output
14+
AvailabilityZone IsQuotaAvailable Region Score Sku
15+
---------------- ---------------- ------ ----- ---
16+
True japaneast RestrictedSkuNotAvailable Standard_D2_v3
17+
True japaneast RestrictedSkuNotAvailable Standard_D2_v2
18+
True japaneast RestrictedSkuNotAvailable Standard_D4_v3
19+
True southcentralus High Standard_D2_v3
20+
True southcentralus High Standard_D2_v2
21+
True southcentralus High Standard_D4_v3
22+
True centralus RestrictedSkuNotAvailable Standard_D2_v3
23+
True centralus RestrictedSkuNotAvailable Standard_D2_v2
24+
True centralus RestrictedSkuNotAvailable Standard_D4_v3
25+
```
26+
27+
Returns regionally scoped spot placement recommender scores for the input.
28+
29+
### Example 2: Zonally scoped Spot Placement Recommender scores
30+
```powershell
31+
$resourceSku1 = @{sku = "Standard_D2_v3"}
32+
$resourceSku2 = @{sku = "Standard_D2_v2"}
33+
$resourceSku3 = @{sku = "Standard_D4_v3"}
34+
$desiredSizes = $resourceSku1,$resourceSku2,$resourceSku3
35+
$desiredLocations = 'japaneast','southcentralus','centralus'
36+
37+
$response = Invoke-AzSpotPlacementRecommender -Location eastus -DesiredCount 1 -DesiredLocation $desiredLocations -DesiredSize $desiredSizes -AvailabilityZone
38+
$response.PlacementScore
39+
```
40+
41+
```output
42+
AvailabilityZone IsQuotaAvailable Region Score Sku
43+
---------------- ---------------- ------ ----- ---
44+
1 True japaneast High Standard_D2_v3
45+
2 True japaneast High Standard_D2_v3
46+
3 True japaneast High Standard_D2_v3
47+
1 True japaneast High Standard_D2_v2
48+
2 True japaneast High Standard_D2_v2
49+
3 True japaneast High Standard_D2_v2
50+
1 True japaneast High Standard_D4_v3
51+
2 True japaneast High Standard_D4_v3
52+
3 True japaneast High Standard_D4_v3
53+
1 True southcentralus High Standard_D2_v3
54+
2 True southcentralus High Standard_D2_v3
55+
3 True southcentralus High Standard_D2_v3
56+
1 True southcentralus High Standard_D2_v2
57+
2 True southcentralus High Standard_D2_v2
58+
3 True southcentralus High Standard_D2_v2
59+
1 True southcentralus High Standard_D4_v3
60+
2 True southcentralus High Standard_D4_v3
61+
3 True southcentralus High Standard_D4_v3
62+
1 True centralus DataNotFoundOrStale Standard_D2_v3
63+
2 True centralus High Standard_D2_v3
64+
3 True centralus High Standard_D2_v3
65+
1 True centralus DataNotFoundOrStale Standard_D2_v2
66+
2 True centralus High Standard_D2_v2
67+
3 True centralus High Standard_D2_v2
68+
1 True centralus DataNotFoundOrStale Standard_D4_v3
69+
2 True centralus High Standard_D4_v3
70+
3 True centralus High Standard_D4_v3
71+
```
72+
73+
Returns zonally scoped spot placement recommender scores for the input.
74+
75+
### Example 3: Regionally scoped Spot Placement Recommender scores using SpotPlacementRecommenderInput parameter as argument
76+
```powershell
77+
$resourceSku1 = @{sku = "Standard_D2_v3"}
78+
$resourceSku2 = @{sku = "Standard_D2_v2"}
79+
$resourceSku3 = @{sku = "Standard_D4_v3"}
80+
$desiredSizes = $resourceSku1,$resourceSku2,$resourceSku3
81+
$desiredLocations = 'japaneast','southcentralus','centralus'
82+
$desiredCount = 1
83+
84+
$spotPlacementRecommenderInput = @{desiredLocation = $desiredLocations; desiredSize = $desiredSizes; desiredCount = $desiredCount; availabilityZone = $false}
85+
86+
$response = Invoke-AzSpotPlacementRecommender -Location eastus -SpotPlacementRecommenderInput $spotPlacementRecommenderInput
87+
$response.PlacementScore
88+
```
89+
90+
```output
91+
AvailabilityZone IsQuotaAvailable Region Score Sku
92+
---------------- ---------------- ------ ----- ---
93+
True japaneast RestrictedSkuNotAvailable Standard_D2_v3
94+
True japaneast RestrictedSkuNotAvailable Standard_D2_v2
95+
True japaneast RestrictedSkuNotAvailable Standard_D4_v3
96+
True southcentralus High Standard_D2_v3
97+
True southcentralus High Standard_D2_v2
98+
True southcentralus High Standard_D4_v3
99+
True centralus RestrictedSkuNotAvailable Standard_D2_v3
100+
True centralus RestrictedSkuNotAvailable Standard_D2_v2
101+
True centralus RestrictedSkuNotAvailable Standard_D4_v3
102+
```
103+
104+
Returns regionally scoped spot placement recommender scores for the input.
105+
106+
### Example 2: Zonally scoped Spot Placement Recommender scores using SpotPlacementRecommenderInput parameter as argument
107+
```powershell
108+
$resourceSku1 = @{sku = "Standard_D2_v3"}
109+
$resourceSku2 = @{sku = "Standard_D2_v2"}
110+
$resourceSku3 = @{sku = "Standard_D4_v3"}
111+
$desiredSizes = $resourceSku1,$resourceSku2,$resourceSku3
112+
$desiredLocations = 'japaneast','southcentralus','centralus'
113+
$desiredCount = 1
114+
115+
$spotPlacementRecommenderInput = @{desiredLocation = $desiredLocations; desiredSize = $desiredSizes; desiredCount = $desiredCount; availabilityZone = $true}
116+
117+
$response = Invoke-AzSpotPlacementRecommender -Location eastus -SpotPlacementRecommenderInput $spotPlacementRecommenderInput
118+
$response.PlacementScore
119+
```
120+
121+
```output
122+
AvailabilityZone IsQuotaAvailable Region Score Sku
123+
---------------- ---------------- ------ ----- ---
124+
1 True japaneast High Standard_D2_v3
125+
2 True japaneast High Standard_D2_v3
126+
3 True japaneast High Standard_D2_v3
127+
1 True japaneast High Standard_D2_v2
128+
2 True japaneast High Standard_D2_v2
129+
3 True japaneast High Standard_D2_v2
130+
1 True japaneast High Standard_D4_v3
131+
2 True japaneast High Standard_D4_v3
132+
3 True japaneast High Standard_D4_v3
133+
1 True southcentralus High Standard_D2_v3
134+
2 True southcentralus High Standard_D2_v3
135+
3 True southcentralus High Standard_D2_v3
136+
1 True southcentralus High Standard_D2_v2
137+
2 True southcentralus High Standard_D2_v2
138+
3 True southcentralus High Standard_D2_v2
139+
1 True southcentralus High Standard_D4_v3
140+
2 True southcentralus High Standard_D4_v3
141+
3 True southcentralus High Standard_D4_v3
142+
1 True centralus High Standard_D2_v3
143+
2 True centralus High Standard_D2_v3
144+
3 True centralus High Standard_D2_v3
145+
1 True centralus High Standard_D2_v2
146+
2 True centralus High Standard_D2_v2
147+
3 True centralus High Standard_D2_v2
148+
1 True centralus High Standard_D4_v3
149+
2 True centralus High Standard_D4_v3
150+
3 True centralus High Standard_D4_v3
151+
```
152+
153+
Returns zonally scoped spot placement recommender scores for the input.

src/Compute/Compute.Autorest/exports/Get-AzGalleryApplication.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ INPUTOBJECT <IComputeIdentity>: Identity Parameter
4343
[Id <String>]: Resource identity path
4444
[InstanceId <String>]: The instance ID of the virtual machine.
4545
[Location <String>]: The location upon which run commands is queried.
46+
[OperationId <String>]: The ID of an ongoing async operation.
4647
[ResourceGroupName <String>]: The name of the resource group.
4748
[RunCommandName <String>]: The name of the virtual machine run command.
4849
[SubscriptionId <String>]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
@@ -172,7 +173,13 @@ begin {
172173
List = 'Az.Compute.private\Get-AzGalleryApplication_List';
173174
}
174175
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
175-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
176+
$testPlayback = $false
177+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
178+
if ($testPlayback) {
179+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
180+
} else {
181+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
182+
}
176183
}
177184
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
178185
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Compute/Compute.Autorest/exports/Get-AzGalleryApplicationVersion.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ INPUTOBJECT <IComputeIdentity>: Identity Parameter
4343
[Id <String>]: Resource identity path
4444
[InstanceId <String>]: The instance ID of the virtual machine.
4545
[Location <String>]: The location upon which run commands is queried.
46+
[OperationId <String>]: The ID of an ongoing async operation.
4647
[ResourceGroupName <String>]: The name of the resource group.
4748
[RunCommandName <String>]: The name of the virtual machine run command.
4849
[SubscriptionId <String>]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
@@ -187,7 +188,13 @@ begin {
187188
List = 'Az.Compute.private\Get-AzGalleryApplicationVersion_List';
188189
}
189190
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
190-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
191+
$testPlayback = $false
192+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
193+
if ($testPlayback) {
194+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
195+
} else {
196+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
197+
}
191198
}
192199
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
193200
[Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

0 commit comments

Comments
 (0)