Skip to content

[2203] Backup admin powershell update #141

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

Merged
merged 9 commits into from
Jan 25, 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
135 changes: 135 additions & 0 deletions src/Azs.Backup.Admin/custom/Clear-AzsBackupConfiguration.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Clear a backup location.
.Description
Clear a backup location.
.Example
PS C:\> {{ Add code here }}

{{ Add output here }}
.Example
PS C:\> {{ Add code here }}

{{ Add output here }}

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackupLocation
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackupLocation
.Notes
COMPLEX PARAMETER PROPERTIES

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.

.Link
https://docs.microsoft.com/en-us/powershell/module/azs.backup.admin/clear-azsbackupconfiguration
#>
function Clear-AzsBackupConfiguration {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackupLocation])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.DefaultInfo(Script='(Get-AzLocation)[0].Location')]
[System.String]
# Name of the backup location.
${Location},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.DefaultInfo(Script='"system.$((Get-AzLocation)[0].Location)"')]
[System.String]
# Name of the resource group.
${ResourceGroupName},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# Subscription credentials that uniquely identify Microsoft Azure subscription.
# The subscription ID forms part of the URI for every service call.
${SubscriptionId},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
${DefaultProfile},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command as a job
${AsJob},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command asynchronously
${NoWait},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
)

process {
# Restrict the cmdlet to being a blank PUT operation to clear the backup configuration
$PSBoundParameters.Add('Location1', $Location)
$PSBoundParameters.Add('UserName', $null)

Azs.Backup.Admin.internal\Clear-AzsBackupConfiguration @PSBoundParameters
}
}
20 changes: 18 additions & 2 deletions src/Azs.Backup.Admin/custom/Get-AzsBackup.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Returns a backup from a location based on name.
Expand All @@ -8,9 +23,10 @@ To view examples, please use the -Online parameter with Get-Help or navigate to:
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.IBackupAdminIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IBackup
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackup
.Notes
COMPLEX PARAMETER PROPERTIES

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.

INPUTOBJECT <IBackupAdminIdentity>: Identity Parameter
Expand All @@ -23,7 +39,7 @@ INPUTOBJECT <IBackupAdminIdentity>: Identity Parameter
https://docs.microsoft.com/en-us/powershell/module/azs.backup.admin/get-azsbackup
#>
function Get-AzsBackup {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IBackup])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IBackup])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Get')]
Expand Down
43 changes: 33 additions & 10 deletions src/Azs.Backup.Admin/custom/Restore-AzsBackup.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Restore a backup.
.Description
Restore a backup.
.Example
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
PS C:\> {{ Add code here }}

{{ Add output here }}
.Example
PS C:\> {{ Add code here }}

{{ Add output here }}

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IRestoreOptions
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IRestoreOptions
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.IBackupAdminIdentity
.Outputs
System.Boolean
.Notes
COMPLEX PARAMETER PROPERTIES

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.

INPUTOBJECT <IBackupAdminIdentity>: Identity Parameter
Expand All @@ -33,13 +56,6 @@ function Restore-AzsBackup {
[OutputType([System.Boolean])]
[CmdletBinding(DefaultParameterSetName='RestoreExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='Restore', Mandatory)]
[Parameter(ParameterSetName='RestoreExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
[System.String]
# Name of the backup.
${Name},

[Parameter(ParameterSetName='Restore')]
[Parameter(ParameterSetName='RestoreExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
Expand All @@ -48,6 +64,13 @@ param(
# Name of the backup location.
${Location},

[Parameter(ParameterSetName='Restore', Mandatory)]
[Parameter(ParameterSetName='RestoreExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
[System.String]
# Name of the backup.
${Name},

[Parameter(ParameterSetName='Restore')]
[Parameter(ParameterSetName='RestoreExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Path')]
Expand Down Expand Up @@ -76,7 +99,7 @@ param(
[Parameter(ParameterSetName='Restore', Mandatory)]
[Parameter(ParameterSetName='RestoreViaIdentity', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20180901.IRestoreOptions]
[Microsoft.Azure.PowerShell.Cmdlets.BackupAdmin.Models.Api20210901.IRestoreOptions]
# Properties for restore options.
# To construct, see NOTES section for RESTOREOPTION properties and create a hash table.
${RestoreOption},
Expand Down
Loading