Skip to content

Commit f82c3d8

Browse files
author
dragonfly91
committed
files missed in prev commit
1 parent 0b29c43 commit f82c3d8

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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.Commands.RecoveryServices.Backup.Properties;
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+
/// Backup Item
30+
/// </summary>
31+
[Cmdlet(VerbsData.Backup, "AzureRmRecoveryServicesItem"), OutputType(typeof(AzureRmRecoveryServicesJobBase))]
32+
public class BackupAzureRmRecoveryServicesItem : RecoveryServicesBackupCmdletBase
33+
{
34+
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsg.Item.ProtectedItem, ValueFromPipeline = true)]
35+
[ValidateNotNullOrEmpty]
36+
public AzureRmRecoveryServicesItemBase Item { get; set; }
37+
38+
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsg.Item.ExpiryDate, ValueFromPipeline = false)]
39+
[ValidateNotNullOrEmpty]
40+
public DateTime ExpiryDate { get; set; }
41+
42+
public override void ExecuteCmdlet()
43+
{
44+
base.ExecuteCmdlet();
45+
46+
PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary<System.Enum, object>()
47+
{
48+
{ItemParams.Item, Item},
49+
{ItemParams.ExpiryDate, ExpiryDate},
50+
}, HydraAdapter);
51+
52+
IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(Item.WorkloadType, Item.BackupManagementType);
53+
var jobResponse = psBackupProvider.TriggerBackup();
54+
55+
HandleCreatedJob(jobResponse, Resources.TriggerBackupOperation);
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)