Skip to content

Commit 53224ed

Browse files
author
Samuel Anudeep
committed
Merge pull request #256 from MabOneSdk/anudeeb-dev1
Fix for bug: ContainerURI is coming up in Container Unique Name
2 parents b7fa2e0 + ddc539f commit 53224ed

File tree

2 files changed

+17
-7
lines changed
  • src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models

2 files changed

+17
-7
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ public class AzureRmRecoveryServicesContainerBase : AzureRmRecoveryServicesConta
7373
public string Name { get; set; }
7474

7575
public AzureRmRecoveryServicesContainerBase(ProtectionContainerResource protectionContainer)
76-
: base(ConversionUtils.GetPsContainerType(((ProtectionContainer)protectionContainer.Properties).ContainerType),
76+
: base(ConversionUtils.GetPsContainerType(((ProtectionContainer)protectionContainer.Properties).ContainerType),
7777
((ProtectionContainer)protectionContainer.Properties).BackupManagementType)
7878
{
79-
Name = protectionContainer.Name;
79+
Name = IdUtils.GetNameFromUri(protectionContainer.Name);
8080
}
8181
}
8282

@@ -166,7 +166,7 @@ public class AzureRmRecoveryServicesItemExtendedInfoBase : AzureRmRecoveryServic
166166
public class AzureRmRecoveryServicesRecoveryPointBase : AzureRmRecoveryServicesItemContext
167167
{
168168
private global::Microsoft.Azure.Management.RecoveryServices.Backup.Models.RecoveryPointResource rp;
169-
169+
170170
/// <summary>
171171
///
172172
/// </summary>
@@ -212,12 +212,12 @@ public override void Validate()
212212
{
213213
base.Validate();
214214

215-
if(string.IsNullOrEmpty(Name))
215+
if (string.IsNullOrEmpty(Name))
216216
{
217217
throw new ArgumentException(Resources.PolicyNameIsEmptyOrNull);
218218
}
219219

220-
if(string.IsNullOrEmpty(Id))
220+
if (string.IsNullOrEmpty(Id))
221221
{
222222
throw new ArgumentException(Resources.PolicyIdIsEmptyOrNull);
223223
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/Utils.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public class TraceUtils
4444
{
4545
public static string GetString<T>(IEnumerable<T> objList)
4646
{
47-
return (objList == null) ? "null" : "{" + string.Join(", ", objList.Select(e => e.ToString())) +"}";
48-
}
47+
return (objList == null) ? "null" : "{" + string.Join(", ", objList.Select(e => e.ToString())) + "}";
48+
}
4949
}
5050

5151
public class IdUtils
@@ -104,6 +104,16 @@ public static string GetValueByName(string id, string idName)
104104

105105
return dict[idName];
106106
}
107+
108+
/// <summary>
109+
/// URI format: Type;Name
110+
/// </summary>
111+
/// <param name="uri"></param>
112+
/// <returns></returns>
113+
public static string GetNameFromUri(string uri)
114+
{
115+
return uri.Substring(uri.IndexOf(NameDelimiter) + 1);
116+
}
107117
}
108118

109119
public class EnumUtils

0 commit comments

Comments
 (0)