Skip to content

Commit

Permalink
avoid breaking customer experience
Browse files Browse the repository at this point in the history
  • Loading branch information
VeryEarly committed May 27, 2021
1 parent c184553 commit f934ce0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ResourceGraph/ResourceGraph/Cmdlets/SearchAzureRmGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceGraph.Cmdlets
/// Search-AzGraph cmdlet
/// </summary>
/// <seealso cref="Microsoft.Azure.Commands.ResourceGraph.Utilities.ResourceGraphBaseCmdlet" />
[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<PSObject>))]
public class SearchAzureRmGraph : ResourceGraphBaseCmdlet
{
/// <summary>
Expand Down Expand Up @@ -160,7 +160,7 @@ public override void ExecuteCmdlet()
}
}

var psResourceGraphResponse = new PSResourceGraphResponse();
var psResourceGraphResponse = new PSResourceGraphResponse<PSObject>();
QueryResponse response = null;

var resultTruncated = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PSObject> : IList<PSObject>
{

[Ps1Xml(Target = ViewControl.List)]
public string SkipToken { get; set; }

[Ps1Xml(Target = ViewControl.List)]
public IList<PSObject> Data { get; set; }

public PSObject this[int index] { get => Data[index]; set => Data[index] = value; }

public IEnumerator<PSObject> 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<PSObject>.Remove(PSObject item) => Data.Remove(item);
}
}

0 comments on commit f934ce0

Please sign in to comment.