forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ac99e4
commit d6d6dcc
Showing
12 changed files
with
222 additions
and
12 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
...coveryServices.Backup.Models/AzureWorkloadModels/AzureWorkloadSQLDatabaseProtectedItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Management.RecoveryServices.Backup.Models; | ||
|
||
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models | ||
{ | ||
/// <summary> | ||
/// Azure sql database workload Item Class | ||
/// </summary> | ||
public class AzureWorkloadSQLDatabaseProtectedItem : AzureItem | ||
{ | ||
/// <summary> | ||
/// friendly name of the DB represented by this backup item. | ||
/// </summary> | ||
public string FriendlyName { get; set; } | ||
|
||
/// <summary> | ||
/// host/Cluster Name for instance or AG. | ||
/// </summary> | ||
public string ServerName { get; set; } | ||
|
||
/// <summary> | ||
/// parent name of the DB such as Instance or Availability Group. | ||
/// </summary> | ||
public string ParentName { get; set; } | ||
|
||
/// <summary> | ||
/// protected item, example: for a DB, standalone server | ||
/// or distributed. | ||
/// </summary> | ||
public string ParentType { get; set; } | ||
|
||
/// <summary> | ||
/// error details in last backup | ||
/// </summary> | ||
public ErrorDetail LastBackupErrorDetail { get; set; } | ||
|
||
/// <summary> | ||
///ID of the protected item. | ||
/// </summary> | ||
public string ProtectedItemDataSourceId { get; set; } | ||
|
||
/// <summary> | ||
/// health status of the backup item | ||
/// </summary> | ||
public string ProtectedItemHealthStatus { get; set; } | ||
|
||
/// <summary> | ||
/// Constructor. Takes the service client object representing the protected item | ||
/// and converts it in to the PS protected item model | ||
/// </summary> | ||
/// <param name="protectedItemResource">Service client object representing the protected item resource</param> | ||
/// <param name="containerName">Name of the container associated with this protected item</param> | ||
/// <param name="containerType">Type of the container associated with this protected item</param> | ||
/// <param name="policyName">Name of the protection policy associated with this protected item</param> | ||
public AzureWorkloadSQLDatabaseProtectedItem(ProtectedItemResource protectedItemResource, | ||
string containerName, ContainerType containerType, string policyName) | ||
: base(protectedItemResource, containerName, containerType, policyName) | ||
{ | ||
AzureVmWorkloadSQLDatabaseProtectedItem protectedItem = (AzureVmWorkloadSQLDatabaseProtectedItem)protectedItemResource.Properties; | ||
FriendlyName = protectedItem.FriendlyName; | ||
ServerName = protectedItem.ServerName; | ||
ParentName = protectedItem.ParentName; | ||
ParentType = protectedItem.ParentType; | ||
LastBackupErrorDetail = protectedItem.LastBackupErrorDetail; | ||
ProtectedItemDataSourceId = protectedItem.ProtectedItemDataSourceId; | ||
ProtectedItemHealthStatus = protectedItem.ProtectedItemHealthStatus; | ||
LastBackupStatus = protectedItem.LastBackupStatus; | ||
LastBackupTime = protectedItem.LastBackupTime; | ||
ProtectionState = | ||
EnumUtils.GetEnum<ItemProtectionState>(protectedItem.ProtectionState.ToString()); | ||
ProtectionStatus = EnumUtils.GetEnum<ItemProtectionStatus>(protectedItem.ProtectionStatus); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Azure Workload Item ExtendedInfo Class | ||
/// </summary> | ||
public class AzureWorkloadSQLDatabaseProtectedItemExtendedInfo : AzureItemExtendedInfo | ||
{ } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...ryServices/Commands.RecoveryServices.Backup.Test/ScenarioTests/AzureWorkload/ItemTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; | ||
using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests | ||
{ | ||
public partial class ItemTests : RMTestBase | ||
{ | ||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(TestConstants.Workload, TestConstants.AzureVmWorkload)] | ||
public void TestAzureVmWorkloadBackupItem() | ||
{ | ||
TestController.NewInstance.RunPsTest( | ||
_logger, PsBackupProviderTypes.AzureWorkload, "Test-AzureVmWorkloadBackupItem"); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...yServices/Commands.RecoveryServices.Backup.Test/ScenarioTests/AzureWorkload/ItemTests.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# ---------------------------------------------------------------------------------- | ||
# | ||
# 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. | ||
# ---------------------------------------------------------------------------------- | ||
|
||
function Test-AzureVmWorkloadBackupItem | ||
{ | ||
try | ||
{ | ||
Get-AzureRmRecoveryServicesVault -ResourceGroupName 'shracrg' -Name 'shracsql' | Set-AzureRmRecoveryServicesVaultContext | ||
Backup-AzureRmRecoveryServicesBackupItem -BackupType "Full" -EnableCompression | ||
} | ||
finally | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters