Skip to content

Commit b15d169

Browse files
[azeventgrid] Basic client, basic CloudEvent support (#20940)
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...
1 parent 3bfbbb2 commit b15d169

21 files changed

+2144
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 0.1.0 (TBD)
4+
5+
* Event Grid package for Event Grid Namespaces

sdk/messaging/azeventgrid/LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Microsoft Corporation.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

sdk/messaging/azeventgrid/NOTICE.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
aztemplate
2+
3+
NOTICES AND INFORMATION
4+
Do Not Translate or Localize
5+
6+
This software incorporates material from third parties. Microsoft makes certain
7+
open source code available at https://3rdpartysource.microsoft.com, or you may
8+
send a check or money order for US $5.00, including the product name, the open
9+
source component name, and version number, to:
10+
11+
Source Code Compliance Team
12+
Microsoft Corporation
13+
One Microsoft Way
14+
Redmond, WA 98052
15+
USA
16+
17+
Notwithstanding any other terms, you may reverse engineer this software to the
18+
extent required to debug changes to any libraries licensed under the GNU Lesser
19+
General Public License.
20+
21+
------------------------------------------------------------------------------
22+
23+
Azure SDK for Go uses third-party libraries or other resources that may be
24+
distributed under licenses different than the Azure SDK for Go software.
25+
26+
In the event that we accidentally failed to list a required notice, please
27+
bring it to our attention. Post an issue or email us:
28+
29+
@microsoft.com
30+
31+
The attached notices are provided for information only.
32+

sdk/messaging/azeventgrid/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Azure Template Package client library for Go
2+
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.
4+
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.
6+
7+
## Getting started
8+
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)
10+
11+
# Key concepts
12+
13+
Bullet point list of your library's main concepts.
14+
15+
# Examples
16+
17+
Examples of some of the key concepts for your library.
18+
19+
# Troubleshooting
20+
21+
Running into issues? This section should contain details as to what to do there.
22+
23+
# Next steps
24+
25+
More sample code should go here, along with links out to the appropriate example tests.
26+
27+
## Contributing
28+
For details on contributing to this repository, see the [contributing guide][azure_sdk_for_go_contributing].
29+
30+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
31+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
32+
the rights to use your contribution. For details, visit https://cla.microsoft.com.
33+
34+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
35+
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
36+
provided by the bot. You will only need to do this once across all repos using our CLA.
37+
38+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
39+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
40+
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
41+
42+
### Additional Helpful Links for Contributors
43+
Many people all over the world have helped make this project better. You'll want to check out:
44+
45+
* [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)
46+
* [How to build and test your change][azure_sdk_for_go_contributing_developer_guide]
47+
* [How you can make a change happen!][azure_sdk_for_go_contributing_pull_requests]
48+
* Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed [Azure SDK for Go wiki](https://github.com/azure/azure-sdk-for-go/wiki).
49+
50+
<!-- ### Community-->
51+
### Reporting security issues and security bugs
52+
53+
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <[email protected]>. 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).
54+
55+
### License
56+
57+
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.
58+
59+
<!-- LINKS -->
60+
[azure_sdk_for_go_contributing]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md
61+
[azure_sdk_for_go_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#developer-guide
62+
[azure_sdk_for_go_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#pull-requests
63+
[azure_cli]: https://docs.microsoft.com/cli/azure
64+
[azure_pattern_circuit_breaker]: https://docs.microsoft.com/azure/architecture/patterns/circuit-breaker
65+
[azure_pattern_retry]: https://docs.microsoft.com/azure/architecture/patterns/retry
66+
[azure_portal]: https://portal.azure.com
67+
[azure_sub]: https://azure.microsoft.com/free/
68+
[cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview
69+
[cloud_shell_bash]: https://shell.azure.com/bash

sdk/messaging/azeventgrid/assets.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"AssetsRepo": "Azure/azure-sdk-assets",
3+
"AssetsRepoPrefixPath": "go",
4+
"TagPrefix": "go/messaging/azeventgrid",
5+
"Tag": "go/messaging/azeventgrid_601fd733f2"
6+
}

sdk/messaging/azeventgrid/autorest.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Go
2+
3+
``` yaml
4+
title: EventGridClient
5+
description: Azure Event Grid client
6+
generated-metadata: false
7+
clear-output-folder: false
8+
go: true
9+
input-file:
10+
# 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
12+
# when we start using the .tsp file directly we can start referring to the compiled output.
13+
# ./tsp-output\@azure-tools\typespec-autorest\2023-06-01-preview\openapi.json
14+
license-header: MICROSOFT_MIT_NO_VERSION
15+
module: github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventgrid
16+
openapi-type: "data-plane"
17+
output-folder: ../azeventgrid
18+
override-client-name: Client
19+
security: "AADToken"
20+
use: "@autorest/[email protected]"
21+
version: "^3.0.0"
22+
directive:
23+
# we have to write a little wrapper code for this so we'll hide the public function
24+
# for now.
25+
- from: client.go
26+
where: $
27+
transform: return $.replace(/PublishCloudEvents\(/g, "internalPublishCloudEvents(");
28+
# make sure the casing of the properties is what compliant.
29+
# - from: swagger-document
30+
# where: $.definitions.CloudEvent.properties.data
31+
# transform: >
32+
# $["type"] = "array"
33+
# - from: swagger-document
34+
# where: $.definitions.CloudEvent.properties.data
35+
# transform: >
36+
# $["items"] = {"type": "byte"}
37+
- from: swagger-document
38+
where: $.definitions.CloudEvent.properties.specversion
39+
transform: $["x-ms-client-name"] = "SpecVersion"
40+
- from: swagger-document
41+
where: $.definitions.CloudEvent.properties.datacontenttype
42+
transform: $["x-ms-client-name"] = "DataContentType"
43+
- from: swagger-document
44+
where: $.definitions.CloudEvent.properties.dataschema
45+
transform: $["x-ms-client-name"] = "DataSchema"
46+
# make the endpoint a parameter of the client constructor
47+
- from: swagger-document
48+
where: $["x-ms-parameterized-host"]
49+
transform: $.parameters[0]["x-ms-parameter-location"] = "client"
50+
# delete client name prefix from method options and response types
51+
- from:
52+
- client.go
53+
- models.go
54+
- response_types.go
55+
where: $
56+
transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2");
57+
- from:
58+
- client.go
59+
- models.go
60+
- models_serde.go
61+
- response_types.go
62+
where: $
63+
transform: return $.replace(/AzureCoreFoundations/g, "");
64+
```

sdk/messaging/azeventgrid/build.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
//go:build go1.18
4+
// +build go1.18
5+
6+
//go:generate autorest ./autorest.md
7+
//go:generate gofmt -w .
8+
9+
package azeventgrid

sdk/messaging/azeventgrid/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
2+
trigger:
3+
branches:
4+
include:
5+
- main
6+
- feature/*
7+
- hotfix/*
8+
- release/*
9+
paths:
10+
include:
11+
- sdk/messaging/azeventgrid
12+
- eng/
13+
14+
pr:
15+
branches:
16+
include:
17+
- main
18+
- feature/*
19+
- hotfix/*
20+
- release/*
21+
paths:
22+
include:
23+
- sdk/messaging/azeventgrid
24+
25+
26+
stages:
27+
- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
28+
parameters:
29+
ServiceDirectory: 'messaging/azeventgrid'

0 commit comments

Comments
 (0)