Skip to content

Commit

Permalink
[azeventgrid] Basic client, basic CloudEvent support (#20940)
Browse files Browse the repository at this point in the history
First generation of the Event Grid client, _very_ beta. It has all the basic functionality but needs some more work around CloudEvent and adding in documentation, etc...
  • Loading branch information
richardpark-msft authored Jun 9, 2023
1 parent 3bfbbb2 commit b15d169
Show file tree
Hide file tree
Showing 21 changed files with 2,144 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdk/messaging/azeventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 0.1.0 (TBD)

* Event Grid package for Event Grid Namespaces
21 changes: 21 additions & 0 deletions sdk/messaging/azeventgrid/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions sdk/messaging/azeventgrid/NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
aztemplate

NOTICES AND INFORMATION
Do Not Translate or Localize

This software incorporates material from third parties. Microsoft makes certain
open source code available at https://3rdpartysource.microsoft.com, or you may
send a check or money order for US $5.00, including the product name, the open
source component name, and version number, to:

Source Code Compliance Team
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA

Notwithstanding any other terms, you may reverse engineer this software to the
extent required to debug changes to any libraries licensed under the GNU Lesser
General Public License.

------------------------------------------------------------------------------

Azure SDK for Go uses third-party libraries or other resources that may be
distributed under licenses different than the Azure SDK for Go software.

In the event that we accidentally failed to list a required notice, please
bring it to our attention. Post an issue or email us:

@microsoft.com

The attached notices are provided for information only.

69 changes: 69 additions & 0 deletions sdk/messaging/azeventgrid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Azure Template Package client library 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.

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.

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

# Key concepts

Bullet point list of your library's main concepts.

# Examples

Examples of some of the key concepts for your library.

# Troubleshooting

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

# Next steps

More sample code should go here, along with links out to the appropriate example tests.

## Contributing
For details on contributing to this repository, see the [contributing guide][azure_sdk_for_go_contributing].

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

### Additional Helpful Links for Contributors
Many people all over the world have helped make this project better. You'll want to check out:

* [What are some good first issues for new contributors to the repo?](https://github.com/azure/azure-sdk-for-go/issues?q=is%3Aopen+is%3Aissue+label%3A%22up+for+grabs%22)
* [How to build and test your change][azure_sdk_for_go_contributing_developer_guide]
* [How you can make a change happen!][azure_sdk_for_go_contributing_pull_requests]
* Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed [Azure SDK for Go wiki](https://github.com/azure/azure-sdk-for-go/wiki).

<!-- ### Community-->
### Reporting security issues and security bugs

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <secure@microsoft.com>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue).

### License

Azure SDK for Go is licensed under the [MIT](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/template/aztemplate/LICENSE.txt) license.

<!-- LINKS -->
[azure_sdk_for_go_contributing]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md
[azure_sdk_for_go_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#developer-guide
[azure_sdk_for_go_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#pull-requests
[azure_cli]: https://docs.microsoft.com/cli/azure
[azure_pattern_circuit_breaker]: https://docs.microsoft.com/azure/architecture/patterns/circuit-breaker
[azure_pattern_retry]: https://docs.microsoft.com/azure/architecture/patterns/retry
[azure_portal]: https://portal.azure.com
[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
6 changes: 6 additions & 0 deletions sdk/messaging/azeventgrid/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "go",
"TagPrefix": "go/messaging/azeventgrid",
"Tag": "go/messaging/azeventgrid_601fd733f2"
}
64 changes: 64 additions & 0 deletions sdk/messaging/azeventgrid/autorest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## Go

``` yaml
title: EventGridClient
description: Azure Event Grid client
generated-metadata: false
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
# when we start using the .tsp file directly we can start referring to the compiled output.
# ./tsp-output\@azure-tools\typespec-autorest\2023-06-01-preview\openapi.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/go@4.0.0-preview.49"
version: "^3.0.0"
directive:
# we have to write a little wrapper code for this so we'll hide the public function
# for now.
- from: client.go
where: $
transform: return $.replace(/PublishCloudEvents\(/g, "internalPublishCloudEvents(");
# make sure the casing of the properties is what compliant.
# - from: swagger-document
# where: $.definitions.CloudEvent.properties.data
# transform: >
# $["type"] = "array"
# - from: swagger-document
# where: $.definitions.CloudEvent.properties.data
# transform: >
# $["items"] = {"type": "byte"}
- from: swagger-document
where: $.definitions.CloudEvent.properties.specversion
transform: $["x-ms-client-name"] = "SpecVersion"
- from: swagger-document
where: $.definitions.CloudEvent.properties.datacontenttype
transform: $["x-ms-client-name"] = "DataContentType"
- from: swagger-document
where: $.definitions.CloudEvent.properties.dataschema
transform: $["x-ms-client-name"] = "DataSchema"
# make the endpoint a parameter of the client constructor
- from: swagger-document
where: $["x-ms-parameterized-host"]
transform: $.parameters[0]["x-ms-parameter-location"] = "client"
# delete client name prefix from method options and response types
- from:
- client.go
- models.go
- response_types.go
where: $
transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2");
- from:
- client.go
- models.go
- models_serde.go
- response_types.go
where: $
transform: return $.replace(/AzureCoreFoundations/g, "");
```
9 changes: 9 additions & 0 deletions sdk/messaging/azeventgrid/build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//go:build go1.18
// +build go1.18

//go:generate autorest ./autorest.md
//go:generate gofmt -w .

package azeventgrid
29 changes: 29 additions & 0 deletions sdk/messaging/azeventgrid/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/messaging/azeventgrid
- eng/

pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/messaging/azeventgrid


stages:
- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
parameters:
ServiceDirectory: 'messaging/azeventgrid'
Loading

0 comments on commit b15d169

Please sign in to comment.