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

armcompute 5.1.0-beta.1 release #20985

Merged
merged 4 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
2 changes: 1 addition & 1 deletion eng/scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Process-Sdk ()
if ($cleanGenerated)
{
Write-Host "##[command]Cleaning auto-generated files in" $currentDirectory
(Get-ChildItem "*.go" | Where-Object { $_.Name -notlike '*_test.go' } | Select-String -Pattern "Code generated by Microsoft" | Select-Object -ExpandProperty path) | Remove-Item -Force
(Get-ChildItem -recurse "*.go" | Where-Object { $_.Name -notlike '*_test.go' } | Select-String -Pattern "Code generated by Microsoft" | Select-Object -ExpandProperty path) | Remove-Item -Force
}

if ($generate)
Expand Down
6 changes: 6 additions & 0 deletions sdk/resourcemanager/compute/armcompute/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

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

### Features Added

- Support for test fakes and OpenTelemetry trace spans.

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

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

## 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
myFakeVirtualMachinesServer := fake.VirtualMachinesServer{}
```

Next, provide func implementations for the methods you wish to fake.
The named return variables can be used to simplify return value construction.

```go
myFakeVirtualMachinesServer.Get = func(ctx context.Context, resourceGroupName string, vmName string, options *armcompute.VirtualMachinesClientGetOptions) (resp azfake.Responder[armcompute.VirtualMachinesClientGetResponse], errResp azfake.ErrorResponder) {
// TODO: resp.SetResponse(/* your fake armcompute.VirtualMachinesClientGetResponse 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 := armcompute.VirtualMachinesClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{
ClientOptions: azcore.ClientOptions{
Transport: fake.NewVirtualMachinesServerTransport(&myFakeVirtualMachinesServer),
},
})
```

## More sample code

- [Availability Set](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/availabilityset)
Expand Down
8 changes: 6 additions & 2 deletions sdk/resourcemanager/compute/armcompute/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/5d2adf9b7fda669b4a2538c65e937ee74fe3f966/specification/compute/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/5d2adf9b7fda669b4a2538c65e937ee74fe3f966/specification/compute/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
module-version: 5.0.0
module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5
module-version: 5.1.0-beta.1
tag: package-2023-03-01
```
azcore-version: 1.7.0-beta.2
generate-fakes: true
inject-spans: true
```
76 changes: 57 additions & 19 deletions sdk/resourcemanager/compute/armcompute/availabilitysets_client.go

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

2 changes: 1 addition & 1 deletion sdk/resourcemanager/compute/armcompute/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 -alwaysSetBodyParamRequired resourcemanager/compute/armcompute
//go:generate pwsh ../../../../eng/scripts/build.ps1 -goExtension "@autorest/[email protected]" -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired resourcemanager/compute/armcompute

package armcompute
Loading