Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions sdk/messaging/azsystemevents/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.1.0 (2023-07-11)

### Features Added

- Initial preview for the Event Grid package for Event Grid Namespaces
21 changes: 21 additions & 0 deletions sdk/messaging/azsystemevents/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.
131 changes: 131 additions & 0 deletions sdk/messaging/azsystemevents/autorest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
## Go

``` yaml
title: AzureEventGridSystemEvents
description: Azure Event Grid system events
generated-metadata: false
clear-output-folder: false
go: true
require: https://github.com/Azure/azure-rest-api-specs/blob/11bbc2b1df2e915a2227a6a1a48a27b9e67c3311/specification/eventgrid/data-plane/readme.md
license-header: MICROSOFT_MIT_NO_VERSION
openapi-type: "data-plane"
output-folder: ../azsystemevents
override-client-name: ClientDeleteMe
security: "AADToken"
use: "@autorest/[email protected]"
version: "^3.0.0"
slice-elements-byval: true
remove-non-reference-schema: true
batch:
- tag: package-2018-01
directive:
- from: swagger-document
where: $
transform: $['paths'] = {}; return $;
- from: swagger-document
where: $.definitions.MediaJobOutput
transform: >
$.required.push("@odata.type");
$["x-csharp-usage"] = "model,output";
# reference azcore/messaging/CloudEvent
- from: client.go
where: $
transform: return $.replace(/\[\]CloudEvent/g, "[]messaging.CloudEvent");
- from: client.go
where: $
transform: return $.replace(/func \(client \*Client\) PublishCloudEventEvents\(/g, "func (client *Client) internalPublishCloudEventEvents(");
- from: swagger-document
where: $.definitions.CloudEventEvent
transform: $["x-ms-external"] = true
- from:
- models.go
- models_serde.go
where: $
transform: |
return $.replace(/ResourceActionCancelData/g, 'ResourceActionCancelEventData')
.replace(/ResourceActionFailureData/g, 'ResourceActionFailureEventData')
.replace(/ResourceActionSuccessData/g, 'ResourceActionSuccessEventData')
.replace(/ResourceDeleteCancelData/g, 'ResourceDeleteCancelEventData')
.replace(/ResourceDeleteFailureData/g, 'ResourceDeleteFailureEventData')
.replace(/ResourceDeleteSuccessData/g, 'ResourceDeleteSuccessEventData')
.replace(/ResourceWriteCancelData/g, 'ResourceWriteCancelEventData')
.replace(/ResourceWriteFailureData/g, 'ResourceWriteFailureEventData')
.replace(/ResourceWriteSuccessData/g, 'ResourceWriteSuccessEventData')
```

```yaml
directive:
- from:
- models.go
- client.go
- response_types.go
- options.go
where: $
transform: return $.replace(/CloudEventEvent/g, "CloudEvent");
- from:
- models.go
- models_serde.go
- client.go
- response_types.go
- options.go
where: $
transform: return $.replace(/Schema of the Data property of an EventGridEvent/g, "Schema of the Data property of an CloudEvent/EventGridEvent");
```

```yaml
directive:
- from:
- models.go
- models_serde.go
where: $
transform: |
return $
.replace(/ChannelLatencyMs \*string/g, "ChannelLatencyMS *string")
.replace(/m.ChannelLatencyMs/g, "m.ChannelLatencyMS");
```

```yaml
directive:
- from: constants.go
where: $
transform: return $.replace(/EventGridMqttClientDisconnectionReason/g, "EventGridMQTTClientDisconnectionReason")
- from: models.go
where: $
transform: return $.replace(/DisconnectionReason \*EventGridMqttClientDisconnectionReason/, "DisconnectionReason *EventGridMQTTClientDisconnectionReason")
```

Manually map n/a to the zero value for the type for `MediaLiveEventChannelArchiveHeartbeatEventData` and `MediaLiveEventIngestHeartbeatEventData`

```yaml
directive:
- from: models_serde.go
where: $
transform: |
return $
.replace(/(\s+err = unpopulate\(val, "IngestDriftValue", &m.IngestDriftValue\))/, "$1\nfixNAValue(&m.IngestDriftValue)")
.replace(/(\s+err = unpopulate\(val, "ChannelLatencyMs", &m.ChannelLatencyMS\))/, "$1\nfixNAValue(&m.ChannelLatencyMS)");
```

Rename `AcsRouterWorkerSelector.TTLSeconds` to `TimeToLive`

```yaml
directive:
- from:
- models.go
where: $
transform: return $.replace(/TTLSeconds \*float32/g, "TimeToLive *float32");
- from:
- models_serde.go
where: $
transform: return $.replace(/a\.TTLSeconds/g, "a.TimeToLive");
```

Fix the EventGridEvent deserialization to work similar to CloudEvent.

```yaml
directive:
- from: models_serde.go
where: $
transform: |
return $.replace(/err = unpopulate\(val, "Data", &e.Data\)/, "e.Data = []byte(val)")
```
12 changes: 12 additions & 0 deletions sdk/messaging/azsystemevents/build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

//go:generate autorest ./autorest.md
//go:generate goimports -w ./..
//go:generate go run ./internal/generate generate
//go:generate goimports -w ./..

package azsystemevents
36 changes: 36 additions & 0 deletions sdk/messaging/azsystemevents/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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/azsystemevents
- eng/

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

stages:
- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
parameters:
ServiceDirectory: "messaging/azsystemevents"
RunLiveTests: true
UsePipelineProxy: false
Location: westus2
EnvVars:
AZURE_CLIENT_ID: $(AZSYSTEMEVENTS_CLIENT_ID)
AZURE_TENANT_ID: $(AZSYSTEMEVENTS_TENANT_ID)
AZURE_CLIENT_SECRET: $(AZSYSTEMEVENTS_CLIENT_SECRET)
AZURE_SUBSCRIPTION_ID: $(AZSYSTEMEVENTS_SUBSCRIPTION_ID)
Loading