diff --git a/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs b/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs index 674d722d56da..1cd37d91945e 100644 --- a/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs +++ b/src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs @@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceGraph.Cmdlets /// Search-AzGraph cmdlet /// /// - [Cmdlet(VerbsCommon.Search, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Graph", DefaultParameterSetName = "SubscriptionScopedQuery"), OutputType(typeof(PSResourceGraphResponse))] + [Cmdlet(VerbsCommon.Search, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Graph", DefaultParameterSetName = "SubscriptionScopedQuery"), OutputType(typeof(PSResourceGraphResponse))] public class SearchAzureRmGraph : ResourceGraphBaseCmdlet { /// @@ -160,7 +160,7 @@ public override void ExecuteCmdlet() } } - var psResourceGraphResponse = new PSResourceGraphResponse(); + var psResourceGraphResponse = new PSResourceGraphResponse(); QueryResponse response = null; var resultTruncated = false; diff --git a/src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs b/src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs index 96e81b15eb35..67c4ca490e76 100644 --- a/src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs +++ b/src/ResourceGraph/ResourceGraph/Models/PSResourceGraphResponse.cs @@ -14,17 +14,53 @@ namespace Microsoft.Azure.Commands.ResourceGraph.Models { + using System; + using System.Collections; using System.Collections.Generic; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common.Attributes; - public class PSResourceGraphResponse + public class PSResourceGraphResponse : IList { + [Ps1Xml(Target = ViewControl.List)] public string SkipToken { get; set; } [Ps1Xml(Target = ViewControl.List)] public IList Data { get; set; } + public PSObject this[int index] { get => Data[index]; set => Data[index] = value; } + + public IEnumerator GetEnumerator() + { + return Data.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public bool IsReadOnly => Data.IsReadOnly; + + public int Count => Data.Count; + + public void Add(PSObject value) => Data.Add(value); + + public void Clear() => Data.Clear(); + + public bool Contains(PSObject value) => Data.Contains(value); + + public void CopyTo(PSObject[] array, int index) => Data.CopyTo(array, index); + + public int IndexOf(PSObject value) => Data.IndexOf(value); + + public void Insert(int index, PSObject value) => Data.Insert(index, value); + + public void Remove(PSObject value) => Data.Remove(value); + + public void RemoveAt(int index) => Data.RemoveAt(index); + + bool ICollection.Remove(PSObject item) => Data.Remove(item); } }