Skip to content

Commit

Permalink
armnetwork 3.1.0-beta.1 release (#20987)
Browse files Browse the repository at this point in the history
* armnetwork 3.1.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 54863e9 commit cb6d9bd
Show file tree
Hide file tree
Showing 283 changed files with 44,540 additions and 2,532 deletions.
6 changes: 6 additions & 0 deletions sdk/resourcemanager/network/armnetwork/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

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

### Features Added

- Support for test fakes and OpenTelemetry trace spans.

## 3.0.0 (2023-05-26)
### Breaking Changes

Expand Down
25 changes: 25 additions & 0 deletions sdk/resourcemanager/network/armnetwork/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.NewVirtualHubBgpConnectionsClient()
```

## 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
myFakeInterfacesServer := fake.InterfacesServer{}
```
Next, provide func implementations for the methods you wish to fake.
The named return variables can be used to simplify return value construction.
```go
myFakeInterfacesServer.Get = func(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientGetOptions) (resp azfake.Responder[armnetwork.InterfacesClientGetResponse], errResp azfake.ErrorResponder) {
// TODO: resp.SetResponse(/* your fake InterfacesClientGetResponse 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 := armnetwork.NewInterfacesClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{
ClientOptions: azcore.ClientOptions{
Transport: fake.NewInterfacesServerTransport(&myFakeInterfacesServer),
},
})
```

## More sample code

- [IP Address](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/network/ipaddress)
Expand Down

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

57 changes: 41 additions & 16 deletions sdk/resourcemanager/network/armnetwork/adminrules_client.go

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

Loading

0 comments on commit cb6d9bd

Please sign in to comment.