Skip to content

[azeventgrid] Updates prior to release #21115

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

Merged
merged 8 commits into from
Jul 7, 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: 4 additions & 2 deletions sdk/messaging/azeventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Release History

## 0.1.0 (TBD)
## 0.1.0 (2023-07-11)

* Event Grid package for Event Grid Namespaces
### Features Added

- Initial preview for the Event Grid package for Event Grid Namespaces
59 changes: 52 additions & 7 deletions sdk/messaging/azeventgrid/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,65 @@
# Azure Template Package client library for Go
# Azure Event Grid Client Module for Go

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.
[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).

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.
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.

Key links:
- [Source code][source]
- [API Reference Documentation][godoc]
- [Product documentation](https://azure.microsoft.com/services/event-grid/)
- [Samples][godoc_examples]

## Getting started

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)
### Install the package

Install the Azure Event Grid client module for Go with `go get`:

```bash
go get github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid
```

### Prerequisites

- Go, version 1.18 or higher
- An [Azure subscription](https://azure.microsoft.com/free/)
- An [Event Grid namespace](https://learn.microsoft.com/azure/event-grid/).
- 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).

### Authenticate the client

Event Grid clients authenticate using a shared key credential. An example of that can be viewed here: [ExampleNewClientWithSharedKeyCredential][godoc_example_newclient].

# Key concepts

Bullet point list of your library's main concepts.
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).

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).

# Examples

Examples of some of the key concepts for your library.
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).

# Troubleshooting

Running into issues? This section should contain details as to what to do there.
### Logging

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`.

Use the `azcore/log` package to control log event output.

```go
import (
"fmt"
azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"
)

// print log output to stdout
azlog.SetListener(func(event azlog.Event, s string) {
fmt.Printf("[%s] %s\n", event, s)
})
```

# Next steps

Expand Down Expand Up @@ -67,3 +108,7 @@ Azure SDK for Go is licensed under the [MIT](https://github.com/Azure/azure-sdk-
[azure_sub]: https://azure.microsoft.com/free/
[cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview
[cloud_shell_bash]: https://shell.azure.com/bash
[source]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/messaging/azeventgrid
[godoc]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid
[godoc_examples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid#pkg-examples
[godoc_example_newclient]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid#example-NewClientWithSharedKeyCredential
13 changes: 10 additions & 3 deletions sdk/messaging/azeventgrid/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ clear-output-folder: false
go: true
input-file:
# This was the commit that everyone used to generate their first official betas.
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/947c9ce9b20900c6cbc8e95bc083e723d09a9c2c/specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c07d9898ed901330e5ac4996b1bc641adac2e6fd/specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json
# - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/947c9ce9b20900c6cbc8e95bc083e723d09a9c2c/specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json
license-header: MICROSOFT_MIT_NO_VERSION
module: github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid
openapi-type: "data-plane"
output-folder: ../azeventgrid
override-client-name: Client
security: "AADToken"
use: "@autorest/[email protected].49"
use: "@autorest/[email protected].52"
version: "^3.0.0"
slice-elements-byval: true
remove-non-reference-schema: true
directive:
# we have to write a little wrapper code for this so we'll hide the public function
# for now.
Expand Down Expand Up @@ -54,15 +57,19 @@ directive:
- client.go
- models.go
- response_types.go
- options.go
where: $
transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2");
# replace references to the "generated" CloudEvent to the actual version in azcore/messaging
- from:
- client.go
- models.go
- response_types.go
- options.go
where: $
transform: return $.replace(/\*CloudEvent/g, "messaging.CloudEvent");
transform: |
return $.replace(/\[\]CloudEvent/g, "[]messaging.CloudEvent")
.replace(/\*CloudEvent/g, "messaging.CloudEvent");

# remove the 'Interface any' that's generated for an empty response object.
- from:
Expand Down
55 changes: 34 additions & 21 deletions sdk/messaging/azeventgrid/client.go

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

Loading