Skip to content

Commit

Permalink
Added -EdgeZone and -ResourceType parameter to New-AzSnapshotUpdateCo… (
Browse files Browse the repository at this point in the history
Azure#19284)

* Added -EdgeZone and -ResourceType parameter to New-AzSnapshotUpdateConfig and Get-AzComputeResourceSku

* Removed Space

* Refactored code in ResourceSkuMethod and updated Help docs

* Updated Changelog.md file

* Removed unused ResourceType parameter
  • Loading branch information
pselugar authored Oct 17, 2022
1 parent 95f926a commit f296d27
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
-->
## Upcoming Release
* Added `-EdgeZone` optional parameter for `Get-AzComputeResourceSku` and `New-AzSnapshotUpdateConfig` cmdlets.
* Added Disk Delete Optional parameters `OsDisk Deletion Option` and `Delete Option` to the `Set-AzVmssStorageProfile` (OS Disk) and `Add-AzVmssDataDisk` (Data Disk)
* Improved printed output for `Get-AzComputeResourceSku`
* Updated `Get-AzHost` cmdlet logic to return Host for `-ResourceId` parameterset.
* For `New-AzGalleryImageVersion`, update property mapping for `Encryption`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public partial class GetAzureRmComputeResourceSku : ComputeAutomationBaseCmdlet
[LocationCompleter("Microsoft.Compute/locations/publishers")]
public string Location { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Sets the edge zone name. If set, the query will be routed to the specified edgezone instead of the main region.")]
public string EdgeZone { get; set; }

public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
Expand All @@ -53,11 +59,11 @@ public override void ExecuteCmdlet()
if (this.IsParameterBound(c => c.Location))
{
string filter = String.Format("location eq '{0}'", this.Location);
result = ResourceSkusClient.List(filter);
result = ResourceSkusClient.List(filter, this.EdgeZone);
}
else
{
result = ResourceSkusClient.List();
result = ResourceSkusClient.List(includeExtendedLocations: this.EdgeZone);
}
var resultList = result.ToList();
var nextPageLink = result.NextPageLink;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public partial class NewAzureRmSnapshotUpdateConfigCommand : Microsoft.Azure.Com
ValueFromPipelineByPropertyName = true)]
public KeyVaultAndSecretReference DiskEncryptionKey { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Sets the edge zone name. If set, the query will be routed to the specified edgezone instead of the main region.")]
public string EdgeZone { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
Expand Down Expand Up @@ -131,6 +137,9 @@ private void Run()
// Encryption
Encryption vEncryption = null;

// ExtendedLocation
ExtendedLocation vExtendedLocation = null;

// Sku
SnapshotSku vSku = null;

Expand All @@ -145,6 +154,11 @@ private void Run()
vEncryptionSettingsCollection.Enabled = (bool) this.EncryptionSettingsEnabled;
}

if (this.IsParameterBound(c => c.EdgeZone))
{
vExtendedLocation = new ExtendedLocation { Name = this.EdgeZone, Type = ExtendedLocationTypes.EdgeZone };
}

if (this.IsParameterBound(c => c.DiskEncryptionKey))
{
if (vEncryptionSettingsCollection == null)
Expand Down
18 changes: 17 additions & 1 deletion src/Compute/Compute/help/Get-AzComputeResourceSku.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ List all compute resource Skus
## SYNTAX

```
Get-AzComputeResourceSku [[-Location] <String>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Get-AzComputeResourceSku [[-Location] <String>] [-EdgeZone <String>] [-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -45,6 +46,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -EdgeZone
Sets the edge zone name. If set, the query will be routed to the specified edgezone instead of the main region.
```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -Location
Specifies a location of the available skus to list.
Expand Down
23 changes: 19 additions & 4 deletions src/Compute/Compute/help/New-AzSnapshotUpdateConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Creates a configurable snapshot update object.
```
New-AzSnapshotUpdateConfig [[-SkuName] <String>] [[-OsType] <OperatingSystemTypes>] [[-DiskSizeGB] <Int32>]
[[-Tag] <Hashtable>] [-SupportsHibernation <Boolean>] [-EncryptionSettingsEnabled <Boolean>]
[-DiskEncryptionKey <KeyVaultAndSecretReference>] [-KeyEncryptionKey <KeyVaultAndKeyReference>]
[-DiskEncryptionSetId <String>] [-EncryptionType <String>] [-PublicNetworkAccess <String>]
[-DataAccessAuthMode <String>] [-Architecture <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
[-Confirm] [<CommonParameters>]
[-DiskEncryptionKey <KeyVaultAndSecretReference>] [-EdgeZone <String>]
[-KeyEncryptionKey <KeyVaultAndKeyReference>] [-DiskEncryptionSetId <String>] [-EncryptionType <String>]
[-PublicNetworkAccess <String>] [-DataAccessAuthMode <String>] [-Architecture <String>]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -144,6 +144,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -EdgeZone
Sets the edge zone name. If set, the query will be routed to the specified edgezone instead of the main region.
```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -EncryptionSettingsEnabled
Enable encryption settings.
Expand Down

0 comments on commit f296d27

Please sign in to comment.