Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gracewilcox committed Nov 7, 2024
1 parent ac5e820 commit 05dc35c
Show file tree
Hide file tree
Showing 16 changed files with 1,014 additions and 92 deletions.
176 changes: 176 additions & 0 deletions sdk/security/keyvault/azsecrets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Release History

## 1.3.1 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 1.3.0 (2024-11-06)

### Features Added
* Added API Version support. Users can now change the default API Version by setting ClientOptions.APIVersion

## 1.2.0 (2024-10-21)

### Features Added
* Added CAE support
* Client requests tokens from the Vault's tenant, overriding any credential default
(thanks @francescomari)

## 1.1.0 (2024-02-13)

### Other Changes
* Upgraded to API service version `7.5`
* Upgraded dependencies

## 1.1.0-beta.1 (2023-11-08)

### Other Changes
* Upgraded service version to `7.5-preview.1`
* Updated to latest version of `azcore`.
* Enabled spans for distributed tracing.

## 1.0.1 (2023-08-22)

### Other Changes
* Upgraded dependencies

## 1.0.0 (2023-07-17)

### Features Added
* first stable release of `azsecrets` module

### Breaking Changes
* changed type of `KID` from string to type `ID`

## 0.14.0 (2023-06-08)

### Breaking Changes
* Renamed `Client.ListSecrets` to `Client.ListSecretProperties`
* Renamed `Client.ListSecretVersions` to `Client.ListSecretPropertiesVersions`
* Renamed `SecretBundle` to `Secret`
* Renamed `DeletedSecretBundle` to `DeletedSecret`
* Renamed `SecretItem` to `SecretProperties`
* Renamed `DeletedSecretItem` to `DeletedSecretProperties`
* Renamed `Kid` to `KID`
* Removed `DeletionRecoveryLevel` type
* Remove `MaxResults` option

### Other Changes
* Updated dependencies

## 0.13.0 (2023-04-13)

### Breaking Changes
* Moved from `sdk/keyvault/azsecrets` to `sdk/security/keyvault/azsecrets`

## 0.12.0 (2023-04-13)

### Features Added
* upgraded to api version 7.4

## 0.11.0 (2022-11-08)

### Breaking Changes
* `NewClient` returns an `error`

## 0.10.1 (2022-09-20)

### Features Added
* Added `ClientOptions.DisableChallengeResourceVerification`.
See https://aka.ms/azsdk/blog/vault-uri for more information.

## 0.10.0 (2022-09-12)

### Breaking Changes
* Verify the challenge resource matches the vault domain.

## 0.9.0 (2022-08-09)

### Breaking Changes
* Changed type of `NewClient` options parameter to `azsecrets.ClientOptions`, which embeds
the former type, `azcore.ClientOptions`

## 0.8.0 (2022-07-07)

### Breaking Changes
* The `Client` API now corresponds more directly to the Key Vault REST API.
Most method signatures and types have changed. See the
[module documentation](https://aka.ms/azsdk/go/keyvault-secrets/docs)
for updated code examples and more details.

### Other Changes
* Upgrade to latest `azcore`

## 0.7.1 (2022-05-12)

### Other Changes
* Updated to latest `azcore` and `internal` modules.

## 0.7.0 (2022-04-06)

### Features Added
* Added `PossibleDeletionRecoveryLevelValues` to iterate over all valid `DeletionRecoveryLevel` values
* Implemented generic pagers from `runtime.Pager` for all List operations
* Added `Name *string` to `DeletedSecret`, `Properties`, `Secret`, `SecretItem`, and `SecretItem`
* Added `Client.VaultURL` to determine the vault URL for debugging
* Adding `ResumeToken` method to pollers for resuming polling at a later date by using the added `ResumeToken` optional parameter on client polling methods

### Breaking Changes
* Requires a minimum version of go 1.18
* Removed `RawResponse` from pollers
* Removed `DeletionRecoveryLevel`
* Polling operations return a Poller struct directly instead of a Response envelope
* Removed `ToPtr` methods
* `Client.UpdateSecretProperties` takes a `Secret`
* Renamed `Client.ListSecrets` to `Client.ListPropertiesOfSecrets`
* Renamed `Client.ListSecretVersions` to `Client.ListPropertiesOfSecretVersions`
* Renamed `DeletedDate` to `DeletedOn` and `Managed` to `IsManaged`
* Moved `ContentType`, `Tags`, `KeyID`, and `IsManaged` to `Properties`

## 0.6.0 (2022-03-08)

### Breaking Changes
* Changes `Attributes` to `Properties`
* Changes `Secret.KID` to `Secret.KeyID`
* Changes `DeletedSecretBundle` to `DeletedSecret`
* Changes `DeletedDate` to `DeletedOn`, `Created` to `CreatedOn`, and `Updated` to `UpdatedOn`
* Changes the signature of `Client.UpdateSecretProperties` to have all alterable properties in the `UpdateSecretPropertiesOptions` parameter, removing the `parameters Properties` parameter.
* Changes `Item` to `SecretItem`
* Pollers and pagers are structs instead of interfaces
* Prefixed all `DeletionRecoveryLevel` constants with "DeletionRecoveryLevel"
* Changed pager APIs for `ListSecretVersionsPager`, `ListDeletedSecretsPager`, and `ListSecretsPager`
* Use the `More()` method to determine if there are more pages to fetch
* Use the `NextPage(context.Context)` to fetch the next page of results
* Removed all `RawResponse *http.Response` fields from response structs.

## 0.5.0 (2022-02-08)

### Breaking Changes
* Fixes a bug where `UpdateSecretProperties` will delete properties that are not explicitly set each time. This is only a breaking change at runtime, where the request body will change.

## 0.4.0 (2022-01-11)

### Other Changes
* Bumps `azcore` dependency from `v0.20.0` to `v0.21.0`

## 0.3.0 (2021-11-09)

### Features Added
* Clients can now connect to Key Vaults in any cloud

## 0.2.0 (2021-11-02)

### Other Changes
* Bumps `azcore` dependency to `v0.20.0` and `azidentity` to `v0.12.0`

## 0.1.1 (2021-10-06)
* Adds the MIT License for redistribution

## 0.1.0 (2021-10-05)
* This is the initial release of the `azsecrets` library
21 changes: 21 additions & 0 deletions sdk/security/keyvault/azsecrets/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
92 changes: 92 additions & 0 deletions sdk/security/keyvault/azsecrets/MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Guide to migrate from `keyvault` to `azsecrets`

This guide is intended to assist in the migration to the `azsecrets` module from the deprecated `keyvault` module. `azsecrets` allows users to create and manage [secrets] with Azure Key Vault.

## General changes

In the past, Azure Key Vault operations were all contained in a single package. For Go, this was `github.com/Azure/azure-sdk-for-go/services/keyvault/<version>/keyvault`.

The new SDK divides the Key Vault API into separate modules for keys, secrets, and certificates. This guide focuses on migrating secret operations to use the new `azsecrets` module.

There are other changes besides the module name. For example, some type and method names are different, and all new modules authenticate using our [azidentity] module.

## Code examples

The following code example shows the difference between the old and new modules when creating a secret. The biggest differences are the client and authentication. In the `keyvault` module, users created a `keyvault.BaseClient` then added an `Authorizer` to the client to authenticate. In the `azsecrets` module, users create a credential using the [azidentity] module then use that credential to construct the client.

Another difference is that the Key Vault URL is now passed to the client once during construction, not every time a method is called.

### `keyvault` create secret

```go
import (
"context"
"fmt"

"github.com/Azure/azure-sdk-for-go/profiles/latest/keyvault/keyvault"
kvauth "github.com/Azure/azure-sdk-for-go/services/keyvault/auth"
)

func main() {
vaultURL := "https://<TODO: your vault name>.vault.azure.net"
secretName := "mySecret"
secretValue := "mySecretValue"

authorizer, err := kvauth.NewAuthorizerFromEnvironment()
if err != nil {
// TODO: handle error
}

basicClient := keyvault.New()
basicClient.Authorizer = authorizer

fmt.Println("\ncreating secret in keyvault:")
var secParams keyvault.SecretSetParameters
secParams.Value = &secretValue
newBundle, err := basicClient.SetSecret(context.Background(), vaultURL, secretName, secParams)
if err != nil {
// TODO: handle error
}
fmt.Println("added/updated: " + *newBundle.ID)
}
```

### `azsecrets` create secret

```go
package main

import (
"context"
"fmt"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets"
)

func main() {
vaultURL := "https://<TODO: your vault name>.vault.azure.net"
secretName := "mySecret"
secretValue := "mySecretValue"

cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
// TODO: handle error
}

client, err := azsecrets.NewClient(vaultURL, cred, nil)
if err != nil {
// TODO: handle error
}

resp, err := client.SetSecret(context.TODO(), secretName, azsecrets.SetSecretParameters{Value: &secretValue}, nil)
if err != nil {
// TODO: handle error
}

fmt.Printf("Set secret %s", resp.ID.Name())
}
```

[azidentity]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity
[secrets]: https://learn.microsoft.com/azure/key-vault/secrets/about-secrets
Loading

0 comments on commit 05dc35c

Please sign in to comment.