Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing expand on ListAtContext as well in preparation to expose that in each of the generated ListAsGeneric methods in autorest #22351

Merged
merged 6 commits into from
Jul 1, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ public static class ResourceListOperations
/// </summary>
/// <param name="resourceGroup"> The <see cref="ResourceGroupOperations"/> instance to use for the list. </param>
/// <param name="resourceFilters"> Optional filters for results. </param>
/// <param name="expand"> Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. </param>
/// <param name="top"> The number of results to return. </param>
/// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param>
/// <returns> A collection of resource operations that may take multiple service requests to iterate over. </returns>
public static Pageable<GenericResourceExpanded> ListAtContext(
ResourceGroupOperations resourceGroup,
ResourceFilterCollection resourceFilters = null,
string expand = null,
int? top = null,
CancellationToken cancellationToken = default)
{
return ListAtContextInternal(
resourceGroup,
resourceGroup.Id.Name,
resourceFilters,
expand,
top,
cancellationToken);
}
Expand All @@ -37,19 +40,22 @@ public static Pageable<GenericResourceExpanded> ListAtContext(
/// </summary>
/// <param name="resourceGroup"> The <see cref="ResourceGroupOperations"/> instance to use for the list. </param>
/// <param name="resourceFilters"> Optional filters for results. </param>
/// <param name="expand"> Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. </param>
/// <param name="top"> The number of results to return. </param>
/// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param>
/// <returns>An async collection of resource operations that may take multiple service requests to iterate over. </returns>
public static AsyncPageable<GenericResourceExpanded> ListAtContextAsync(
ResourceGroupOperations resourceGroup,
ResourceFilterCollection resourceFilters = null,
string expand = null,
int? top = null,
CancellationToken cancellationToken = default)
{
return ListAtContextInternalAsync(
resourceGroup,
resourceGroup.Id.Name,
resourceFilters,
expand,
top,
cancellationToken);
}
Expand All @@ -59,19 +65,22 @@ public static AsyncPageable<GenericResourceExpanded> ListAtContextAsync(
/// </summary>
/// <param name="subscription"> The <see cref="SubscriptionOperations"/> instance to use for the list. </param>
/// <param name="resourceFilters"> Optional filters for results. </param>
/// <param name="expand"> Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. </param>
/// <param name="top"> The number of results to return. </param>
/// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param>
/// <returns> A collection of resource operations that may take multiple service requests to iterate over. </returns>
public static Pageable<GenericResourceExpanded> ListAtContext(
SubscriptionOperations subscription,
ResourceFilterCollection resourceFilters = null,
string expand = null,
int? top = null,
CancellationToken cancellationToken = default)
{
return ListAtContextInternal(
subscription,
null,
resourceFilters,
expand,
top,
cancellationToken);
}
Expand All @@ -81,19 +90,22 @@ public static Pageable<GenericResourceExpanded> ListAtContext(
/// </summary>
/// <param name="subscription"> The <see cref="SubscriptionOperations"/> instance to use for the list. </param>
/// <param name="resourceFilters"> Optional filters for results. </param>
/// <param name="expand"> Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`. </param>
/// <param name="top"> The number of results to return. </param>
/// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param>
/// <returns> An async collection of resource operations that may take multiple service requests to iterate over. </returns>
public static AsyncPageable<GenericResourceExpanded> ListAtContextAsync(
SubscriptionOperations subscription,
ResourceFilterCollection resourceFilters = null,
string expand = null,
int? top = null,
CancellationToken cancellationToken = default)
{
return ListAtContextInternalAsync(
subscription,
null,
resourceFilters,
expand,
top,
cancellationToken);
}
Expand All @@ -108,21 +120,22 @@ private static AsyncPageable<GenericResourceExpanded> ListAtContextInternalAsync
ResourceOperationsBase resourceOperations,
string scopeFilter,
ResourceFilterCollection resourceFilters = null,
string expand = null,
int? top = null,
CancellationToken cancellationToken = default)
{
var restClient = GetGenericResourceContainer(resourceOperations);
AsyncPageable<GenericResourceExpanded> result;
if (scopeFilter == null)
{
result = restClient.ListAsync(resourceFilters?.ToString(), null, top, cancellationToken);
result = restClient.ListAsync(resourceFilters?.ToString(), expand, top, cancellationToken);
}
else
{
result = restClient.ListByResourceGroupAsync(
scopeFilter,
resourceFilters?.ToString(),
null,
expand,
top,
cancellationToken);
}
Expand All @@ -134,21 +147,22 @@ private static Pageable<GenericResourceExpanded> ListAtContextInternal(
ResourceOperationsBase resourceOperations,
string scopeFilter = null,
ResourceFilterCollection resourceFilters = null,
string expand = null,
int? top = null,
CancellationToken cancellationToken = default)
{
var restClient = GetGenericResourceContainer(resourceOperations);
Pageable<GenericResourceExpanded> result;
if (scopeFilter == null)
{
result = restClient.List(resourceFilters?.ToString(), null, top, cancellationToken);
result = restClient.List(resourceFilters?.ToString(), expand, top, cancellationToken);
}
else
{
result = restClient.ListByResourceGroup(
scopeFilter,
resourceFilters?.ToString(),
null,
expand,
top,
cancellationToken);
}
Expand Down