Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compute] Changes to restore point instance view #18144

Merged
merged 6 commits into from
May 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- `New-AzSnapshotConfig`
- `New-AzSnapshotUpdateConfig`
- `New-AzGalleryImageDefinition`
* Added `-InstanceView` parameter to `Get-AzRestorePoint`

## Version 4.26.0
* Added `-ImageReferenceId` parameter to following cmdlets: `New-AzVm`, `New-AzVmConfig`, `New-AzVmss`, `Set-AzVmssStorageProfile`
Expand Down
7 changes: 7 additions & 0 deletions src/Compute/Compute/Generated/Models/PSRestorePoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,12 @@ class PSRestorePoint
// Gets or sets list of disk resource ids that the customer wishes to exclude from
// the restore point. If no disks are specified, all disks will be included.
public IList<ApiEntityReference> ExcludeDisks { get; set; }

public RestorePointInstanceView InstanceView { get; set; }

public DateTime? TimeCreated { get; set; }

public ApiEntityReference SourceRestorePoint { get; set; }

}
}
24 changes: 20 additions & 4 deletions src/Compute/Compute/RestorePoints/GetAzRestorePoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public class GetAzureRestorePoint : ComputeAutomationBaseCmdlet
[Alias("RestorePointName")]
public string Name { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public SwitchParameter InstanceView { get; set; }


public override void ExecuteCmdlet()
{
Expand All @@ -60,11 +65,22 @@ public override void ExecuteCmdlet()
string resourceGroup = this.ResourceGroupName;
string restorePointName = this.Name;
string restorePointCollectionName = this.RestorePointCollectionName;
bool instanceViewTrue = this.InstanceView.IsPresent;

var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName);
var psObject = new PSRestorePoint();
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePoint, PSRestorePoint>(result, psObject);
WriteObject(psObject);
if (instanceViewTrue == true)
{
var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName, "InstanceView");
var psObject = new PSRestorePoint();
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePoint, PSRestorePoint>(result, psObject);
WriteObject(psObject);
}
else
{
var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName);
var psObject = new PSRestorePoint();
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePoint, PSRestorePoint>(result, psObject);
WriteObject(psObject);
}
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void ExecuteCmdlet()
string resourceGroup = this.ResourceGroupName;
string restorePointCollectionName = this.Name;

var result = RestorePointCollectionsClient.Get(resourceGroup, restorePointCollectionName);
var result = RestorePointCollectionsClient.Get(resourceGroup, restorePointCollectionName, "restorePoints");
var psObject = new PSRestorePointCollection();
ComputeAutomationAutoMapperProfile.Mapper.Map<RestorePointCollection, PSRestorePointCollection>(result, psObject);
WriteObject(psObject);
Expand Down
56 changes: 20 additions & 36 deletions src/Compute/Compute/help/Get-AzRestorePoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Command to get the Restore Point

```
Get-AzRestorePoint [-ResourceGroupName] <String> [-RestorePointCollectionName] <String> [-Name] <String>
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-InstanceView] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

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

```yaml
Type: IAzureContextContainer
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential

Expand All @@ -46,11 +46,26 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -InstanceView
InstanceView of the resource

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Name
Resource name

```yaml
Type: String
Type: System.String
Parameter Sets: (All)
Aliases: RestorePointName

Expand All @@ -65,7 +80,7 @@ Accept wildcard characters: False
Resource Group name

```yaml
Type: String
Type: System.String
Parameter Sets: (All)
Aliases:

Expand All @@ -80,7 +95,7 @@ Accept wildcard characters: False
Restore Point Collection Name

```yaml
Type: String
Type: System.String
Parameter Sets: (All)
Aliases:

Expand All @@ -91,37 +106,6 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
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).

Expand Down