Skip to content

Commit dca949c

Browse files
author
Samuel Anudeep
committed
Merge pull request #195 from MabOneSdk/dev1
Recovery Services Backup Initial PR
2 parents 8396353 + bf79f3f commit dca949c

File tree

69 files changed

+6417
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+6417
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#
2+
# Module manifest for module 'Microsoft.Azure.Commands.RecoveryServices.Backup'
3+
#
4+
# Generated by: Microsoft Corporation
5+
#
6+
# Generated on: 3/16/2016
7+
#
8+
9+
@{
10+
11+
# Version number of this module.
12+
ModuleVersion = '1.0.4'
13+
14+
# ID used to uniquely identify this module
15+
GUID = '3d444bee-6742-4ce2-b573-dfd1b7c4144c'
16+
17+
# Author of this module
18+
Author = 'Microsoft Corporation'
19+
20+
# Company or vendor of this module
21+
CompanyName = 'Microsoft Corporation'
22+
23+
# Copyright statement for this module
24+
Copyright = 'Microsoft Corporation. All rights reserved.'
25+
26+
# Description of the functionality provided by this module
27+
Description = 'Microsoft Azure PowerShell - Azure Backup service cmdlets for Azure Resource Manager'
28+
29+
# Minimum version of the Windows PowerShell engine required by this module
30+
PowerShellVersion = '3.0'
31+
32+
# Name of the Windows PowerShell host required by this module
33+
PowerShellHostName = ''
34+
35+
# Minimum version of the Windows PowerShell host required by this module
36+
PowerShellHostVersion = ''
37+
38+
# Minimum version of the .NET Framework required by this module
39+
DotNetFrameworkVersion = '4.0'
40+
41+
# Minimum version of the common language runtime (CLR) required by this module
42+
CLRVersion='4.0'
43+
44+
# Processor architecture (None, X86, Amd64, IA64) required by this module
45+
ProcessorArchitecture = 'None'
46+
47+
# Modules that must be imported into the global environment prior to importing this module
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.4'})
49+
50+
# Assemblies that must be loaded prior to importing this module
51+
RequiredAssemblies = @()
52+
53+
# Script files (.ps1) that are run in the caller's environment prior to importing this module
54+
ScriptsToProcess = @()
55+
56+
# Type files (.ps1xml) to be loaded when importing this module
57+
TypesToProcess = @()
58+
59+
# Format files (.ps1xml) to be loaded when importing this module
60+
FormatsToProcess = @()
61+
62+
# Modules to import as nested modules of the module specified in ModuleToProcess
63+
NestedModules = @(
64+
'.\Microsoft.Azure.Commands.RecoveryServices.Backup.dll'
65+
)
66+
67+
# Functions to export from this module
68+
FunctionsToExport = '*'
69+
70+
# Cmdlets to export from this module
71+
CmdletsToExport = '*'
72+
73+
# Variables to export from this module
74+
VariablesToExport = '*'
75+
76+
# Aliases to export from this module
77+
AliasesToExport = @()
78+
79+
# List of all modules packaged with this module
80+
ModuleList = @()
81+
82+
# List of all files packaged with this module
83+
FileList = @()
84+
85+
# Private data to pass to the module specified in ModuleToProcess
86+
PrivateData = ''
87+
88+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
22+
{
23+
internal static class ParamHelpMsg
24+
{
25+
internal static class Container
26+
{
27+
public const string Name = "The name of the resource being managed by the Azure Backup service (for example: resource name of the VM).";
28+
public const string ResourceGroupName = "The ResourceGroup of the resource being managed by the Azure Backup service (for example: ResourceGroup name of the VM).";
29+
public const string Status = "The registration status of the Azure Backup container.";
30+
public const string ContainerType = "The type of the Azure Backup container. This can be a Windows Server, an Azure IaaS VM, or a Data Protection Manager server.";
31+
}
32+
33+
internal static class Common
34+
{
35+
public const string Vault = "The Azure Backup vault object which is the parent resource.";
36+
public const string WorkloadType = "Workload type of the resource (for example: AzureVM, WindowsServer).";
37+
public const string BackupManagementType = "Backup Management type of the resource (for example: MAB, DPM).";
38+
}
39+
40+
internal static class Policy
41+
{
42+
public const string Name = "Name of the Policy that is being managed.";
43+
public const string RetentionPolicy = "Retention Policy object for the policy.";
44+
public const string SchedulePolicy = "Schedule Policy object for the policy.";
45+
public const string ProtectionPolicy = "Protection policy object.";
46+
}
47+
48+
internal static class Job
49+
{
50+
public const string FromFilter = "Beginning value of time range for which jobs have to be fetched.";
51+
public const string ToFilter = "Ending value of time range for which jobs have to be fetched.";
52+
public const string OperationFilter = "Filter value for type of job.";
53+
public const string StatusFilter = "Filter value for status of job.";
54+
public const string BackupManagementTypeFilter = "Filter value for Backup Management Type of job.";
55+
public const string JobIdFilter = "Filter value for Id of job.";
56+
public const string JobFilter = "Job whose latest object has to be fetched.";
57+
public const string WaitJobOrListFilter = "Job or List of jobs until end of which the cmdlet should wait.";
58+
public const string WaitJobTimeoutFilter = "Maximum time to wait before aborting wait in seconds.";
59+
}
60+
}
61+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
22+
{
23+
internal class CmdletWarningAndErrorMessages
24+
{
25+
internal class Job
26+
{
27+
public const string RefineFilters = "There are more than 1000 jobs for the filter combination you have provided. Kindly refine your filters to fetch the job you want.";
28+
public const string AllowedDateTimeRangeExceeded = "To filter should not be more than 30 days away from From filter.";
29+
public const string JobIdAndJobMismatch = "JobID and Job object provided don't match each other";
30+
public const string ToShouldBeLessThanFrom = "To filter should not less than From filter.";
31+
public const string WaitJobInvalidInput = "Please pass Job or List of Jobs as input. Your input is of type: ";
32+
}
33+
}
34+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
16+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel;
17+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers;
18+
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Linq;
22+
using System.Management.Automation;
23+
using System.Text;
24+
using System.Threading.Tasks;
25+
26+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
27+
{
28+
/// <summary>
29+
/// Get list of containers
30+
/// </summary>
31+
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesContainer"), OutputType(typeof(List<AzureRmRecoveryServicesContainerBase>), typeof(AzureRmRecoveryServicesContainerBase))]
32+
public class GetAzureRmRecoveryServicesContainer : RecoveryServicesBackupVaultCmdletBase
33+
{
34+
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsg.Container.ContainerType)]
35+
[ValidateNotNullOrEmpty]
36+
public ContainerType ContainerType { get; set; }
37+
38+
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsg.Container.Name)]
39+
[ValidateNotNullOrEmpty]
40+
public string Name { get; set; }
41+
42+
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsg.Container.ResourceGroupName)]
43+
[ValidateNotNullOrEmpty]
44+
public string ResourceGroupName { get; set; }
45+
46+
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsg.Container.Status)]
47+
[ValidateNotNullOrEmpty]
48+
public ContainerRegistrationStatus Status { get; set; }
49+
50+
public override void ExecuteCmdlet()
51+
{
52+
ExecutionBlock(() =>
53+
{
54+
base.ExecuteCmdlet();
55+
56+
PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary<System.Enum, object>()
57+
{
58+
{ContainerParams.Vault, Vault},
59+
{ContainerParams.ContainerType, ContainerType},
60+
{ContainerParams.Name, Name},
61+
{ContainerParams.ResourceGroupName, ResourceGroupName},
62+
{ContainerParams.Status, Status},
63+
}, HydraAdapter);
64+
65+
IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(ContainerType);
66+
var containerModels = psBackupProvider.ListProtectionContainers();
67+
68+
if (containerModels.Count == 1)
69+
{
70+
WriteObject(containerModels.First());
71+
}
72+
else
73+
{
74+
WriteObject(containerModels);
75+
}
76+
});
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)