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

armnetwork 3.1.0-beta.1 release #20987

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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