Skip to content

Commit

Permalink
prepare keyvault for release (#24998)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-nash authored Oct 28, 2021
1 parent 5aa0221 commit 520cff3
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 30 deletions.
46 changes: 17 additions & 29 deletions sdk/keyvault/Azure.ResourceManager.KeyVault/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Release History

## 1.0.0-beta.3 (Unreleased)

### Features Added
## 1.0.0-beta.3 (2021-10-28)

### Breaking Changes

### Bugs Fixed

### Other Changes
- Renamed [Resource]Container to [Resource]Collection and added the IEnumerable<T> and IAsyncEnumerable<T> interfaces to them making it easier to iterate over the list in the simple case.

## 1.0.0-beta.2 (2021-09-14)

Expand Down Expand Up @@ -40,7 +36,7 @@ The package name has been changed from `Microsoft.Azure.Management.KeyVault` to
Example: Create a Key Vault Instance:

Before upgrade:
```csharp
```C#
using Microsoft.Azure.Management.KeyVault;
using Microsoft.Azure.Management.KeyVault.Models;
using Microsoft.Rest;
Expand All @@ -56,44 +52,36 @@ var vault = await keyVaultManagementClient.Vaults.BeginCreateOrUpdateAsync
```

After upgrade:
```csharp
```C# Snippet:Changelog_NewCode
using Azure.Identity;
using Azure.ResourceManager.KeyVault;
using Azure.ResourceManager.KeyVault.Models;

ArmClient client = new ArmClient(new DefaultAzureCredential());
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using System;
ArmClient armClient = new ArmClient(new DefaultAzureCredential());
Subscription subscription = await armClient.GetDefaultSubscriptionAsync();
ResourceGroup resourceGroup = await subscription.GetResourceGroups().GetAsync("myRgName");

VaultContainer vaultContainer = resourceGroup.GetVaults();
VaultCollection vaultCollection = resourceGroup.GetVaults();
VaultCreateOrUpdateParameters parameters = new VaultCreateOrUpdateParameters(Location.WestUS2, new VaultProperties(Guid.NewGuid(), new Sku(SkuFamily.A, SkuName.Standard)));

VaultCreateOrUpdateOperation lro = await vaultsOperations.CreateOrUpdateAsync(vaultName, parameters);
VaultCreateOrUpdateOperation lro = await vaultCollection.CreateOrUpdateAsync("myVaultName", parameters);
Vault vault = lro.Value;

```

#### Object Model Changes

Example: Create a Permissions Model

Before upgrade:
```csharp
var permissions = new Permissions
{
Keys = new string[] { "all" },
Secrets = new string[] { "all" },
Certificates = new string[] { "all" },
Storage = new string[] { "all" },
}
```C#
VaultProperties properties = new VaultProperties(Guid.NewGuid(), new Sku(SkuFamily.A, SkuName.Standard));
VaultCreateOrUpdateParameters parameters = new VaultCreateOrUpdateParameters(Location.WestUS2, properties);
```

After upgrade:
```csharp
var permissions = new Permissions
{
Keys = new [] { new KeyPermissions("all") },
Secrets = new [] { new SecretPermissions("all") },
Certificates = new [] { new CertificatePermissions("all") },
Storage = new [] { new StoragePermissions("all") },
};
```C# Snippet:Changelog_CreateModel
VaultProperties properties = new VaultProperties(Guid.NewGuid(), new Sku(SkuFamily.A, SkuName.Standard));
VaultCreateOrUpdateParameters parameters = new VaultCreateOrUpdateParameters(Location.WestUS2, properties);
```
2 changes: 1 addition & 1 deletion sdk/keyvault/Azure.ResourceManager.KeyVault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This package follows the [new Azure SDK guidelines](https://azure.github.io/azur
Install the Azure Key Vault management library for .NET with [NuGet](https://www.nuget.org/):

```dotnetcli
dotnet add package Azure.ResourceManager.KeyVault --version 1.0.0-beta.1
dotnet add package Azure.ResourceManager.KeyVault --version 1.0.0-beta.3
```

### Prerequisites
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#region Snippet:Changelog_NewCode
using Azure.Identity;
using Azure.ResourceManager.KeyVault;
using Azure.ResourceManager.KeyVault.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using System;
#if !SNIPPET
using System.Threading.Tasks;
using NUnit.Framework;

namespace Azure.ResourceManager.KeyVault.Tests.Samples
{
internal class Changelog
{
[Test]
[Ignore("Only verifying that the sample builds")]
public async Task NewCode()
{
#endif
ArmClient armClient = new ArmClient(new DefaultAzureCredential());
Subscription subscription = await armClient.GetDefaultSubscriptionAsync();
ResourceGroup resourceGroup = await subscription.GetResourceGroups().GetAsync("myRgName");

VaultCollection vaultCollection = resourceGroup.GetVaults();
VaultCreateOrUpdateParameters parameters = new VaultCreateOrUpdateParameters(Location.WestUS2, new VaultProperties(Guid.NewGuid(), new Sku(SkuFamily.A, SkuName.Standard)));

VaultCreateOrUpdateOperation lro = await vaultCollection.CreateOrUpdateAsync("myVaultName", parameters);
Vault vault = lro.Value;
#endregion
}

[Test]
[Ignore("Only verifying that the sample builds")]
public void CreateModel()
{
#region Snippet:Changelog_CreateModel
VaultProperties properties = new VaultProperties(Guid.NewGuid(), new Sku(SkuFamily.A, SkuName.Standard));
VaultCreateOrUpdateParameters parameters = new VaultCreateOrUpdateParameters(Location.WestUS2, properties);
#endregion
}
}
}

0 comments on commit 520cff3

Please sign in to comment.