Skip to content

Commit

Permalink
armresources 1.2.0-beta.1 release (#20988)
Browse files Browse the repository at this point in the history
* armresources 1.2.0-beta.1 release

* update to latest code generator

added testable fake example
bump release date
  • Loading branch information
jhendrixMSFT authored Jun 12, 2023
1 parent cb6d9bd commit b3194dd
Show file tree
Hide file tree
Showing 31 changed files with 6,277 additions and 452 deletions.
6 changes: 6 additions & 0 deletions sdk/resourcemanager/resources/armresources/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 1.2.0-beta.1 (2023-06-12)

### Features Added

- Support for test fakes and OpenTelemetry trace spans.

## 1.1.1 (2023-04-14)
### Bug Fixes

Expand Down
25 changes: 25 additions & 0 deletions sdk/resourcemanager/resources/armresources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,31 @@ A client groups a set of related APIs, providing access to its functionality. C
client := clientFactory.NewClient()
```

## Fakes
The `fake` package provides implementations for fake servers that can be used for testing.
To create a fake server, declare an instance of the required fake server type(s).
```go
myFakeServer := fake.Server{}
```
Next, provide func implementations for the methods you wish to fake.
The named return variables can be used to simplify return value construction.
```go
myFakeServer.CheckExistence = func(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *armresources.ClientCheckExistenceOptions) (resp azfake.Responder[armresources.ClientCheckExistenceResponse], errResp azfake.ErrorResponder) {
// TODO: resp.SetResponse(/* your fake ClientCheckExistenceResponse response */)
return
}
```
You connect the fake server to a client instance during construction through the optional transport.
Use `NewTokenCredential()` from `azcore/fake` to obtain a fake credential.
```go
import azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
client, err := armresources.NewClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{
ClientOptions: azcore.ClientOptions{
Transport: fake.NewServerTransport(&myFakeServer),
},
})
```

## More sample code

- [Deployment](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/deployment)
Expand Down
8 changes: 6 additions & 2 deletions sdk/resourcemanager/resources/armresources/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ require:
- https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
module-version: 1.1.1
module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources
module-version: 1.2.0-beta.1
package-resources: true
```
azcore-version: 1.7.0-beta.2
generate-fakes: true
inject-spans: true
```
2 changes: 1 addition & 1 deletion sdk/resourcemanager/resources/armresources/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

// This file enables 'go generate' to regenerate this specific SDK
//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/resources/armresources
//go:generate pwsh ../../../../eng/scripts/build.ps1 -goExtension "@autorest/[email protected]" -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/resources/armresources

package armresources
231 changes: 167 additions & 64 deletions sdk/resourcemanager/resources/armresources/client.go

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions sdk/resourcemanager/resources/armresources/client_factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 48 additions & 49 deletions sdk/resourcemanager/resources/armresources/constants.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b3194dd

Please sign in to comment.