Skip to content

Commit 2f530aa

Browse files
committed
addingLocation
1 parent 4858155 commit 2f530aa

File tree

10 files changed

+57
-15
lines changed

10 files changed

+57
-15
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public abstract class AzureBackupCmdletBase : AzurePSCmdlet
4141
/// </summary>
4242
private string resourceName { get; set; }
4343

44+
/// <summary>
45+
/// Resource context for the operation
46+
/// </summary>
47+
private string location { get; set; }
48+
4449
/// <summary>
4550
/// Client request id.
4651
/// </summary>
@@ -82,10 +87,11 @@ protected void RefreshClientRequestId()
8287
clientRequestId = Guid.NewGuid().ToString() + "-" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ssZ") + "-PS";
8388
}
8489

85-
public void InitializeAzureBackupCmdlet(string rgName, string rName)
90+
public void InitializeAzureBackupCmdlet(string rgName, string rName, string locationName)
8691
{
8792
resourceGroupName = rgName;
8893
resourceName = rName;
94+
location = locationName;
8995

9096
RefreshClientRequestId();
9197
WriteDebug(string.Format("Initialized AzureBackup Cmdlet, ClientRequestId: {0}, ResourceGroupName: {1}, ResourceName : {2}", this.clientRequestId, resourceGroupName, resourceName));

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal static class AzureBackupCmdletHelpMessage
2020
public const string PolicyName = "The protection policy name.";
2121
public const string ResourceGroupName = "The ResourceGroup name.";
2222
public const string ResourceName = "The Resource name.";
23+
public const string Location = "Location.";
2324
public const string TargetLocation = "The directory where the credentials file will be saved.";
2425
public const string ContainerResourceName = "The container resource name aka friendly name.";
2526
public const string ContainerId = "The container ID.";

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupDSCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override void ExecuteCmdlet()
4040

4141
WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}", item.ResourceGroupName, item.ResourceName));
4242

43-
InitializeAzureBackupCmdlet(item.ResourceGroupName, item.ResourceName);
43+
InitializeAzureBackupCmdlet(item.ResourceGroupName, item.ResourceName, item.Location);
4444
}
4545
}
4646
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupVaultCmdletBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ public abstract class AzureBackupVaultCmdletBase : AzureBackupCmdletBase
3636
[ValidateNotNullOrEmpty]
3737
public string ResourceName { get; set; }
3838

39+
[Parameter(Position = 2, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.Location, ValueFromPipelineByPropertyName = true)]
40+
[ValidateNotNullOrEmpty]
41+
public string Location { get; set; }
3942

4043
public override void ExecuteCmdlet()
4144
{
4245
base.ExecuteCmdlet();
4346

4447
WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}", ResourceGroupName, ResourceName));
4548

46-
InitializeAzureBackupCmdlet(ResourceGroupName, ResourceName);
49+
InitializeAzureBackupCmdlet(ResourceGroupName, ResourceName, Location);
4750
}
4851
}
4952
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public override void ExecuteCmdlet()
7171

7272
WriteObject(containerInfos.ConvertAll(containerInfo =>
7373
{
74-
return new AzureBackupContainer(containerInfo);
74+
return new AzureBackupContainer(containerInfo, ResourceGroupName, ResourceName, Location);
7575
}));
7676
});
7777
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/ProtectionPolicy/GetAzureBackupProtectionPolicy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public override void ExecuteCmdlet()
6060

6161
public void WriteAzureBackupProtectionPolicy(ProtectionPolicyInfo sourcePolicy)
6262
{
63-
this.WriteObject(new AzureBackupProtectionPolicy(ResourceGroupName, ResourceName, sourcePolicy));
63+
this.WriteObject(new AzureBackupProtectionPolicy(ResourceGroupName, ResourceName, Location, sourcePolicy));
6464
}
6565

6666
public void WriteAzureBackupProtectionPolicy(IEnumerable<ProtectionPolicyInfo> sourcePolicyList)
@@ -69,7 +69,7 @@ public void WriteAzureBackupProtectionPolicy(IEnumerable<ProtectionPolicyInfo> s
6969

7070
foreach (var sourcePolicy in sourcePolicyList)
7171
{
72-
targetList.Add(new AzureBackupProtectionPolicy(ResourceGroupName, ResourceName, sourcePolicy));
72+
targetList.Add(new AzureBackupProtectionPolicy(ResourceGroupName, ResourceName, Location, sourcePolicy));
7373
}
7474

7575
this.WriteObject(targetList, true);

src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
<Prefer32Bit>false</Prefer32Bit>
4444
</PropertyGroup>
4545
<ItemGroup>
46+
<Reference Include="BackupManagementInterface, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>Resources\BackupManagementInterface.dll</HintPath>
49+
</Reference>
50+
<Reference Include="BMSCommonInterface, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
51+
<SpecificVersion>False</SpecificVersion>
52+
<HintPath>Resources\BMSCommonInterface.dll</HintPath>
53+
</Reference>
4654
<Reference Include="Hyak.Common">
4755
<HintPath>..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
4856
</Reference>
@@ -170,6 +178,8 @@
170178
</EmbeddedResource>
171179
</ItemGroup>
172180
<ItemGroup>
181+
<Content Include="Resources\BackupManagementInterface.dll" />
182+
<Content Include="Resources\BMSCommonInterface.dll" />
173183
<Content Include="Resources\Microsoft.WindowsAzure.Management.Common.dll" />
174184
<Content Include="Resources\Security.Cryptography.dll" />
175185
</ItemGroup>

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupBaseObjects.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@ public class AzureBackupVaultContextObject
2727
/// </summary>
2828
public string ResourceName { get; set; }
2929

30+
/// <summary>
31+
/// ResourceName of the azurebackup object
32+
/// </summary>
33+
public string Location { get; set; }
34+
3035
public AzureBackupVaultContextObject()
3136
{
3237
}
33-
34-
public AzureBackupVaultContextObject(string resourceGroupName, string resourceName)
38+
39+
public AzureBackupVaultContextObject(string resourceGroupName, string resourceName, string locationName)
3540
{
3641
ResourceGroupName = resourceGroupName;
3742
ResourceName = resourceName;
43+
Location = locationName;
3844
}
3945
}
4046

@@ -60,20 +66,20 @@ public AzureBackupContainerContextObject()
6066
}
6167

6268
public AzureBackupContainerContextObject(AzureBackupContainerContextObject azureBackupContainerContextObject)
63-
: base(azureBackupContainerContextObject.ResourceGroupName, azureBackupContainerContextObject.ResourceName)
69+
: base(azureBackupContainerContextObject.ResourceGroupName, azureBackupContainerContextObject.ResourceName, azureBackupContainerContextObject.Location)
6470
{
6571
ContainerType = azureBackupContainerContextObject.ContainerType;
6672
ContainerUniqueName = azureBackupContainerContextObject.ContainerUniqueName;
6773
}
6874
public AzureBackupContainerContextObject(AzureBackupContainer azureBackupContainer)
69-
: base(azureBackupContainer.ResourceGroupName, azureBackupContainer.ResourceName)
75+
: base(azureBackupContainer.ResourceGroupName, azureBackupContainer.ResourceName, azureBackupContainer.Location)
7076
{
7177
ContainerType = azureBackupContainer.ContainerType;
7278
ContainerUniqueName = azureBackupContainer.ContainerUniqueName;
7379
}
7480

75-
public AzureBackupContainerContextObject(ContainerInfo containerInfo)
76-
: base(containerInfo.ParentContainerName, containerInfo.FriendlyName)
81+
public AzureBackupContainerContextObject(ContainerInfo containerInfo, string rgName, string rName, string location)
82+
: base(rgName, rName, location)
7783
{
7884
ContainerType = containerInfo.ContainerType;
7985
ContainerUniqueName = containerInfo.Name;

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class AzureBackupContainer : AzureBackupContainerContextObject
3838

3939
public AzureBackupContainer() : base() { }
4040

41-
public AzureBackupContainer(ContainerInfo containerInfo)
42-
: base(containerInfo)
41+
public AzureBackupContainer(ContainerInfo containerInfo, string rgName, string rName, string location)
42+
: base(containerInfo, rgName, rName, location)
4343
{
4444
HealthStatus = containerInfo.HealthStatus;
4545
RegistrationStatus = containerInfo.RegistrationStatus;

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/ProtectionPolicy.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,23 @@ public AzureBackupProtectionPolicy()
4848
{
4949
}
5050

51-
public AzureBackupProtectionPolicy(string resourceGroupName, string resourceName, ProtectionPolicyInfo sourcePolicy) : base(resourceGroupName, resourceName)
51+
public AzureBackupProtectionPolicy(string resourceGroupName, string resourceName, ProtectionPolicyInfo sourcePolicy)
52+
: base(resourceGroupName, resourceName, "dfsdf")
53+
{
54+
InstanceId = sourcePolicy.InstanceId;
55+
Name = sourcePolicy.Name;
56+
WorkloadType = sourcePolicy.WorkloadType;
57+
58+
BackupType = sourcePolicy.Schedule.BackupType;
59+
ScheduleStartTime = sourcePolicy.Schedule.ScheduleStartTime;
60+
ScheduleRunTimes = sourcePolicy.Schedule.ScheduleRunTimes;
61+
62+
RetentionType = sourcePolicy.Schedule.RetentionPolicy.RetentionType.ToString();
63+
RetentionDuration = sourcePolicy.Schedule.RetentionPolicy.RetentionDuration;
64+
}
65+
66+
public AzureBackupProtectionPolicy(string resourceGroupName, string resourceName, string location, ProtectionPolicyInfo sourcePolicy)
67+
: base(resourceGroupName, resourceName, location)
5268
{
5369
InstanceId = sourcePolicy.InstanceId;
5470
Name = sourcePolicy.Name;

0 commit comments

Comments
 (0)