-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* armmonitor 0.10.0 release * bump release date
- Loading branch information
1 parent
007d0de
commit e75e708
Showing
81 changed files
with
8,593 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,31 @@ A client groups a set of related APIs, providing access to its functionality. C | |
client := clientFactory.NewAlertRuleIncidentsClient() | ||
``` | ||
|
||
## 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 | ||
myFakeMetricsServer := fake.MetricsServer{} | ||
``` | ||
Next, provide func implementations for the methods you wish to fake. | ||
The named return variables can be used to simplify return value construction. | ||
```go | ||
myFakeMetricsServer.List = func(ctx context.Context, resourceURI string, options *armmonitor.MetricsClientListOptions) (resp azfake.Responder[armmonitor.MetricsClientListResponse], errResp azfake.ErrorResponder) { | ||
// TODO: resp.SetResponse(/* your fake armmonitor.MetricsClientListResponse 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 := armmonitor.NewClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{ | ||
ClientOptions: azcore.ClientOptions{ | ||
Transport: fake.NewMetricsServerTransport(&myFakeMetricsServer), | ||
}, | ||
}) | ||
``` | ||
|
||
## More sample code | ||
|
||
- [Action Group](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/monitor/action_group) | ||
|
@@ -88,4 +113,4 @@ This project has adopted the | |
For more information, see the | ||
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) | ||
or contact [[email protected]](mailto:[email protected]) with any | ||
additional questions or comments. | ||
additional questions or comments. |
128 changes: 95 additions & 33 deletions
128
sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go
Large diffs are not rendered by default.
Oops, something went wrong.
74 changes: 55 additions & 19 deletions
74
sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 3 additions & 2 deletions
5
sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 14 additions & 6 deletions
20
sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.