This repository was archived by the owner on Jun 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
Make extension clients public to enable mocking for extension methods #3483
Merged
ArcturusZhang
merged 68 commits into
Azure:feature/v3
from
ArcturusZhang:make-extensionclients-public
Nov 2, 2023
Merged
Changes from 63 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
54aef20
apply the new name and namespace for extension clients, make them pub…
ArcturusZhang ea2d69b
the armresource parent get and collection is not properly generated i…
ArcturusZhang d65585d
more fixes on the way
ArcturusZhang ebb94b4
fix the previous issues we have
ArcturusZhang 7cc4e91
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 2297a0c
fix an issue in resourcemanager
ArcturusZhang 6eb9f18
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang b69f94d
fix an issue of generating extra resource collection entries when not…
ArcturusZhang 89127ca
fix typo in comments
ArcturusZhang e085c70
change it back to internal
ArcturusZhang 08e4e16
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang c25e907
Revert "change it back to internal"
ArcturusZhang da37568
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang b3df442
remove the validations in extension method so that it will not block …
ArcturusZhang 0c2915f
remove all the validations in extension methods
ArcturusZhang d3307ba
regen other project
ArcturusZhang c086234
move other parameter validations into the mocking extension class
ArcturusZhang 9d6da2a
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang a67ae42
remove the regions because it has some issues sometimes with the remo…
ArcturusZhang 1f5d7b2
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 11bf3bc
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 8c071a3
remove the naming exception
ArcturusZhang 56d97a0
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 8e5eb8f
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 75b4da8
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 8568bcb
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 9e72af6
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang 4e4641e
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang 4ab1114
refactor class name to unify with others
ArcturusZhang 7859dc1
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang 39b4fbe
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang 09a5b47
a few refactor
ArcturusZhang ad65754
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang 31ec3e5
some refactor
ArcturusZhang b48e78f
regenerate
ArcturusZhang 24b387f
add a xml doc paragraph to guide how to mock
ArcturusZhang 97e3611
a refactor to let the getting collection from parent to use Expressions
ArcturusZhang dd06be4
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 29ee250
add new comment for collection getters
ArcturusZhang b9340e3
refactor the resource getters in armclient and regenerate
ArcturusZhang 631cb9c
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang d7f5e3d
Revert "Stop using npmrc to consume internal packages (#3809)"
ArcturusZhang fe7d808
Revert "Revert "Stop using npmrc to consume internal packages (#3809)""
ArcturusZhang 10f01b2
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang 2bd783b
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang af72bd9
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 478e666
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang ed0b452
refactor
ArcturusZhang 8881b7f
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang af58885
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 7e1e245
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 0da0b56
update the name change
ArcturusZhang 9a34447
fix test case
ArcturusZhang 9ee42ca
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 0ca10d0
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 1351e3f
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang ee1d023
refactor and fixes after merge
ArcturusZhang b37d771
refactor
ArcturusZhang 45a558c
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 27b058b
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang fd34428
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang ac1f4ad
a few refactor
ArcturusZhang 9ee9812
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang c632180
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang 0256f8c
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang cc34c98
Merge remote-tracking branch 'origin/feature/v3' into make-extensionc…
ArcturusZhang a2a5b9e
update resourcemanager version
ArcturusZhang a6b9e8e
Merge branch 'feature/v3' into make-extensionclients-public
ArcturusZhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
samples/Azure.ResourceManager.Sample/Generated/DedicatedHostGroupResource.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
207 changes: 207 additions & 0 deletions
207
samples/Azure.ResourceManager.Sample/Generated/Extensions/MockableSampleArmClient.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,207 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using Azure.Core; | ||
| using Azure.ResourceManager; | ||
| using Azure.ResourceManager.Sample; | ||
|
|
||
| namespace Azure.ResourceManager.Sample.Mocking | ||
| { | ||
| /// <summary> A class to add extension methods to ArmClient. </summary> | ||
| public partial class MockableSampleArmClient : ArmResource | ||
| { | ||
| /// <summary> Initializes a new instance of the <see cref="MockableSampleArmClient"/> class for mocking. </summary> | ||
| protected MockableSampleArmClient() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> Initializes a new instance of the <see cref="MockableSampleArmClient"/> class. </summary> | ||
| /// <param name="client"> The client parameters to use in these operations. </param> | ||
| /// <param name="id"> The identifier of the resource that is the target of operations. </param> | ||
| internal MockableSampleArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) | ||
| { | ||
| } | ||
|
|
||
| internal MockableSampleArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) | ||
| { | ||
| } | ||
|
|
||
| private string GetApiVersionOrNull(ResourceType resourceType) | ||
| { | ||
| TryGetApiVersion(resourceType, out string apiVersion); | ||
| return apiVersion; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing an <see cref="AvailabilitySetResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="AvailabilitySetResource.CreateResourceIdentifier" /> to create an <see cref="AvailabilitySetResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="AvailabilitySetResource" /> object. </returns> | ||
| public virtual AvailabilitySetResource GetAvailabilitySetResource(ResourceIdentifier id) | ||
| { | ||
| AvailabilitySetResource.ValidateResourceId(id); | ||
| return new AvailabilitySetResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="ProximityPlacementGroupResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="ProximityPlacementGroupResource.CreateResourceIdentifier" /> to create a <see cref="ProximityPlacementGroupResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="ProximityPlacementGroupResource" /> object. </returns> | ||
| public virtual ProximityPlacementGroupResource GetProximityPlacementGroupResource(ResourceIdentifier id) | ||
| { | ||
| ProximityPlacementGroupResource.ValidateResourceId(id); | ||
| return new ProximityPlacementGroupResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="DedicatedHostGroupResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="DedicatedHostGroupResource.CreateResourceIdentifier" /> to create a <see cref="DedicatedHostGroupResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="DedicatedHostGroupResource" /> object. </returns> | ||
| public virtual DedicatedHostGroupResource GetDedicatedHostGroupResource(ResourceIdentifier id) | ||
| { | ||
| DedicatedHostGroupResource.ValidateResourceId(id); | ||
| return new DedicatedHostGroupResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="DedicatedHostResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="DedicatedHostResource.CreateResourceIdentifier" /> to create a <see cref="DedicatedHostResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="DedicatedHostResource" /> object. </returns> | ||
| public virtual DedicatedHostResource GetDedicatedHostResource(ResourceIdentifier id) | ||
| { | ||
| DedicatedHostResource.ValidateResourceId(id); | ||
| return new DedicatedHostResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="SshPublicKeyResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="SshPublicKeyResource.CreateResourceIdentifier" /> to create a <see cref="SshPublicKeyResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="SshPublicKeyResource" /> object. </returns> | ||
| public virtual SshPublicKeyResource GetSshPublicKeyResource(ResourceIdentifier id) | ||
| { | ||
| SshPublicKeyResource.ValidateResourceId(id); | ||
| return new SshPublicKeyResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineExtensionImageResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineExtensionImageResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineExtensionImageResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineExtensionImageResource" /> object. </returns> | ||
| public virtual VirtualMachineExtensionImageResource GetVirtualMachineExtensionImageResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineExtensionImageResource.ValidateResourceId(id); | ||
| return new VirtualMachineExtensionImageResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineExtensionResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineExtensionResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineExtensionResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineExtensionResource" /> object. </returns> | ||
| public virtual VirtualMachineExtensionResource GetVirtualMachineExtensionResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineExtensionResource.ValidateResourceId(id); | ||
| return new VirtualMachineExtensionResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineScaleSetVirtualMachineExtensionResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineScaleSetVirtualMachineExtensionResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineScaleSetVirtualMachineExtensionResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineScaleSetVirtualMachineExtensionResource" /> object. </returns> | ||
| public virtual VirtualMachineScaleSetVirtualMachineExtensionResource GetVirtualMachineScaleSetVirtualMachineExtensionResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineScaleSetVirtualMachineExtensionResource.ValidateResourceId(id); | ||
| return new VirtualMachineScaleSetVirtualMachineExtensionResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineResource" /> object. </returns> | ||
| public virtual VirtualMachineResource GetVirtualMachineResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineResource.ValidateResourceId(id); | ||
| return new VirtualMachineResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing an <see cref="ImageResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="ImageResource.CreateResourceIdentifier" /> to create an <see cref="ImageResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="ImageResource" /> object. </returns> | ||
| public virtual ImageResource GetImageResource(ResourceIdentifier id) | ||
| { | ||
| ImageResource.ValidateResourceId(id); | ||
| return new ImageResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineScaleSetResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineScaleSetResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineScaleSetResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineScaleSetResource" /> object. </returns> | ||
| public virtual VirtualMachineScaleSetResource GetVirtualMachineScaleSetResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineScaleSetResource.ValidateResourceId(id); | ||
| return new VirtualMachineScaleSetResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineScaleSetExtensionResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineScaleSetExtensionResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineScaleSetExtensionResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineScaleSetExtensionResource" /> object. </returns> | ||
| public virtual VirtualMachineScaleSetExtensionResource GetVirtualMachineScaleSetExtensionResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineScaleSetExtensionResource.ValidateResourceId(id); | ||
| return new VirtualMachineScaleSetExtensionResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineScaleSetRollingUpgradeResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineScaleSetRollingUpgradeResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineScaleSetRollingUpgradeResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineScaleSetRollingUpgradeResource" /> object. </returns> | ||
| public virtual VirtualMachineScaleSetRollingUpgradeResource GetVirtualMachineScaleSetRollingUpgradeResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineScaleSetRollingUpgradeResource.ValidateResourceId(id); | ||
| return new VirtualMachineScaleSetRollingUpgradeResource(Client, id); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets an object representing a <see cref="VirtualMachineScaleSetVmResource" /> along with the instance operations that can be performed on it but with no data. | ||
| /// You can use <see cref="VirtualMachineScaleSetVmResource.CreateResourceIdentifier" /> to create a <see cref="VirtualMachineScaleSetVmResource" /> <see cref="ResourceIdentifier" /> from its components. | ||
| /// </summary> | ||
| /// <param name="id"> The resource ID of the resource to get. </param> | ||
| /// <returns> Returns a <see cref="VirtualMachineScaleSetVmResource" /> object. </returns> | ||
| public virtual VirtualMachineScaleSetVmResource GetVirtualMachineScaleSetVmResource(ResourceIdentifier id) | ||
| { | ||
| VirtualMachineScaleSetVmResource.ValidateResourceId(id); | ||
| return new VirtualMachineScaleSetVmResource(Client, id); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.