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

feat(mgmt): add Resource suffix #27588

Merged
merged 23 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected void CleanupResourceGroups()
{
try
{
_cleanupClient.GetManagementGroup(new ResourceIdentifier(mgmtGroupId)).Delete(_waitForCleanup);
_cleanupClient.GetManagementGroupResource(new ResourceIdentifier(mgmtGroupId)).Delete(_waitForCleanup);
}
catch (RequestFailedException e) when (e.Status == 404 || e.Status == 403)
{
Expand Down Expand Up @@ -218,7 +218,7 @@ public void OneTimeCleanupResourceGroups()
});
Parallel.ForEach(OneTimeManagementGroupCleanupPolicy.ManagementGroupsCreated, mgmtGroupId =>
{
_cleanupClient.GetManagementGroup(new ResourceIdentifier(mgmtGroupId)).Delete(_waitForCleanup);
_cleanupClient.GetManagementGroupResource(new ResourceIdentifier(mgmtGroupId)).Delete(_waitForCleanup);
});
}

Expand Down
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
All should have PrivateAssets="All" set so they don't become package dependencies
-->
<ItemGroup>
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20220321.5" PrivateAssets="All" />
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20220322.2" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20220111.2" PrivateAssets="All" />
<PackageReference Update="coverlet.collector" Version="1.3.0" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" PrivateAssets="All" />
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ When you first create your ARM client, choose the subscription you're going to w

```C# Snippet:Readme_DefaultSubscription
ArmClient armClient = new ArmClient(new DefaultAzureCredential());
Subscription subscription = armClient.GetDefaultSubscriptionAsync().Result;
SubscriptionResource subscription = armClient.GetDefaultSubscriptionAsync().Result;
```

This is a scoped operations object, and any operations you perform will be done under that subscription. From this object, you have access to all children via Collection objects. Or you can access individual children by ID.
Expand All @@ -30,7 +30,7 @@ ResourceGroupCollection rgCollection = subscription.GetResourceGroups();
// With the Collection, we can create a new resource group with an specific name
string rgName = "myRgName";
AzureLocation location = AzureLocation.WestUS2;
ResourceGroup resourceGroup = (await rgCollection.CreateOrUpdateAsync(WaitUntil.Completed, rgName, new ResourceGroupData(location))).Value;
ResourceGroupResource resourceGroup = (await rgCollection.CreateOrUpdateAsync(WaitUntil.Completed, rgName, new ResourceGroupData(location))).Value;
```

Now that we have the resource group created, we can manage the ConfigurationStore inside this resource group.
Expand All @@ -43,15 +43,15 @@ ConfigurationStoreData configurationStoreData = new ConfigurationStoreData("west
{
PublicNetworkAccess = PublicNetworkAccess.Disabled
};
ConfigurationStore configurationStore = (await resourceGroup.GetConfigurationStores().CreateOrUpdateAsync(WaitUntil.Completed, configurationStoreName, configurationStoreData)).Value;
ConfigurationStoreResource configurationStore = (await resourceGroup.GetConfigurationStores().CreateOrUpdateAsync(WaitUntil.Completed, configurationStoreName, configurationStoreData)).Value;
```

***List all configurationStores***

```C# Snippet:Managing_ConfigurationStores_ListAllConfigurationStores
AsyncPageable<ConfigurationStore> configurationStores = resourceGroup.GetConfigurationStores().GetAllAsync();
AsyncPageable<ConfigurationStoreResource> configurationStores = resourceGroup.GetConfigurationStores().GetAllAsync();

await foreach (ConfigurationStore item in configurationStores)
await foreach (ConfigurationStoreResource item in configurationStores)
{
Console.WriteLine(item.Data.Name);
}
Expand All @@ -60,7 +60,7 @@ await foreach (ConfigurationStore item in configurationStores)
***Get a configurationStore***

```C# Snippet:Managing_ConfigurationStores_GetAConfigurationStore
ConfigurationStore configurationStore = await resourceGroup.GetConfigurationStores().GetAsync("myApp");
ConfigurationStoreResource configurationStore = await resourceGroup.GetConfigurationStores().GetAsync("myApp");
Console.WriteLine(configurationStore.Data.Name);
```

Expand All @@ -69,15 +69,15 @@ Console.WriteLine(configurationStore.Data.Name);
```C# Snippet:Managing_ConfigurationStores_GetAConfigurationStoreIfExists
ConfigurationStoreCollection configurationStoreCollection = resourceGroup.GetConfigurationStores();

ConfigurationStore configurationStore = await configurationStoreCollection.GetIfExistsAsync("foo");
ConfigurationStoreResource configurationStore = await configurationStoreCollection.GetIfExistsAsync("foo");
if (configurationStore != null)
{
Console.WriteLine(configurationStore.Data.Name);
}

if (await configurationStoreCollection.ExistsAsync("myApp"))
{
Console.WriteLine("ConfigurationStore 'myApp' exists.");
Console.WriteLine("ConfigurationStoreResource 'myApp' exists.");
}
```

Expand All @@ -86,6 +86,6 @@ if (await configurationStoreCollection.ExistsAsync("myApp"))
```C# Snippet:Managing_ConfigurationStores_DeleteAConfigurationStore
ConfigurationStoreCollection configurationStoreCollection = resourceGroup.GetConfigurationStores();

ConfigurationStore configStore = await configurationStoreCollection.GetAsync("myApp");
ConfigurationStoreResource configStore = await configurationStoreCollection.GetAsync("myApp");
await configStore.DeleteAsync(WaitUntil.Completed);
```
Loading