Skip to content

Commit a09fcfb

Browse files
[azeventgrid] Updates prior to release (Azure#21115)
* Updated to the latest autorest and using byval-slice. * Silly typo I noticed in the eventhubs readme
1 parent 97f4d08 commit a09fcfb

File tree

15 files changed

+340
-105
lines changed

15 files changed

+340
-105
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Release History
22

3-
## 0.1.0 (TBD)
3+
## 0.1.0 (2023-07-11)
44

5-
* Event Grid package for Event Grid Namespaces
5+
### Features Added
6+
7+
- Initial preview for the Event Grid package for Event Grid Namespaces

sdk/messaging/azeventgrid/README.md

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,65 @@
1-
# Azure Template Package client library for Go
1+
# Azure Event Grid Client Module for Go
22

3-
Azure Template Package client library for Go (`aztemplate`) matches necessary patterns that the development team has established to create a unified SDK written in the Go programming language. These libraries follow the Azure SDK Design Guidelines for Go.
3+
[Azure Event Grid](https://learn.microsoft.com/azure/event-grid/overview) is a highly scalable, fully managed Pub Sub message distribution service that offers flexible message consumption patterns. For more information about Event Grid see: [link](https://learn.microsoft.com/azure/event-grid/overview).
44

5-
The library allows client libraries to expose common functionality in a consistent fashion. Once you learn how to use these APIs in one client library, you will know how to use them in other client libraries.
5+
This client module allows you to publish events and receive events using the [Pull delivery](https://learn.microsoft.com/azure/event-grid/pull-delivery-overview) API.
6+
7+
Key links:
8+
- [Source code][source]
9+
- [API Reference Documentation][godoc]
10+
- [Product documentation](https://azure.microsoft.com/services/event-grid/)
11+
- [Samples][godoc_examples]
612

713
## Getting started
814

9-
For a rich example of a well formatted readme, please check [here.](https://github.com/Azure/azure-sdk/blob/main/docs/policies/README-TEMPLATE.md) In addition, this is an [example readme](https://github.com/Azure/azure-sdk/blob/main/docs/policies/README-EXAMPLE.md) that should be emulated. Note that the top-level sections in this template align with that of the [template.](https://github.com/Azure/azure-sdk/blob/main/docs/policies/README-TEMPLATE.md)
15+
### Install the package
16+
17+
Install the Azure Event Grid client module for Go with `go get`:
18+
19+
```bash
20+
go get github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid
21+
```
22+
23+
### Prerequisites
24+
25+
- Go, version 1.18 or higher
26+
- An [Azure subscription](https://azure.microsoft.com/free/)
27+
- An [Event Grid namespace](https://learn.microsoft.com/azure/event-grid/).
28+
- An Event Grid namespace. You can create an Event Grid Namespace using the [Azure Portal](https://learn.microsoft.com/azure/event-grid/create-view-manage-namespaces).
29+
30+
### Authenticate the client
31+
32+
Event Grid clients authenticate using a shared key credential. An example of that can be viewed here: [ExampleNewClientWithSharedKeyCredential][godoc_example_newclient].
1033

1134
# Key concepts
1235

13-
Bullet point list of your library's main concepts.
36+
An Azure Event Grid [**namespace**](https://learn.microsoft.com/azure/event-grid/mqtt-event-grid-namespace-terminology#namespace) can contain multiple **namespace topics**. Publishers publish events to namespace topics. More on creating namespace topics can be found here: [link](https://learn.microsoft.com/azure/event-grid/create-view-manage-namespace-topics).
37+
38+
To receive events, you must create an **event subscription**, which is associated with a topic. More on creating topic subscriptions can be found here: [link](https://learn.microsoft.com/azure/event-grid/create-view-manage-event-subscriptions).
1439

1540
# Examples
1641

17-
Examples of some of the key concepts for your library.
42+
Examples for various scenarios can be found on [pkg.go.dev](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid#pkg-examples) or in the example*_test.go files in our GitHub repo for [azeventgrid](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventgrid).
1843

1944
# Troubleshooting
2045

21-
Running into issues? This section should contain details as to what to do there.
46+
### Logging
47+
48+
This module uses the classification-based logging implementation in `azcore`. To enable console logging for all SDK modules, set the environment variable `AZURE_SDK_GO_LOGGING` to `all`.
49+
50+
Use the `azcore/log` package to control log event output.
51+
52+
```go
53+
import (
54+
"fmt"
55+
azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"
56+
)
57+
58+
// print log output to stdout
59+
azlog.SetListener(func(event azlog.Event, s string) {
60+
fmt.Printf("[%s] %s\n", event, s)
61+
})
62+
```
2263

2364
# Next steps
2465

@@ -67,3 +108,7 @@ Azure SDK for Go is licensed under the [MIT](https://github.com/Azure/azure-sdk-
67108
[azure_sub]: https://azure.microsoft.com/free/
68109
[cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview
69110
[cloud_shell_bash]: https://shell.azure.com/bash
111+
[source]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/messaging/azeventgrid
112+
[godoc]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid
113+
[godoc_examples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid#pkg-examples
114+
[godoc_example_newclient]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid#example-NewClientWithSharedKeyCredential

sdk/messaging/azeventgrid/autorest.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ clear-output-folder: false
88
go: true
99
input-file:
1010
# This was the commit that everyone used to generate their first official betas.
11-
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/947c9ce9b20900c6cbc8e95bc083e723d09a9c2c/specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json
11+
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c07d9898ed901330e5ac4996b1bc641adac2e6fd/specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json
12+
# - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/947c9ce9b20900c6cbc8e95bc083e723d09a9c2c/specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json
1213
license-header: MICROSOFT_MIT_NO_VERSION
1314
module: github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid
1415
openapi-type: "data-plane"
1516
output-folder: ../azeventgrid
1617
override-client-name: Client
1718
security: "AADToken"
18-
use: "@autorest/go@4.0.0-preview.49"
19+
use: "@autorest/go@4.0.0-preview.52"
1920
version: "^3.0.0"
21+
slice-elements-byval: true
22+
remove-non-reference-schema: true
2023
directive:
2124
# we have to write a little wrapper code for this so we'll hide the public function
2225
# for now.
@@ -54,15 +57,19 @@ directive:
5457
- client.go
5558
- models.go
5659
- response_types.go
60+
- options.go
5761
where: $
5862
transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2");
5963
# replace references to the "generated" CloudEvent to the actual version in azcore/messaging
6064
- from:
6165
- client.go
6266
- models.go
6367
- response_types.go
68+
- options.go
6469
where: $
65-
transform: return $.replace(/\*CloudEvent/g, "messaging.CloudEvent");
70+
transform: |
71+
return $.replace(/\[\]CloudEvent/g, "[]messaging.CloudEvent")
72+
.replace(/\*CloudEvent/g, "messaging.CloudEvent");
6673
6774
# remove the 'Interface any' that's generated for an empty response object.
6875
- from:

sdk/messaging/azeventgrid/client.go

Lines changed: 34 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)