-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Updating code snippets in Samples and Readme #22518
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
Merged
m-nash
merged 39 commits into
Azure:feature/mgmt-track2
from
AME-Redmond:JonathanCrd-5981-Code-samples-to-snippets
Jul 12, 2021
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
10f6ad0
Change the accessbility to virtual for Resource.Id
ccc17c7
merge from usptream
5060f5c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 9a9a651
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 7764cb5
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
832483a
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
3066cd2
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
9597dc7
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
86547b0
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 4fa650c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 6f858c5
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash fb80156
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 737171b
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 4f1408d
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
c5d5790
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 0bcb9e4
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
2a78d80
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
23eca40
Merge branch 'mgmt-track2' of https://github.com/AME-Redmond/azure-sd…
m-nash 2bddb0e
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 26e907c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash 3786863
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash a588338
Merge branch 'feature/mgmt-track2' into JonathanCrd-5981-Code-samples…
JonathanCrd 5a619ba
Initial setup
JonathanCrd 0a8286c
Adding Snippets to tests\Samples
JonathanCrd 22279c4
Generate snippets in markdown files
JonathanCrd 9f5bcfc
Sample 3 code snippets
JonathanCrd ee6a73b
Update Sample2_ManagingResourceGroups.cs
JonathanCrd 2ba2dc7
Update Snippets with generator
JonathanCrd 6926aa4
Fix Sample2 snippets
JonathanCrd ca9815d
Delete Azure - Backup.ResourceManager.Core.Tests.csproj
JonathanCrd e40fb45
Ignoring dummy subscription id tests
JonathanCrd bce156c
Adding namespaces to examples
JonathanCrd 7b3f8aa
Modify code snippets in main readme
JonathanCrd f2bd769
Add ignore tags
JonathanCrd 126ef16
Adding Azure.ResourceManager.Core namespace
JonathanCrd cca438d
Merge branch 'feature/mgmt-track2' into JonathanCrd-5981-Code-samples…
JonathanCrd ecc17e1
Update code snippets
JonathanCrd f34be39
Adjust indentation
JonathanCrd 705412a
Removing auto-gen snippets for Sample3
JonathanCrd 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
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
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
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
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
64 changes: 64 additions & 0 deletions
64
sdk/resourcemanager/Azure.ResourceManager.Core/tests/Samples/Readme.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,64 @@ | ||
| #region Snippet:Readme_AuthClient | ||
| using Azure.Identity; | ||
| using Azure.ResourceManager.Core; | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| #if !SNIPPET | ||
| using NUnit.Framework; | ||
|
|
||
| namespace Azure.ResourceManager.Core.Tests.Samples | ||
| { | ||
| class Readme | ||
| { | ||
| [Test] | ||
| [Ignore("Only verifying that the sample builds")] | ||
| public void ClientAuth() | ||
| { | ||
| #endif | ||
|
|
||
| // code omitted for brevity | ||
|
|
||
| var armClient = new ArmClient(new DefaultAzureCredential()); | ||
| #endregion Snippet:Readme_AuthClient | ||
| } | ||
|
|
||
| [Test] | ||
| [Ignore("Only verifying that the sample builds")] | ||
| public async Task CreateRG() | ||
| { | ||
| #region Snippet:Readme_CreateRG | ||
| // First, initialize the ArmClient and get the default subscription | ||
| var armClient = new ArmClient(new DefaultAzureCredential()); | ||
| Subscription subscription = armClient.DefaultSubscription; | ||
| // Now we get a ResourceGroup container for that subscription | ||
| ResourceGroupContainer rgContainer = subscription.GetResourceGroups(); | ||
|
|
||
| // With the container, we can create a new resource group with an specific name | ||
| string rgName = "myRgName"; | ||
| LocationData location = LocationData.WestUS; | ||
| ResourceGroup resourceGroup = await rgContainer.Construct(location).CreateOrUpdateAsync(rgName); | ||
| #endregion Snippet:Readme_CreateRG | ||
| } | ||
|
|
||
| [Test] | ||
| [Ignore("Only verifying that the sample builds")] | ||
| public async Task ListAllRG() | ||
| { | ||
| #region Snippet:Readme_ListAllRG | ||
| // First, initialize the ArmClient and get the default subscription | ||
| var armClient = new ArmClient(new DefaultAzureCredential()); | ||
| Subscription subscription = armClient.DefaultSubscription; | ||
|
|
||
| // Now we get a ResourceGroup container for that subscription | ||
| ResourceGroupContainer rgContainer = subscription.GetResourceGroups(); | ||
|
|
||
| // With ListAsync(), we can get a list of the resources in the container | ||
| AsyncPageable<ResourceGroup> response = rgContainer.ListAsync(); | ||
| await foreach (ResourceGroup rg in response) | ||
| { | ||
| Console.WriteLine(rg.Data.Name); | ||
| } | ||
| #endregion Snippet:Readme_ListAllRG | ||
| } | ||
| } | ||
| } |
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.