Skip to content

Commit

Permalink
Move ResourcesRestOperations to generated (#39150)
Browse files Browse the repository at this point in the history
* Move most of ResourcesRestOperations to generated

* make api-version as method parameter for Resources_GetById

* Add comments
  • Loading branch information
live1206 committed Oct 10, 2023
1 parent aea130c commit e53f2c9
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.ResourceManager.Resources.Models;

Expand All @@ -18,6 +20,8 @@ namespace Azure.ResourceManager.Resources
[CodeGenSuppress("GetAvailableLocationsAsync", typeof(CancellationToken))]
[CodeGenSuppress("GetTenants")]
[CodeGenSuppress("CreateResourceIdentifier")]
[CodeGenSuppress("GetGenericResourceAsync", typeof(ResourceIdentifier), typeof(string), typeof(CancellationToken))]
[CodeGenSuppress("GetGenericResource", typeof(ResourceIdentifier), typeof(string), typeof(CancellationToken))]
// [CodeGenSuppress("_tenantsRestClient")] // TODO: not working for private member
public partial class TenantResource : ArmResource
{
Expand Down Expand Up @@ -83,5 +87,51 @@ public virtual Pageable<TenantResourceProvider> GetTenantResourceProviders(int?
{
return GetTenantResourceProviders(expand, cancellationToken);
}

/// <summary>
/// Gets a resource by ID.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/{resourceId}</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Resources_GetById</description>
/// </item>
/// </list>
/// </summary>
/// <param name="resourceId"> The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceId"/> is null. </exception>
// api-version is defined as method parameter in spec but used as client parameter for Resources_GetById to keep the contract unchaged
[ForwardsClientCalls]
public virtual async Task<Response<GenericResource>> GetGenericResourceAsync(ResourceIdentifier resourceId, CancellationToken cancellationToken = default)
{
return await GetGenericResources().GetAsync(resourceId, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Gets a resource by ID.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/{resourceId}</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Resources_GetById</description>
/// </item>
/// </list>
/// </summary>
/// <param name="resourceId"> The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceId"/> is null. </exception>
// api-version is defined as method parameter in spec but used as client parameter for Resources_GetById to keep the contract unchaged
[ForwardsClientCalls]
public virtual Response<GenericResource> GetGenericResource(ResourceIdentifier resourceId, CancellationToken cancellationToken = default)
{
return GetGenericResources().Get(resourceId, cancellationToken);
}
}
}
Loading

0 comments on commit e53f2c9

Please sign in to comment.