Skip to content

Commit a0a7823

Browse files
authored
Merge pull request #141 from yanqiongchen/backup-admin-update
[2203] Backup admin powershell update
1 parent ef55ed0 commit a0a7823

40 files changed

+4544
-1465
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
#
4+
# Copyright Microsoft Corporation
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ----------------------------------------------------------------------------------
15+
16+
<#
17+
.Synopsis
18+
Clear a backup location.
19+
.Description
20+
Clear a backup location.
21+
.Example
22+
PS C:\> {{ Add code here }}
23+
24+
{{ Add output here }}
25+
.Example
26+
PS C:\> {{ Add code here }}
27+
28+
{{ Add output here }}
29+
30+
.Inputs
31+
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackupLocation
32+
.Outputs
33+
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackupLocation
34+
.Notes
35+
COMPLEX PARAMETER PROPERTIES
36+
37+
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
38+
39+
.Link
40+
https://docs.microsoft.com/en-us/powershell/module/azs.backup.admin/clear-azsbackupconfiguration
41+
#>
42+
function Clear-AzsBackupConfiguration {
43+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackupLocation])]
44+
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
45+
param(
46+
[Parameter()]
47+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
48+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.DefaultInfo(Script='(Get-AzLocation)[0].Location')]
49+
[System.String]
50+
# Name of the backup location.
51+
${Location},
52+
53+
[Parameter()]
54+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
55+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.DefaultInfo(Script='"system.$((Get-AzLocation)[0].Location)"')]
56+
[System.String]
57+
# Name of the resource group.
58+
${ResourceGroupName},
59+
60+
[Parameter()]
61+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
62+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
63+
[System.String]
64+
# Subscription credentials that uniquely identify Microsoft Azure subscription.
65+
# The subscription ID forms part of the URI for every service call.
66+
${SubscriptionId},
67+
68+
[Parameter()]
69+
[Alias('AzureRMContext', 'AzureCredential')]
70+
[ValidateNotNull()]
71+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Azure')]
72+
[System.Management.Automation.PSObject]
73+
# The credentials, account, tenant, and subscription used for communication with Azure.
74+
${DefaultProfile},
75+
76+
[Parameter()]
77+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
78+
[System.Management.Automation.SwitchParameter]
79+
# Run the command as a job
80+
${AsJob},
81+
82+
[Parameter(DontShow)]
83+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
84+
[System.Management.Automation.SwitchParameter]
85+
# Wait for .NET debugger to attach
86+
${Break},
87+
88+
[Parameter(DontShow)]
89+
[ValidateNotNull()]
90+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
91+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.SendAsyncStep[]]
92+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
93+
${HttpPipelineAppend},
94+
95+
[Parameter(DontShow)]
96+
[ValidateNotNull()]
97+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
98+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.SendAsyncStep[]]
99+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
100+
${HttpPipelinePrepend},
101+
102+
[Parameter()]
103+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
104+
[System.Management.Automation.SwitchParameter]
105+
# Run the command asynchronously
106+
${NoWait},
107+
108+
[Parameter(DontShow)]
109+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
110+
[System.Uri]
111+
# The URI for the proxy server to use
112+
${Proxy},
113+
114+
[Parameter(DontShow)]
115+
[ValidateNotNull()]
116+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
117+
[System.Management.Automation.PSCredential]
118+
# Credentials for a proxy server to use for the remote call
119+
${ProxyCredential},
120+
121+
[Parameter(DontShow)]
122+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
123+
[System.Management.Automation.SwitchParameter]
124+
# Use the default credentials for the proxy
125+
${ProxyUseDefaultCredentials}
126+
)
127+
128+
process {
129+
# Restrict the cmdlet to being a blank PUT operation to clear the backup configuration
130+
$PSBoundParameters.Add('Location1', $Location)
131+
$PSBoundParameters.Add('UserName', $null)
132+
133+
Azs.Backup.Admin.internal\Clear-AzsBackupConfiguration @PSBoundParameters
134+
}
135+
}

src/Azs.Backup.Admin/custom/Get-AzsBackup.ps1

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
#
4+
# Copyright Microsoft Corporation
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ----------------------------------------------------------------------------------
15+
116
<#
217
.Synopsis
318
Returns a backup from a location based on name.
@@ -8,9 +23,10 @@ To view examples, please use the -Online parameter with Get-Help or navigate to:
823
.Inputs
924
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.IBackupAdminIdentity
1025
.Outputs
11-
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IBackup
26+
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackup
1227
.Notes
1328
COMPLEX PARAMETER PROPERTIES
29+
1430
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
1531
1632
INPUTOBJECT <IBackupAdminIdentity>: Identity Parameter
@@ -23,7 +39,7 @@ INPUTOBJECT <IBackupAdminIdentity>: Identity Parameter
2339
https://docs.microsoft.com/en-us/powershell/module/azs.backup.admin/get-azsbackup
2440
#>
2541
function Get-AzsBackup {
26-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IBackup])]
42+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackup])]
2743
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
2844
param(
2945
[Parameter(ParameterSetName='Get')]

src/Azs.Backup.Admin/custom/Restore-AzsBackup.ps1

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
#
4+
# Copyright Microsoft Corporation
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ----------------------------------------------------------------------------------
15+
116
<#
217
.Synopsis
318
Restore a backup.
419
.Description
520
Restore a backup.
621
.Example
7-
To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/azs.backup.admin/restore-azsbackup
22+
PS C:\> {{ Add code here }}
23+
24+
{{ Add output here }}
25+
.Example
26+
PS C:\> {{ Add code here }}
27+
28+
{{ Add output here }}
29+
830
.Inputs
9-
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IRestoreOptions
31+
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IRestoreOptions
1032
.Inputs
1133
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.IBackupAdminIdentity
1234
.Outputs
1335
System.Boolean
1436
.Notes
1537
COMPLEX PARAMETER PROPERTIES
38+
1639
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
1740
1841
INPUTOBJECT <IBackupAdminIdentity>: Identity Parameter
@@ -33,13 +56,6 @@ function Restore-AzsBackup {
3356
[OutputType([System.Boolean])]
3457
[CmdletBinding(DefaultParameterSetName='RestoreExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
3558
param(
36-
[Parameter(ParameterSetName='Restore', Mandatory)]
37-
[Parameter(ParameterSetName='RestoreExpanded', Mandatory)]
38-
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
39-
[System.String]
40-
# Name of the backup.
41-
${Name},
42-
4359
[Parameter(ParameterSetName='Restore')]
4460
[Parameter(ParameterSetName='RestoreExpanded')]
4561
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
@@ -48,6 +64,13 @@ param(
4864
# Name of the backup location.
4965
${Location},
5066

67+
[Parameter(ParameterSetName='Restore', Mandatory)]
68+
[Parameter(ParameterSetName='RestoreExpanded', Mandatory)]
69+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
70+
[System.String]
71+
# Name of the backup.
72+
${Name},
73+
5174
[Parameter(ParameterSetName='Restore')]
5275
[Parameter(ParameterSetName='RestoreExpanded')]
5376
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
@@ -76,7 +99,7 @@ param(
7699
[Parameter(ParameterSetName='Restore', Mandatory)]
77100
[Parameter(ParameterSetName='RestoreViaIdentity', Mandatory)]
78101
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Body')]
79-
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IRestoreOptions]
102+
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IRestoreOptions]
80103
# Properties for restore options.
81104
# To construct, see NOTES section for RESTOREOPTION properties and create a hash table.
82105
${RestoreOption},

0 commit comments

Comments
 (0)