Skip to content

Commit 366e845

Browse files
haaghawyunchi-ms
andauthored
[Compute] Changes to restore point instance view (#18144)
* Changes to restore point * changes to help * changelog changes * filling help * test recording * Update ChangeLog.md Co-authored-by: Yunchi Wang <[email protected]>
1 parent b51a2ba commit 366e845

File tree

6 files changed

+1441
-858
lines changed

6 files changed

+1441
-858
lines changed

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.RestorePointsTests/TestRestorePoints.json

Lines changed: 1392 additions & 817 deletions
Large diffs are not rendered by default.

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- `New-AzSnapshotConfig`
3434
- `New-AzSnapshotUpdateConfig`
3535
- `New-AzGalleryImageDefinition`
36+
* Added `-InstanceView` parameter to `Get-AzRestorePoint`
3637

3738
## Version 4.26.0
3839
* Added `-ImageReferenceId` parameter to following cmdlets: `New-AzVm`, `New-AzVmConfig`, `New-AzVmss`, `Set-AzVmssStorageProfile`

src/Compute/Compute/Generated/Models/PSRestorePoint.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,12 @@ class PSRestorePoint
4141
// Gets or sets list of disk resource ids that the customer wishes to exclude from
4242
// the restore point. If no disks are specified, all disks will be included.
4343
public IList<ApiEntityReference> ExcludeDisks { get; set; }
44+
45+
public RestorePointInstanceView InstanceView { get; set; }
46+
47+
public DateTime? TimeCreated { get; set; }
48+
49+
public ApiEntityReference SourceRestorePoint { get; set; }
50+
4451
}
4552
}

src/Compute/Compute/RestorePoints/GetAzRestorePoint.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public class GetAzureRestorePoint : ComputeAutomationBaseCmdlet
5151
[Alias("RestorePointName")]
5252
public string Name { get; set; }
5353

54+
[Parameter(
55+
Mandatory = false,
56+
ValueFromPipelineByPropertyName = true)]
57+
public SwitchParameter InstanceView { get; set; }
58+
5459

5560
public override void ExecuteCmdlet()
5661
{
@@ -60,11 +65,22 @@ public override void ExecuteCmdlet()
6065
string resourceGroup = this.ResourceGroupName;
6166
string restorePointName = this.Name;
6267
string restorePointCollectionName = this.RestorePointCollectionName;
68+
bool instanceViewTrue = this.InstanceView.IsPresent;
6369

64-
var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName);
65-
var psObject = new PSRestorePoint();
66-
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePoint, PSRestorePoint>(result, psObject);
67-
WriteObject(psObject);
70+
if (instanceViewTrue == true)
71+
{
72+
var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName, "InstanceView");
73+
var psObject = new PSRestorePoint();
74+
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePoint, PSRestorePoint>(result, psObject);
75+
WriteObject(psObject);
76+
}
77+
else
78+
{
79+
var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName);
80+
var psObject = new PSRestorePoint();
81+
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePoint, PSRestorePoint>(result, psObject);
82+
WriteObject(psObject);
83+
}
6884
});
6985
}
7086
}

src/Compute/Compute/RestorePoints/GetAzRestorePointCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override void ExecuteCmdlet()
5454
string resourceGroup = this.ResourceGroupName;
5555
string restorePointCollectionName = this.Name;
5656

57-
var result = RestorePointCollectionsClient.Get(resourceGroup, restorePointCollectionName);
57+
var result = RestorePointCollectionsClient.Get(resourceGroup, restorePointCollectionName, "restorePoints");
5858
var psObject = new PSRestorePointCollection();
5959
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePointCollection, PSRestorePointCollection>(result, psObject);
6060
WriteObject(psObject);

src/Compute/Compute/help/Get-AzRestorePoint.md

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Command to get the Restore Point
1414

1515
```
1616
Get-AzRestorePoint [-ResourceGroupName] <String> [-RestorePointCollectionName] <String> [-Name] <String>
17-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
17+
[-InstanceView] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -35,7 +35,7 @@ Get Restore Point
3535
The credentials, account, tenant, and subscription used for communication with Azure.
3636

3737
```yaml
38-
Type: IAzureContextContainer
38+
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
3939
Parameter Sets: (All)
4040
Aliases: AzContext, AzureRmContext, AzureCredential
4141

@@ -46,11 +46,26 @@ Accept pipeline input: False
4646
Accept wildcard characters: False
4747
```
4848
49+
### -InstanceView
50+
InstanceView of the resource
51+
52+
```yaml
53+
Type: System.Management.Automation.SwitchParameter
54+
Parameter Sets: (All)
55+
Aliases:
56+
57+
Required: False
58+
Position: Named
59+
Default value: None
60+
Accept pipeline input: True (ByPropertyName)
61+
Accept wildcard characters: False
62+
```
63+
4964
### -Name
5065
Resource name
5166
5267
```yaml
53-
Type: String
68+
Type: System.String
5469
Parameter Sets: (All)
5570
Aliases: RestorePointName
5671

@@ -65,7 +80,7 @@ Accept wildcard characters: False
6580
Resource Group name
6681
6782
```yaml
68-
Type: String
83+
Type: System.String
6984
Parameter Sets: (All)
7085
Aliases:
7186

@@ -80,7 +95,7 @@ Accept wildcard characters: False
8095
Restore Point Collection Name
8196
8297
```yaml
83-
Type: String
98+
Type: System.String
8499
Parameter Sets: (All)
85100
Aliases:
86101

@@ -91,37 +106,6 @@ Accept pipeline input: True (ByPropertyName)
91106
Accept wildcard characters: False
92107
```
93108
94-
### -Confirm
95-
Prompts you for confirmation before running the cmdlet.
96-
97-
```yaml
98-
Type: SwitchParameter
99-
Parameter Sets: (All)
100-
Aliases: cf
101-
102-
Required: False
103-
Position: Named
104-
Default value: None
105-
Accept pipeline input: False
106-
Accept wildcard characters: False
107-
```
108-
109-
### -WhatIf
110-
Shows what would happen if the cmdlet runs.
111-
The cmdlet is not run.
112-
113-
```yaml
114-
Type: SwitchParameter
115-
Parameter Sets: (All)
116-
Aliases: wi
117-
118-
Required: False
119-
Position: Named
120-
Default value: None
121-
Accept pipeline input: False
122-
Accept wildcard characters: False
123-
```
124-
125109
### CommonParameters
126110
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
127111

0 commit comments

Comments
 (0)