Skip to content

Commit

Permalink
armcontainerregistry 1.1.0-beta.2 release (#20986)
Browse files Browse the repository at this point in the history
* armcontainerregistry 1.1.0-beta.2 release

* add module setting to config file

* update to latest code generator

add testable fake example
bump release date
  • Loading branch information
jhendrixMSFT authored Jun 12, 2023
1 parent c4ae431 commit 54863e9
Show file tree
Hide file tree
Showing 51 changed files with 7,940 additions and 1,225 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 1.1.0-beta.2 (2023-06-12)

### Features Added

- Support for test fakes and OpenTelemetry trace spans.

## 1.1.0-beta.1 (2023-03-27)
### Features Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,39 @@ A client groups a set of related APIs, providing access to its functionality. C
client := clientFactory.NewImportPipelinesClient()
```

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

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

```go
myFakeAgentPoolsServer.Get = func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *armcontainerregistry.AgentPoolsClientGetOptions) (resp azfake.Responder[armcontainerregistry.AgentPoolsClientGetResponse], errResp azfake.ErrorResponder) {
// TODO: resp.SetResponse(/* your fake AgentPoolsClientGetResponse 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 := armcontainerregistry.NewAgentPoolsClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{
ClientOptions: azcore.ClientOptions{
Transport: fake.NewAgentPoolsServerTransport(&myFakeAgentPoolsServer),
},
})
```

## More sample code

- [Container Registry](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/registry)
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ require:
- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
module-version: 1.1.0-beta.1

```
module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry
module-version: 1.1.0-beta.2
azcore-version: 1.7.0-beta.2
generate-fakes: true
inject-spans: true
```
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/containerregistry/armcontainerregistry
//go:generate pwsh ../../../../eng/scripts/build.ps1 -goExtension "@autorest/[email protected]" -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/containerregistry/armcontainerregistry

package armcontainerregistry
Loading

0 comments on commit 54863e9

Please sign in to comment.