diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 24b58d0bc6c4..29c9211c9d51 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -22,6 +22,7 @@ dependencies: '@rush-temp/eslint-plugin-azure-sdk': 'file:projects/eslint-plugin-azure-sdk.tgz' '@rush-temp/event-hubs': 'file:projects/event-hubs.tgz' '@rush-temp/event-processor-host': 'file:projects/event-processor-host.tgz' + '@rush-temp/eventgrid': 'file:projects/eventgrid.tgz' '@rush-temp/eventhubs-checkpointstore-blob': 'file:projects/eventhubs-checkpointstore-blob.tgz' '@rush-temp/identity': 'file:projects/identity.tgz' '@rush-temp/keyvault-admin': 'file:projects/keyvault-admin.tgz' @@ -9236,6 +9237,67 @@ packages: integrity: sha512-QytC/CjcRtJZwlPxvYKLJ91gtaNaw860njdrpQZv0Ka1ZHwZzMkFaJPV15kGYqYrwZSz4IcBaRec90e8fccqOw== tarball: 'file:projects/event-processor-host.tgz' version: 0.0.0 + 'file:projects/eventgrid.tgz': + dependencies: + '@azure/core-tracing': 1.0.0-preview.9 + '@microsoft/api-extractor': 7.7.11 + '@opentelemetry/api': 0.10.2 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.1.0_rollup@1.32.1 + '@rollup/plugin-replace': 2.3.3_rollup@1.32.1 + '@types/chai': 4.2.11 + '@types/chai-as-promised': 7.1.3 + '@types/mocha': 7.0.2 + '@types/node': 8.10.61 + '@types/sinon': 9.0.4 + '@types/uuid': 8.0.0 + '@typescript-eslint/eslint-plugin': 2.34.0_3787943315ebc5ea524d5c102dc9e452 + '@typescript-eslint/parser': 2.34.0_eslint@6.8.0+typescript@3.9.6 + chai: 4.2.0 + chai-as-promised: 7.1.1_chai@4.2.0 + cross-env: 7.0.2 + dotenv: 8.2.0 + eslint: 6.8.0 + eslint-config-prettier: 6.11.0_eslint@6.8.0 + eslint-plugin-no-null: 1.0.2_eslint@6.8.0 + eslint-plugin-no-only-tests: 2.4.0 + eslint-plugin-promise: 4.2.1 + karma: 5.1.1 + karma-chrome-launcher: 3.1.0 + karma-coverage: 2.0.2 + karma-edge-launcher: 0.4.2_karma@5.1.1 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-ie-launcher: 1.0.0_karma@5.1.1 + karma-json-preprocessor: 0.3.3_karma@5.1.1 + karma-json-to-file-reporter: 1.0.1 + karma-junit-reporter: 2.0.1_karma@5.1.1 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@5.1.1 + karma-remap-istanbul: 0.6.0_karma@5.1.1 + mocha: 7.2.0 + mocha-junit-reporter: 1.23.3_mocha@7.2.0 + nyc: 14.1.1 + prettier: 1.19.1 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-shim: 1.0.0 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup-plugin-terser: 5.3.0_rollup@1.32.1 + rollup-plugin-visualizer: 4.0.4_rollup@1.32.1 + sinon: 9.0.2 + source-map-support: 0.5.19 + ts-node: 8.10.2_typescript@3.9.6 + tslib: 2.0.0 + typescript: 3.9.6 + dev: false + name: '@rush-temp/eventgrid' + resolution: + integrity: sha512-JneUDGxCKVc2OBMRQ2oIOHtmnt6clWBwZBmG3eJlAzk+PkSNVr87URfrJJy3nkU28+TUkK3xHnHyU/bmys6nXw== + tarball: 'file:projects/eventgrid.tgz' + version: 0.0.0 'file:projects/eventhubs-checkpointstore-blob.tgz': dependencies: '@azure/event-hubs': 5.2.2 @@ -9366,6 +9428,7 @@ packages: 'file:projects/keyvault-admin.tgz': dependencies: '@azure/core-tracing': 1.0.0-preview.9 + '@microsoft/api-extractor': 7.7.11 '@opentelemetry/api': 0.10.2 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -9395,7 +9458,7 @@ packages: dev: false name: '@rush-temp/keyvault-admin' resolution: - integrity: sha512-zS+QZh+wHSnZhRTWpQcTgPlHzbm+Djb+pSL8tT6dTBo3cV1xFWHeYaenVT7gjQWgAJ41PREmPmSjBsLHnwSI7g== + integrity: sha512-eJjxCTqMLb7tC0iSwnDg/sXQpv/89fgdgtuMTfFMnx7nM+30n/L8qTwXhBQs87UucOKDQI3qSw8DD74fs7xGvg== tarball: 'file:projects/keyvault-admin.tgz' version: 0.0.0 'file:projects/keyvault-certificates.tgz': @@ -10512,6 +10575,7 @@ specifiers: '@rush-temp/eslint-plugin-azure-sdk': 'file:./projects/eslint-plugin-azure-sdk.tgz' '@rush-temp/event-hubs': 'file:./projects/event-hubs.tgz' '@rush-temp/event-processor-host': 'file:./projects/event-processor-host.tgz' + '@rush-temp/eventgrid': 'file:./projects/eventgrid.tgz' '@rush-temp/eventhubs-checkpointstore-blob': 'file:./projects/eventhubs-checkpointstore-blob.tgz' '@rush-temp/identity': 'file:./projects/identity.tgz' '@rush-temp/keyvault-admin': 'file:./projects/keyvault-admin.tgz' diff --git a/dataplane.code-workspace b/dataplane.code-workspace index e175704ad01b..03a59dcee4d6 100644 --- a/dataplane.code-workspace +++ b/dataplane.code-workspace @@ -60,6 +60,10 @@ "name": "cosmos", "path": "sdk/cosmosdb/cosmos" }, + { + "name": "eventgrid", + "path": "sdk\\eventgrid\\eventgrid" + }, { "name": "event-hubs", "path": "sdk/eventhub/event-hubs" diff --git a/rush.json b/rush.json index aad62f192e85..c816a9e34d11 100644 --- a/rush.json +++ b/rush.json @@ -422,6 +422,11 @@ "projectFolder": "common/tools/dev-tool", "versionPolicyName": "utility" }, + { + "packageName": "@azure/eventgrid", + "projectFolder": "sdk/eventgrid/eventgrid", + "versionPolicyName": "client" + }, { "packageName": "@azure/event-hubs", "projectFolder": "sdk/eventhub/event-hubs", diff --git a/sdk/eventgrid/ci.yml b/sdk/eventgrid/ci.yml new file mode 100644 index 000000000000..650c163c8de9 --- /dev/null +++ b/sdk/eventgrid/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - release/* + - hotfix/* + paths: + include: + - sdk/eventgrid/ + +pr: + branches: + include: + - master + - feature/* + - release/* + - hotfix/* + paths: + include: + - sdk/eventgrid/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: eventgrid + Artifacts: + - name: azure-eventgrid + safeName: azureeventgrid diff --git a/sdk/eventgrid/eventgrid/.eslintrc.json b/sdk/eventgrid/eventgrid/.eslintrc.json new file mode 100644 index 000000000000..47d9fc35be4a --- /dev/null +++ b/sdk/eventgrid/eventgrid/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "plugins": ["@azure/azure-sdk"], + "extends": ["plugin:@azure/azure-sdk/azure-sdk-base"] +} diff --git a/sdk/eventgrid/eventgrid/.nycrc b/sdk/eventgrid/eventgrid/.nycrc new file mode 100644 index 000000000000..57d62a937719 --- /dev/null +++ b/sdk/eventgrid/eventgrid/.nycrc @@ -0,0 +1,14 @@ +{ + "include": [ + "dist-esm/src/**/*.js" + ], + "exclude": [ + "**/*.d.ts", + "dist-esm/src/generated/*" + ], + "exclude-after-remap": false, + "sourceMap": true, + "produce-source-map": true, + "instrument": true, + "all": true + } diff --git a/sdk/eventgrid/eventgrid/.vscode/launch.json b/sdk/eventgrid/eventgrid/.vscode/launch.json new file mode 100644 index 000000000000..0cda8fea0c32 --- /dev/null +++ b/sdk/eventgrid/eventgrid/.vscode/launch.json @@ -0,0 +1,76 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Debug Javascript Samples", + "program": "${workspaceFolder}/samples/javascript/basic.js", + "preLaunchTask": "npm: build:js-samples" + }, + { + "type": "node", + "request": "launch", + "name": "Debug Typescript Samples", + "program": "${workspaceFolder}/samples/typescript/basic.ts", + "preLaunchTask": "npm: build:ts-samples", + "outFiles": ["${workspaceFolder}/dist-esm/samples/typescript/*.js"] + }, + { + "type": "node", + "request": "launch", + "name": "Current TS File", + "args": [ + "${fileBasename}" + ], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], + "env": { "TS_NODE_COMPILER_OPTIONS": "{\"module\": \"commonjs\"}" }, + "cwd": "${fileDirname}", + "sourceMaps": true, + "protocol": "inspector" + }, + { + "type": "node", + "request": "launch", + "name": "Debug Mocha Test [Without Rollup]", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": [ + "-r", + "ts-node/register", + "--timeout", + "999999", + "--colors", + "${workspaceFolder}/test/*.spec.ts", + "${workspaceFolder}/test/node/*.spec.ts" + ], + "env": { "TS_NODE_COMPILER_OPTIONS": "{\"module\": \"commonjs\"}" }, + "envFile": "${workspaceFolder}/.env", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "protocol": "inspector" + }, + { + "type": "node", + "request": "launch", + "name": "Debug Unit Tests", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": [ + "-u", + "tdd", + "--timeout", + "999999", + "--colors", + "${workspaceFolder}/dist-test/index.node.js" + ], + "internalConsoleOptions": "openOnSessionStart", + "preLaunchTask": "npm: build:test" + } + ] +} \ No newline at end of file diff --git a/sdk/eventgrid/eventgrid/.vscode/settings.json b/sdk/eventgrid/eventgrid/.vscode/settings.json new file mode 100644 index 000000000000..c2ce48368a29 --- /dev/null +++ b/sdk/eventgrid/eventgrid/.vscode/settings.json @@ -0,0 +1,26 @@ +{ + "editor.detectIndentation": false, + "editor.formatOnSave": true, + "editor.insertSpaces": true, + "editor.tabSize": 2, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "javascript.preferences.quoteStyle": "double", + "typescript.preferences.quoteStyle": "double", + "search.exclude": { + "test-results*.xml": true, + "**/temp/*": true, + "**/dist/*": true, + "**/*.map": true, + "**/dist-*/*": true, + "**/test-dist/*": true, + "**/node_modules": true, + "**/bower_components": true, + "**/*.code-search": true, + "**/types/*": true, + "**/coverage/*": true, + "**/*.d.ts": true, + "**/test-browser/*": true + }, + "typescript.tsdk": "..\\..\\core\\core-http\\node_modules\\typescript\\lib" +} diff --git a/sdk/eventgrid/eventgrid/CHANGELOG.md b/sdk/eventgrid/eventgrid/CHANGELOG.md new file mode 100644 index 000000000000..c534f4049eff --- /dev/null +++ b/sdk/eventgrid/eventgrid/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 3.0.0-beta.1 (2020-09-08) + +- This release is a preview of our efforts to create a client library that is user friendly and + idiomatic to the JavaScript ecosystem. The reasons for most of the changes in this update can be found in the + [Azure SDK Design Guidelines for TypeScript](https://azuresdkspecs.z5.web.core.windows.net/TypeScriptSpec.html). diff --git a/sdk/eventgrid/eventgrid/LICENSE.txt b/sdk/eventgrid/eventgrid/LICENSE similarity index 97% rename from sdk/eventgrid/eventgrid/LICENSE.txt rename to sdk/eventgrid/eventgrid/LICENSE index b73b4a1293c3..ea8fb1516028 100644 --- a/sdk/eventgrid/eventgrid/LICENSE.txt +++ b/sdk/eventgrid/eventgrid/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 Microsoft +Copyright (c) 2020 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/eventgrid/eventgrid/README.md b/sdk/eventgrid/eventgrid/README.md index 6d5166ca35bd..d6e5a0474a10 100644 --- a/sdk/eventgrid/eventgrid/README.md +++ b/sdk/eventgrid/eventgrid/README.md @@ -1,119 +1,260 @@ -## Azure EventGridClient SDK for JavaScript +# Azure Event Grid client library for JavaScript -This package contains an isomorphic SDK for EventGridClient. +[Azure Event Grid](https://azure.microsoft.com/en-us/services/event-grid/) is a cloud-based service that provides reliable event delivery at massive scale. + +Use the client library to: + +- Send events to Event Grid using either the Event Grid, Cloud Events 1.0 schemas, or a custom schema +- Decode and process events which were delivered to an Event Grid handler +- Generate Shared Access Signatures for Event Grid topics + +[Source code](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventgrid/eventgrid/) | +[Package (NPM)](https://www.npmjs.com/package/@azure/eventgrid) | +[API reference documentation](https://aka.ms/azsdk-js-eventgrid-ref-docs) | +[Product documentation](https://docs.microsoft.com/en-us/azure/event-grid/) | +[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventgrid/eventgrid/samples) + +## Getting started ### Currently supported environments -- Node.js version 6.x.x or higher +- Node.js version 8.x.x or higher - Browser JavaScript + - Apple Safari: latest two versions + - Google Chrome: latest two versions + - Microsoft Edge: all supported versions + - Mozilla FireFox: latest two versions + +### Prerequisites -### How to Install +- An [Azure subscription][azure_sub]. +- An existing [Event Grid][event_grid] Topic or Domain. If you need to create the resource, you can use the [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. + +If you use the Azure CLI, replace `` and `` with your own unique names: + +#### Create an Event Grid Topic + +```bash +az eventgrid topic create --location --resource-group --name +``` + +#### Create an Event Grid Domain + +```bash +az eventgrid domain create --location --resource-group --name +``` + +### Install the `@azure/eventgrid` package + +Install the Azure Event Grid client library for JavaScript with `npm`: ```bash npm install @azure/eventgrid ``` -### How to use +### Create and authenticate a `EventGridPublisherClient` + +To create a client object to access the Event Grid API, you will need the `endpoint` of your Event Grid topic and a `credential`. The Event Grid client can use either an Access Key or Shared Access Signature (SAS) created from an access key. + +You can find the endpoint for your Event Grid topic either in the [Azure Portal][azure_portal] or by using the [Azure CLI][azure_cli] snippet below: + +```bash +az eventgrid topic show --name --resource-group --query "endpoint" +``` -#### nodejs - Authentication, client creation and publishEvents as an example written in TypeScript. +#### Using an Access Key -##### Install @azure/ms-rest-nodeauth +Use the [Azure Portal][azure_portal] to browse to your Event Grid resource and retrieve an Access Key, or use the [Azure CLI][azure_cli] snippet below: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +az eventgrid topic key list --resource-group --name +``` + +Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows: + +```js +const { EventGridPublisherClient, AzureKeyCredential } = require("@azure/eventgrid"); + +const client = new EventGridPublisherClient("", new AzureKeyCredential("")); +``` + +#### Using a SAS Token + +Like an access key, a SAS token allows access to sending events to an Event Grid topic. Unlike an access key, which can be used until it is regenerated, a SAS token has an experation time, at which point it is no longer valid. To use a SAS token for authentication, use the `EventGridSharedAccesSignatureCredential` as follows: + +```js +const { + EventGridPublisherClient, + EventGridSharedAccessSignatureCredential +} = require("@azure/eventgrid"); + +const client = new EventGridPublisherClient( + "", + new EventGridSharedAccessSignatureCredential("") +); +``` + +You can generate a SAS token by using the `generateSharedAccessSigniture` function. + +```js +const { generateSharedAccessSignature, AzureKeyCredential } = require("@azure/eventgrid"); + +// Create a SAS Token which expires on 2020-01-01 at Midnight. +const token = generateSharedAccessSignature( + "", + new AzureKeyCredential(""), + new Date("2020-01-01T00:00:00") +); +``` + +## Key concepts + +### EventGridPublisherClient + +`EventGridPublisherClient` is used sending events to an Event Grid Topic or an Event Grid Domain. + +### Event Schemas + +Event Grid supports multiple schemas for encoding events. When a Custom Topic or Domain is created, you specify the schema that will be used when publishing events. While you may configure your topic to use a _custom schema_ it is more common to use the already defined _Event Grid schema_ or _CloudEvents 1.0 schema_. [CloudEvents](https://cloudevents.io/) is a Cloud Native Computing Foundation project which produces a specification for describing event data in a common way. Regardless of what schmea your topic or domain is configured to use, `EventGridPublisherClient` will be used to publish events to it. However, you must use the correct method for publishing: + +| Schema | Publishing Method | +| ------------ | --------------------- | +| Event Grid | `publishEvents` | +| Cloud Events | `publishCloudEvents` | +| Custom | `publishCustomEvents` | + +Using the wrong method will result in an error from the service and your events will not be published. + +### EventGridConsumer + +Events delivered to consumers by Event Grid are delivered as JSON. Depending on the type of consumer being delivered to, the Event Grid service may deliver one or more events as part of a single payload. While these events may be deserialized using normal JavaScript methods like `JSON.parse`, this library offers a helper type for deserializing events, called `EventGridConsumer`. + +Compared with using `JSON.parse` directly, `EventGridConsumer` does some additional conversions while deserializng events: + +1. `EventGridConsumer` validates that the required properties of an event are present and are the right types. +2. `EventGridConsumer` converts the event time property into a JavaScript `Date` object. +3. When using Cloud Events, binary data may be used for an event's data property (by using `Uint8Array`). When the event is sent through Event Grid, it is encoded in Base 64. `EventGridConsumer` will decode this data back into an instance of `Uint8Array`. +4. When deserilizing a _System Event_ (an event generated by another Azure service), `EventGridConsumer` will do additional conversions so that the `data` object matches the corresponding interface which describes its data. When using TypeScript, these interfaces ensure you have strong typing when access properties of the data object for a system event. + +When creating an instance of `EventGridConsumer` you may supply custom deserializers that are used to further convert the `data` object. + +## Examples + +### Publish a Custom Event to an Event Grid Topic + +```js +const { EventGridPublisherClient, AzureKeyCredential } = require("@azure/eventgrid"); + +const client = new EventGridPublisherClient("", new AzureKeyCredential("")); + +await client.sendEvents([ + { + eventType: "Azure.Sdk.SampleEvent", + subject: "Event Subject", + dataVersion: "1.0", + data: { + hello: "world" + } + } +]); +``` + +### Publish a Custom Event to a Topic in an Event Grid Domain + +Publishing events to an Event Grid Domain is similar to publish to an Event Grid Topic, except that when using the Event Grid schema for events, you must include the `topic` property. When publishing events in the Cloud Events 1.0 schema, the required `source` property is used as the name of the topic in the domain to publish to: + +```js +const { EventGridPublisherClient, AzureKeyCredential } = require("@azure/eventgrid"); + +const client = new EventGridPublisherClient("", new AzureKeyCredential("")); + +await client.sendEvents([ + { + topic: "my-sample-topic", + eventType: "Azure.Sdk.SampleEvent", + subject: "Event Subject", + dataVersion: "1.0", + data: { + hello: "world" + } + } +]); ``` -##### Sample code - -```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { EventGridClient, EventGridModels, EventGridMappers } from "@azure/eventgrid"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new EventGridClient(creds, subscriptionId); - const topicHostname = "testtopicHostname"; - const events = [{ - id: "testid", - topic: "testtopic", - subject: "testsubject", - data: {}, - eventType: "testeventType", - eventTime: new Date().toISOString(), - dataVersion: "testdataVersion" - }]; - client.publishEvents(topicHostname, events).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); +### Deserializing an Event + +`EventGridConsumer` can be used to deserialize events delivered by Event Grid. When deserializing an event, you need to know the schema used to deliver the event. In this example we have events being delivered to an Azure Service Bus Topic in the Cloud Events schema. Using the Service Bus SDK we can recieve these events from the Service Bus Topic and then deserialize them using `EventGridConsumer` and use `isSystemEvent` to detect what type of events they are. + +```js +const { ServiceBusClient } = require("@azure/service-bus"); +const { DefaultAzureCredential } = require("@azure/identity"); +const { EventGridConsumer, isSystemEvent } = require("@azure/eventgrid"); + +const client = new ServiceBusClient("", new DefaultAzureCredential()); + +const receiver = client.createReceiver("", "peekLock"); + +const consumer = new EventGridConsumer(); + +async function processMessage(message) { + // When delivering to a Service Bus Queue or Topic, EventGrid delivers a single event per message. + // so we just pluck the first one. + const event = (await consumer.decodeCloudEvents(message.body))[0]; + + if (isSystemEvent("Microsoft.ContainerRegistry.ImagePushed", event)) { + console.log( + `${event.time}: Container Registry Image Pushed event for image ${event.data.target.repository}:${event.data.target.tag}` + ); + } else if (isSystemEvent("Microsoft.ContainerRegistry.ImageDeleted", event)) { + console.log( + `${event.time}: Container Registry Image Deleted event for repository ${event.data.target.repository}` + ); + } + + await message.complete(); +} + +console.log("starting receiver"); + +receiver.subscribe({ + processError: async (err) => { + console.error(err); + }, + processMessage }); ``` -#### browser - Authentication, client creation and publishEvents as an example written in JavaScript. +## Troubleshooting + +### Enable logs + +You can set the following environment variable to get the debug logging output when using this library. -##### Install @azure/ms-rest-browserauth +- Getting debug logs from the Azure Event Grid client library ```bash -npm install @azure/ms-rest-browserauth +export AZURE_LOG_LEVEL=verbose ``` -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/eventgrid sample - - - - - - - - -``` +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/logger). + +## Next steps + +Please take a look at the +[samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventgrid/eventgrid/samples) +directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code. ## Related projects - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/eventgrid/eventgrid/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Feventgrid%2Feventgrid%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[event_grid]: https://docs.microsoft.com/en-us/azure/event-grid +[azure_portal]: https://portal.azure.com diff --git a/sdk/eventgrid/eventgrid/api-extractor.json b/sdk/eventgrid/eventgrid/api-extractor.json new file mode 100644 index 000000000000..b4df7e187999 --- /dev/null +++ b/sdk/eventgrid/eventgrid/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "types/src/index.d.ts", + "docModel": { + "enabled": false + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/eventgrid.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} diff --git a/sdk/eventgrid/eventgrid/karma.conf.js b/sdk/eventgrid/eventgrid/karma.conf.js new file mode 100644 index 000000000000..0b74b8bcbd5e --- /dev/null +++ b/sdk/eventgrid/eventgrid/karma.conf.js @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// https://github.com/karma-runner/karma-chrome-launcher +process.env.CHROME_BIN = require("puppeteer").executablePath(); +require("dotenv").config(); +const { + jsonRecordingFilterFunction, + isPlaybackMode, + isSoftRecordMode, + isRecordMode +} = require("@azure/test-utils-recorder"); + +module.exports = function(config) { + config.set({ + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: "./", + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ["mocha"], + + plugins: [ + "karma-mocha", + "karma-mocha-reporter", + "karma-chrome-launcher", + "karma-edge-launcher", + "karma-firefox-launcher", + "karma-ie-launcher", + "karma-env-preprocessor", + "karma-coverage", + "karma-remap-istanbul", + "karma-junit-reporter", + "karma-json-to-file-reporter", + "karma-json-preprocessor" + ], + + // list of files / patterns to load in the browser + files: ["dist-test/index.browser.js"].concat( + isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : [] + ), + + // list of files / patterns to exclude + exclude: [], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + "**/*.js": ["env"], + "recordings/browsers/**/*.json": ["json"] + // IMPORTANT: COMMENT following line if you want to debug in your browsers!! + // Preprocess source file to calculate code coverage, however this will make source file unreadable + // "test-browser/index.js": ["coverage"] + }, + + envPreprocessor: [ + "TEST_MODE", + "EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT", + "EVENT_GRID_EVENT_GRID_SCHEMA_API_KEY", + "EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT", + "EVENT_GRID_CUSTOM_SCHEMA_API_KEY", + "EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT", + "EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY", + ], + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit", "json-to-file"], + + coverageReporter: { + // specify a common output directory + dir: "coverage-browser/", + reporters: [{ type: "json", subdir: ".", file: "coverage.json" }] + }, + + remapIstanbulReporter: { + src: "coverage-browser/coverage.json", + reports: { + lcovonly: "coverage-browser/lcov.info", + html: "coverage-browser/html/report", + "text-summary": null, + cobertura: "./coverage-browser/cobertura-coverage.xml" + } + }, + + junitReporter: { + outputDir: "", // results will be saved as $outputDir/$browserName.xml + outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile + suite: "", // suite will become the package name attribute in xml testsuite element + useBrowserName: false, // add browser name to report and classes names + nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element + classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element + properties: {} // key value pair of properties to add to the section of the report + }, + + jsonToFileReporter: { + filter: jsonRecordingFilterFunction, + outputPath: "." + }, + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + // --no-sandbox allows our tests to run in Linux without having to change the system. + // --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex. + browsers: ["ChromeHeadlessNoSandbox"], + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: "ChromeHeadless", + flags: ["--no-sandbox", "--disable-web-security"] + } + }, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: 1, + + browserNoActivityTimeout: 600000, + browserDisconnectTimeout: 10000, + browserDisconnectTolerance: 3, + browserConsoleLogOptions: { + terminal: !isRecordMode() + }, + + client: { + mocha: { + // change Karma's debug.html to the mocha web reporter + reporter: "html", + timeout: "600000" + } + } + }); +}; diff --git a/sdk/eventgrid/eventgrid/package.json b/sdk/eventgrid/eventgrid/package.json index fddae13a0aa3..18596ac13389 100644 --- a/sdk/eventgrid/eventgrid/package.json +++ b/sdk/eventgrid/eventgrid/package.json @@ -1,13 +1,9 @@ { "name": "@azure/eventgrid", + "sdk-type": "client", "author": "Microsoft Corporation", - "description": "EventGridClient Library with typescript type definitions for node.js and browser.", - "version": "2.0.0", - "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" - }, + "description": "An isomorphic client library for the Azure Event Grid service.", + "version": "3.0.0-beta.1", "keywords": [ "node", "azure", @@ -16,16 +12,9 @@ "isomorphic" ], "license": "MIT", - "main": "./dist/eventgrid.js", - "module": "./esm/eventGridClient.js", - "types": "./esm/eventGridClient.d.ts", - "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" - }, + "main": "./dist/src/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/eventgrid.d.ts", "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventgrid/eventgrid", "repository": { "type": "git", @@ -35,24 +24,118 @@ "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ - "dist/**/*.js", - "dist/**/*.js.map", - "dist/**/*.d.ts", - "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", - "src/**/*.ts", + "dist/", + "dist-esm/src/", + "types/eventgrid.d.ts", "README.md", - "rollup.config.js", - "tsconfig.json" + "LICENSE" ], + "//metadata": { + "constantPaths": [ + { + "path": "src/generated/generatedClientContext.ts", + "prefix": "packageVersion" + }, + { + "path": "src/constants.ts", + "prefix": "SDK_VERSION" + } + ] + }, + "browser": { + "./dist-esm/src/cryptoHelpers.js": "./dist-esm/src/cryptoHelpers.browser.js" + }, "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/eventgrid.js.map'\" -o ./dist/eventgrid.min.js ./dist/eventgrid.js", - "prepack": "npm install && npm run build" + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:autorest": "autorest ./swagger/README.md --typescript --v3", + "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", + "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", + "build:samples": "node ../../../common/scripts/prep-samples.js && cd samples && tsc -p .", + "build:test": "tsc -p . && rollup -c rollup.test.config.js 2>&1", + "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local", + "check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/", + "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/", + "execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples", + "extract-api": "tsc -p . && api-extractor run --local", + "format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "integration-test:browser": "karma start --single-run", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace dist-esm/test/**/*.spec.js", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "lint:fix": "eslint \"src/**/*.ts\" --fix --fix-type [problem,suggestion]", + "lint": "eslint src --ext .ts -f html -o textAnalytics-lintReport.html", + "pack": "npm pack 2>&1", + "prebuild": "npm run clean", + "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser", + "test:node": "npm run clean && npm run build:test && npm run unit-test:node", + "test": "npm run clean && npm run build:test && npm run unit-test", + "unit-test:browser": "karma start --single-run", + "unit-test:node": "mocha --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace dist-test/index.node.js", + "unit-test": "npm run unit-test:node && npm run unit-test:browser" }, "sideEffects": false, - "autoPublish": true + "autoPublish": false, + "dependencies": { + "@azure/core-auth": "^1.1.3", + "@azure/core-http": "^1.1.6", + "@azure/core-tracing": "1.0.0-preview.9", + "@azure/logger": "^1.0.0", + "@opentelemetry/api": "^0.10.2", + "tslib": "^2.0.0" + }, + "devDependencies": { + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/test-utils-recorder": "^1.0.0", + "@microsoft/api-extractor": "7.7.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-replace": "^2.2.0", + "@types/chai": "^4.1.6", + "@types/chai-as-promised": "^7.1.0", + "@types/mocha": "^7.0.2", + "@types/node": "^8.0.0", + "@types/sinon": "^9.0.4", + "@types/uuid": "^8.0.0", + "@typescript-eslint/eslint-plugin": "^2.0.0", + "@typescript-eslint/parser": "^2.0.0", + "chai": "^4.2.0", + "chai-as-promised": "^7.1.1", + "cross-env": "^7.0.2", + "dotenv": "^8.2.0", + "eslint": "^6.1.0", + "eslint-config-prettier": "^6.0.0", + "eslint-plugin-no-null": "^1.0.2", + "eslint-plugin-no-only-tests": "^2.3.0", + "eslint-plugin-promise": "^4.1.1", + "karma": "^5.1.0", + "karma-chrome-launcher": "^3.0.0", + "karma-coverage": "^2.0.0", + "karma-edge-launcher": "^0.4.2", + "karma-env-preprocessor": "^0.1.1", + "karma-firefox-launcher": "^1.1.0", + "karma-ie-launcher": "^1.0.0", + "karma-json-preprocessor": "^0.3.3", + "karma-json-to-file-reporter": "^1.0.1", + "karma-junit-reporter": "^2.0.1", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "karma-remap-istanbul": "^0.6.0", + "mocha": "^7.1.1", + "mocha-junit-reporter": "^1.18.0", + "nyc": "^14.0.0", + "prettier": "^1.16.4", + "rimraf": "^3.0.0", + "rollup": "^1.16.3", + "rollup-plugin-shim": "^1.0.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-terser": "^5.1.1", + "rollup-plugin-visualizer": "^4.0.4", + "sinon": "^9.0.2", + "source-map-support": "^0.5.9", + "ts-node": "^8.3.0", + "typescript": "~3.9.3" + } } diff --git a/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_a_single_event.json b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_a_single_event.json new file mode 100644 index 000000000000..e06cfedfde60 --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_a_single_event.json @@ -0,0 +1,32 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/api/events", + "query": { + "api-version": "2018-01-01" + }, + "requestBody": "[{\"id\":\"cloudSingleEventId159588374669809673\",\"source\":\"/earth/unitedstates/washington/kirkland/finnhill\",\"data\":{\"hello\":\"world\"},\"type\":\"Azure.Sdk.TestEvent1\",\"time\":\"2020-07-27T21:02:26.698Z\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\"}]", + "status": 200, + "response": "", + "responseHeaders": { + "api-supported-versions": "2018-01-01", + "content-length": "0", + "date": "Mon, 27 Jul 2020 21:02:26 GMT", + "server": "Microsoft-HTTPAPI/2.0", + "status": "200", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-ms-request-id": "46a799c7-f453-4894-9b7e-e6fd93259622" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "cloudSingleEventId": "cloudSingleEventId159588374669809673" + }, + "newDate": { + "cloudSingleEventDate": "2020-07-27T21:02:26.698Z" + } + }, + "hash": "7fe25ee020ac364dae32ce81a81c7c3f" +} \ No newline at end of file diff --git a/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_multiple_events.json b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_multiple_events.json new file mode 100644 index 000000000000..d4491d390ec3 --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_multiple_events.json @@ -0,0 +1,34 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/api/events", + "query": { + "api-version": "2018-01-01" + }, + "requestBody": "[{\"id\":\"cloudMultiEventId1159588374680705635\",\"source\":\"/earth/unitedstates/washington/kirkland/finnhill\",\"data\":{\"hello\":\"world\"},\"type\":\"Azure.Sdk.TestEvent1\",\"time\":\"2020-07-27T21:02:26.807Z\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"Multiple 1\"},{\"id\":\"cloudMultiEventId2159588374680700679\",\"source\":\"/earth/unitedstates/washington/kirkland/finnhill\",\"data\":{\"hello\":\"world\"},\"type\":\"Azure.Sdk.TestEvent1\",\"time\":\"2020-07-27T21:02:26.807Z\",\"specversion\":\"1.0\",\"datacontenttype\":\"application/json\",\"subject\":\"Multiple 2\"}]", + "status": 200, + "response": "", + "responseHeaders": { + "api-supported-versions": "2018-01-01", + "content-length": "0", + "date": "Mon, 27 Jul 2020 21:02:26 GMT", + "server": "Microsoft-HTTPAPI/2.0", + "status": "200", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-ms-request-id": "5883a20b-ce78-4928-afb8-bde068f61fb5" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "cloudMultiEventId1": "cloudMultiEventId1159588374680705635", + "cloudMultiEventId2": "cloudMultiEventId2159588374680700679" + }, + "newDate": { + "cloudMultiEventDate1": "2020-07-27T21:02:26.807Z", + "cloudMultiEventDate2": "2020-07-27T21:02:26.807Z" + } + }, + "hash": "799392d36931d99dc2c24d3db67fcb0b" +} \ No newline at end of file diff --git a/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcustomschemaevents/recording_sends_a_single_event.json b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcustomschemaevents/recording_sends_a_single_event.json new file mode 100644 index 000000000000..4e1ad0aed8ec --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcustomschemaevents/recording_sends_a_single_event.json @@ -0,0 +1,28 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/api/events", + "query": { + "api-version": "2018-01-01" + }, + "requestBody": "[{\"ver\":\"1.0\",\"typ\":\"Azure.Sdk.TestEvent1\",\"sub\":\"Single\",\"payload\":{\"hello\":\"world\"}}]", + "status": 200, + "response": "", + "responseHeaders": { + "api-supported-versions": "2018-01-01", + "content-length": "0", + "date": "Mon, 27 Jul 2020 21:02:26 GMT", + "server": "Microsoft-HTTPAPI/2.0", + "status": "200", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-ms-request-id": "e9595ef6-2387-4362-9573-9a2189e74b7d" + } + } + ], + "uniqueTestInfo": { + "uniqueName": {}, + "newDate": {} + }, + "hash": "3aa867d763b256df1511358d9616f18f" +} \ No newline at end of file diff --git a/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcustomschemaevents/recording_sends_multiple_events.json b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcustomschemaevents/recording_sends_multiple_events.json new file mode 100644 index 000000000000..bfcb02399eb2 --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendcustomschemaevents/recording_sends_multiple_events.json @@ -0,0 +1,28 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/api/events", + "query": { + "api-version": "2018-01-01" + }, + "requestBody": "[{\"ver\":\"1.0\",\"typ\":\"Azure.Sdk.TestEvent1\",\"sub\":\"Multiple 1\",\"payload\":{\"hello\":\"world\"}},{\"ver\":\"1.0\",\"typ\":\"Azure.Sdk.TestEvent1\",\"sub\":\"Multiple 2\",\"payload\":{\"hello\":\"world\"}}]", + "status": 200, + "response": "", + "responseHeaders": { + "api-supported-versions": "2018-01-01", + "content-length": "0", + "date": "Mon, 27 Jul 2020 21:02:26 GMT", + "server": "Microsoft-HTTPAPI/2.0", + "status": "200", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-ms-request-id": "a2b97d35-f1aa-4033-9886-e6907c7d6769" + } + } + ], + "uniqueTestInfo": { + "uniqueName": {}, + "newDate": {} + }, + "hash": "1cfb052616732940934c2dfe9e0f6713" +} \ No newline at end of file diff --git a/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendevents/recording_sends_a_single_event.json b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendevents/recording_sends_a_single_event.json new file mode 100644 index 000000000000..cf64165efb69 --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendevents/recording_sends_a_single_event.json @@ -0,0 +1,32 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/api/events", + "query": { + "api-version": "2018-01-01" + }, + "requestBody": "[{\"id\":\"singleEventId159588374414604202\",\"subject\":\"Single 1\",\"data\":{\"hello\":\"world\"},\"eventType\":\"Azure.Sdk.TestEvent1\",\"eventTime\":\"2020-07-27T21:02:24.145Z\",\"dataVersion\":\"1.0\"}]", + "status": 200, + "response": "", + "responseHeaders": { + "api-supported-versions": "2018-01-01", + "content-length": "0", + "date": "Mon, 27 Jul 2020 21:02:26 GMT", + "server": "Microsoft-HTTPAPI/2.0", + "status": "200", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-ms-request-id": "6b4ec1fb-b123-4406-ba01-4fd7c70f4ac0" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "singleEventId": "singleEventId159588374414604202" + }, + "newDate": { + "singleEventDate": "2020-07-27T21:02:24.145Z" + } + }, + "hash": "9b44e18369316233af4458904ca8ae09" +} \ No newline at end of file diff --git a/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendevents/recording_sends_multiple_events.json b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendevents/recording_sends_multiple_events.json new file mode 100644 index 000000000000..a05ed1e4160b --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/browsers/eventgridpublisherclient_sendevents/recording_sends_multiple_events.json @@ -0,0 +1,34 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/api/events", + "query": { + "api-version": "2018-01-01" + }, + "requestBody": "[{\"id\":\"multiEventId1159588374666206734\",\"subject\":\"Multiple 1\",\"data\":{\"hello\":\"world\"},\"eventType\":\"Azure.Sdk.TestEvent1\",\"eventTime\":\"2020-07-27T21:02:26.662Z\",\"dataVersion\":\"1.0\"},{\"id\":\"multiEventId2159588374666206405\",\"subject\":\"Multiple 2\",\"data\":{\"hello\":\"world\"},\"eventType\":\"Azure.Sdk.TestEvent1\",\"eventTime\":\"2020-07-27T21:02:26.662Z\",\"dataVersion\":\"1.0\"}]", + "status": 200, + "response": "", + "responseHeaders": { + "api-supported-versions": "2018-01-01", + "content-length": "0", + "date": "Mon, 27 Jul 2020 21:02:26 GMT", + "server": "Microsoft-HTTPAPI/2.0", + "status": "200", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-ms-request-id": "e8eb4406-e3e9-4f10-9f25-31ebd5c4e48b" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "multiEventId1": "multiEventId1159588374666206734", + "multiEventId2": "multiEventId2159588374666206405" + }, + "newDate": { + "multiEventDate1": "2020-07-27T21:02:26.662Z", + "multiEventDate2": "2020-07-27T21:02:26.662Z" + } + }, + "hash": "a1eefb69b1513dc523f50ee66055787d" +} \ No newline at end of file diff --git a/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_a_single_event.js b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_a_single_event.js new file mode 100644 index 000000000000..fcbb53e92b2f --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_a_single_event.js @@ -0,0 +1,23 @@ +let nock = require('nock'); + +module.exports.hash = "b15b1edb6fd215ff27f66c70053afbb8"; + +module.exports.testInfo = {"uniqueName":{"cloudSingleEventId":"cloudSingleEventId159588373652209687"},"newDate":{"cloudSingleEventDate":"2020-07-27T21:02:16.522Z"}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/api/events', [{"id":"cloudSingleEventId159588373652209687","source":"/earth/unitedstates/washington/kirkland/finnhill","data":{"hello":"world"},"type":"Azure.Sdk.TestEvent1","time":"2020-07-27T21:02:16.522Z","specversion":"1.0","datacontenttype":"application/json"}]) + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Server', + 'Microsoft-HTTPAPI/2.0', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'api-supported-versions', + '2018-01-01', + 'x-ms-request-id', + '05f88f8f-bd50-41d7-b56c-394c1eeebe1f', + 'Date', + 'Mon, 27 Jul 2020 21:02:16 GMT' +]); diff --git a/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_multiple_events.js b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_multiple_events.js new file mode 100644 index 000000000000..2deaf6208971 --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcloudeventschemaevents/recording_sends_multiple_events.js @@ -0,0 +1,23 @@ +let nock = require('nock'); + +module.exports.hash = "cefc29910fbb6c53981faf8430a3521b"; + +module.exports.testInfo = {"uniqueName":{"cloudMultiEventId1":"cloudMultiEventId1159588373674007628","cloudMultiEventId2":"cloudMultiEventId2159588373674005416"},"newDate":{"cloudMultiEventDate1":"2020-07-27T21:02:16.740Z","cloudMultiEventDate2":"2020-07-27T21:02:16.740Z"}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/api/events', [{"id":"cloudMultiEventId1159588373674007628","source":"/earth/unitedstates/washington/kirkland/finnhill","data":{"hello":"world"},"type":"Azure.Sdk.TestEvent1","time":"2020-07-27T21:02:16.740Z","specversion":"1.0","datacontenttype":"application/json","subject":"Multiple 1"},{"id":"cloudMultiEventId2159588373674005416","source":"/earth/unitedstates/washington/kirkland/finnhill","data":{"hello":"world"},"type":"Azure.Sdk.TestEvent1","time":"2020-07-27T21:02:16.740Z","specversion":"1.0","datacontenttype":"application/json","subject":"Multiple 2"}]) + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Server', + 'Microsoft-HTTPAPI/2.0', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'api-supported-versions', + '2018-01-01', + 'x-ms-request-id', + '9ff2a9d4-8089-4ac2-9c2d-1d184abf00e5', + 'Date', + 'Mon, 27 Jul 2020 21:02:16 GMT' +]); diff --git a/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcustomschemaevents/recording_sends_a_single_event.js b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcustomschemaevents/recording_sends_a_single_event.js new file mode 100644 index 000000000000..a8611e922173 --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcustomschemaevents/recording_sends_a_single_event.js @@ -0,0 +1,23 @@ +let nock = require('nock'); + +module.exports.hash = "3243d9d0032a64c42cdeaf331c65085e"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/api/events', [{"ver":"1.0","typ":"Azure.Sdk.TestEvent1","sub":"Single","payload":{"hello":"world"}}]) + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Server', + 'Microsoft-HTTPAPI/2.0', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'api-supported-versions', + '2018-01-01', + 'x-ms-request-id', + 'fbdc8574-3c20-4bc9-af6b-0d5e454611f6', + 'Date', + 'Mon, 27 Jul 2020 21:02:16 GMT' +]); diff --git a/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcustomschemaevents/recording_sends_multiple_events.js b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcustomschemaevents/recording_sends_multiple_events.js new file mode 100644 index 000000000000..1735dfe3ec3f --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendcustomschemaevents/recording_sends_multiple_events.js @@ -0,0 +1,23 @@ +let nock = require('nock'); + +module.exports.hash = "d76e8a9024ff01c8e6c19fad4188cddb"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/api/events', [{"ver":"1.0","typ":"Azure.Sdk.TestEvent1","sub":"Multiple 1","payload":{"hello":"world"}},{"ver":"1.0","typ":"Azure.Sdk.TestEvent1","sub":"Multiple 2","payload":{"hello":"world"}}]) + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Server', + 'Microsoft-HTTPAPI/2.0', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'api-supported-versions', + '2018-01-01', + 'x-ms-request-id', + '3461b247-63cd-4940-8cfd-61ada2073c7f', + 'Date', + 'Mon, 27 Jul 2020 21:02:17 GMT' +]); diff --git a/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendevents/recording_sends_a_single_event.js b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendevents/recording_sends_a_single_event.js new file mode 100644 index 000000000000..ffd251f0e8ea --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendevents/recording_sends_a_single_event.js @@ -0,0 +1,23 @@ +let nock = require('nock'); + +module.exports.hash = "93ae44857b9e0329bc4ac9a07e444214"; + +module.exports.testInfo = {"uniqueName":{"singleEventId":"singleEventId159588373611301458"},"newDate":{"singleEventDate":"2020-07-27T21:02:16.113Z"}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/api/events', [{"id":"singleEventId159588373611301458","subject":"Single 1","data":{"hello":"world"},"eventType":"Azure.Sdk.TestEvent1","eventTime":"2020-07-27T21:02:16.113Z","dataVersion":"1.0"}]) + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Server', + 'Microsoft-HTTPAPI/2.0', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'api-supported-versions', + '2018-01-01', + 'x-ms-request-id', + 'ef70f7ba-868c-4cee-8c9b-e27e2c01409b', + 'Date', + 'Mon, 27 Jul 2020 21:02:16 GMT' +]); diff --git a/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendevents/recording_sends_multiple_events.js b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendevents/recording_sends_multiple_events.js new file mode 100644 index 000000000000..7f892aba5190 --- /dev/null +++ b/sdk/eventgrid/eventgrid/recordings/node/eventgridpublisherclient_sendevents/recording_sends_multiple_events.js @@ -0,0 +1,23 @@ +let nock = require('nock'); + +module.exports.hash = "b8c32c266a21a9129c07d237cc8e3d2b"; + +module.exports.testInfo = {"uniqueName":{"multiEventId1":"multiEventId1159588373643900701","multiEventId2":"multiEventId2159588373643900216"},"newDate":{"multiEventDate1":"2020-07-27T21:02:16.439Z","multiEventDate2":"2020-07-27T21:02:16.439Z"}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/api/events', [{"id":"multiEventId1159588373643900701","subject":"Multiple 1","data":{"hello":"world"},"eventType":"Azure.Sdk.TestEvent1","eventTime":"2020-07-27T21:02:16.439Z","dataVersion":"1.0"},{"id":"multiEventId2159588373643900216","subject":"Multiple 2","data":{"hello":"world"},"eventType":"Azure.Sdk.TestEvent1","eventTime":"2020-07-27T21:02:16.439Z","dataVersion":"1.0"}]) + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Server', + 'Microsoft-HTTPAPI/2.0', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'api-supported-versions', + '2018-01-01', + 'x-ms-request-id', + '2ea7f5e7-f8cf-4051-8b39-353aaa531c12', + 'Date', + 'Mon, 27 Jul 2020 21:02:16 GMT' +]); diff --git a/sdk/eventgrid/eventgrid/review/eventgrid.api.md b/sdk/eventgrid/eventgrid/review/eventgrid.api.md new file mode 100644 index 000000000000..8455b7ee664b --- /dev/null +++ b/sdk/eventgrid/eventgrid/review/eventgrid.api.md @@ -0,0 +1,1114 @@ +## API Report File for "@azure/eventgrid" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AzureKeyCredential } from '@azure/core-auth'; +import { HttpResponse } from '@azure/core-http'; +import { KeyCredential } from '@azure/core-auth'; +import { OperationOptions } from '@azure/core-http'; +import { PipelineOptions } from '@azure/core-http'; + +// @public +export type AppAction = "Restarted" | "Stopped" | "ChangedAppSettings" | "Started" | "Completed" | "Failed"; + +// @public +export interface AppConfigurationKeyValueDeletedEventData { + etag?: string; + key?: string; + label?: string; +} + +// @public +export interface AppConfigurationKeyValueModifiedEventData { + etag?: string; + key?: string; + label?: string; +} + +// @public +export interface AppEventTypeDetail { + action?: AppAction; +} + +// @public +export interface AppServicePlanEventTypeDetail { + action?: "Updated"; + stampKind?: StampKind; + status?: AsyncStatus; +} + +// @public +export type AsyncStatus = "Started" | "Completed" | "Failed"; + +export { AzureKeyCredential } + +// @public +export interface CloudEvent { + data?: T; + datacontenttype?: string; + dataschema?: string; + extensionAttributes?: Record; + id: string; + source: string; + subject?: string; + time?: Date; + type: string; +} + +// @public +export interface ContainerRegistryArtifactEventData { + action?: string; + id?: string; + target?: ContainerRegistryArtifactEventTarget; + timestamp?: Date; +} + +// @public +export interface ContainerRegistryArtifactEventTarget { + digest?: string; + mediaType?: string; + name?: string; + repository?: string; + size?: number; + tag?: string; + version?: string; +} + +// @public +export type ContainerRegistryChartDeletedEventData = ContainerRegistryArtifactEventData & {}; + +// @public +export type ContainerRegistryChartPushedEventData = ContainerRegistryArtifactEventData & {}; + +// @public +export interface ContainerRegistryEventActor { + name?: string; +} + +// @public +export interface ContainerRegistryEventData { + action?: string; + actor?: ContainerRegistryEventActor; + id?: string; + request?: ContainerRegistryEventRequest; + source?: ContainerRegistryEventSource; + target?: ContainerRegistryEventTarget; + timestamp?: Date; +} + +// @public +export interface ContainerRegistryEventRequest { + addr?: string; + host?: string; + id?: string; + method?: string; + useragent?: string; +} + +// @public +export interface ContainerRegistryEventSource { + addr?: string; + instanceID?: string; +} + +// @public +export interface ContainerRegistryEventTarget { + digest?: string; + length?: number; + mediaType?: string; + repository?: string; + size?: number; + tag?: string; + url?: string; +} + +// @public +export type ContainerRegistryImageDeletedEventData = ContainerRegistryEventData & {}; + +// @public +export type ContainerRegistryImagePushedEventData = ContainerRegistryEventData & {}; + +// @public +export type CustomEventDataDeserializer = (o: any) => Promise; + +// @public +export interface DeviceConnectionStateEventInfo { + sequenceNumber?: string; +} + +// @public +export interface DeviceConnectionStateEventProperties { + deviceConnectionStateEventInfo?: DeviceConnectionStateEventInfo; + deviceId?: string; + hubName?: string; + moduleId?: string; +} + +// @public +export interface DeviceLifeCycleEventProperties { + deviceId?: string; + hubName?: string; + twin?: DeviceTwinInfo; +} + +// @public +export interface DeviceTelemetryEventProperties { + body?: any; + properties?: { + [propertyName: string]: string; + }; + systemProperties?: { + [propertyName: string]: string; + }; +} + +// @public +export interface DeviceTwinInfo { + authenticationType?: string; + cloudToDeviceMessageCount?: number; + connectionState?: string; + deviceId?: string; + etag?: string; + lastActivityTime?: string; + properties?: DeviceTwinInfoProperties; + status?: string; + statusUpdateTime?: string; + version?: number; + x509Thumbprint?: DeviceTwinInfoX509Thumbprint; +} + +// @public +export interface DeviceTwinInfoProperties { + desired?: DeviceTwinProperties; + reported?: DeviceTwinProperties; +} + +// @public +export interface DeviceTwinInfoX509Thumbprint { + primaryThumbprint?: string; + secondaryThumbprint?: string; +} + +// @public +export interface DeviceTwinMetadata { + lastUpdated?: string; +} + +// @public +export interface DeviceTwinProperties { + metadata?: DeviceTwinMetadata; + version?: number; +} + +// @public +export class EventGridConsumer { + constructor(options?: EventGridConsumerOptions); + // (undocumented) + readonly customDeserializers: Record; + deserializeCloudEvents(encodedEvents: string): Promise[]>; + deserializeCloudEvents(encodedEvents: object): Promise[]>; + deserializeEventGridEvents(encodedEvents: string): Promise[]>; + deserializeEventGridEvents(encodedEvents: object): Promise[]>; +} + +// @public +export interface EventGridConsumerOptions { + customDeserializers: Record; +} + +// @public +export interface EventGridEvent { + data: T; + dataVersion: string; + eventTime: Date; + eventType: string; + id: string; + subject: string; + topic?: string; +} + +// @public +export class EventGridPublisherClient { + constructor(endpointUrl: string, credential: KeyCredential | SignatureCredential, options?: EventGridPublisherClientOptions); + readonly apiVersion: string; + readonly endpointUrl: string; + sendCloudEvents(events: SendCloudEventInput[], options?: SendCloudEventsOptions): Promise; + sendCustomSchemaEvents(events: Record[], options?: SendCustomSchemaEventsOptions): Promise; + // Warning: (ae-forgotten-export) The symbol "SendEventsResponse" needs to be exported by the entry point index.d.ts + sendEvents(events: SendEventGridEventInput[], options?: SendEventsOptions): Promise; +} + +// @public +export type EventGridPublisherClientOptions = PipelineOptions; + +// @public +export class EventGridSharedAccessSignatureCredential implements SignatureCredential { + constructor(signature: string); + signature(): string; + update(newSignature: string): void; +} + +// @public +export interface EventHubCaptureFileCreatedEventData { + eventCount?: number; + fileType?: string; + fileurl?: string; + firstEnqueueTime?: Date; + firstSequenceNumber?: number; + lastEnqueueTime?: Date; + lastSequenceNumber?: number; + partitionId?: string; + sizeInBytes?: number; +} + +// @public +export function generateSharedAccessSignature(endpointUrl: string, credential: KeyCredential, expiresOnUtc: Date, options?: GenerateSharedAccessSignatureOptions): Promise; + +// @public (undocumented) +export interface GenerateSharedAccessSignatureOptions { + apiVersion?: string; +} + +// @public +export type IotHubDeviceConnectedEventData = DeviceConnectionStateEventProperties & {}; + +// @public +export type IotHubDeviceCreatedEventData = DeviceLifeCycleEventProperties & {}; + +// @public +export type IotHubDeviceDeletedEventData = DeviceLifeCycleEventProperties & {}; + +// @public +export type IotHubDeviceDisconnectedEventData = DeviceConnectionStateEventProperties & {}; + +// @public +export type IotHubDeviceTelemetryEventData = DeviceTelemetryEventProperties & {}; + +// @public +export function isSystemEvent(eventType: T, event: EventGridEvent): event is EventGridEvent; + +// @public +export function isSystemEvent(eventType: T, event: CloudEvent): event is CloudEvent; + +// @public +export type KnownSystemEventTypes = "Microsoft.AppConfiguration.KeyValueDeleted" | "Microsoft.AppConfiguration.KeyValueModified" | "Microsoft.ContainerRegistry.ImagePushed" | "Microsoft.ContainerRegistry.ImageDeleted" | "Microsoft.ContainerRegistry.ChartDeleted" | "Microsoft.ContainerRegistry.ChartPushed" | "Microsoft.Devices.DeviceCreated" | "Microsoft.Devices.DeviceDeleted" | "Microsoft.Devices.DeviceConnected" | "Microsoft.Devices.DeviceDisconnected" | "Microsoft.Devices.DeviceTelemetry" | "Microsoft.EventGrid.SubscriptionValidationEvent" | "Microsoft.EventGrid.SubscriptionDeletedEvent" | "Microsoft.EventHub.CaptureFileCreated" | "Microsoft.MachineLearningServices.DatasetDriftDetected" | "Microsoft.MachineLearningServices.ModelDeployed" | "Microsoft.MachineLearningServices.ModelRegistered" | "Microsoft.MachineLearningServices.RunCompleted" | "Microsoft.MachineLearningServices.RunStatusChanged" | "Microsoft.Maps.GeofenceEntered" | "Microsoft.Maps.GeofenceExited" | "Microsoft.Maps.GeofenceResult" | "Microsoft.Media.JobStateChange" | "Microsoft.Media.JobOutputStateChange" | "Microsoft.Media.JobScheduled" | "Microsoft.Media.JobProcessing" | "Microsoft.Media.JobCanceling" | "Microsoft.Media.JobFinished" | "Microsoft.Media.JobCanceled" | "Microsoft.Media.JobErrored" | "Microsoft.Media.JobOutputCanceled" | "Microsoft.Media.JobOutputCanceling" | "Microsoft.Media.JobOutputErrored" | "Microsoft.Media.JobOutputFinished" | "Microsoft.Media.JobOutputProcessing" | "Microsoft.Media.JobOutputScheduled" | "Microsoft.Media.JobOutputProgress" | "Microsoft.Media.LiveEventEncoderConnected" | "Microsoft.Media.LiveEventConnectionRejected" | "Microsoft.Media.LiveEventEncoderDisconnected" | "Microsoft.Media.LiveEventIncomingStreamReceived" | "Microsoft.Media.LiveEventIncomingStreamsOutOfSync" | "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync" | "Microsoft.Media.LiveEventIncomingDataChunkDropped" | "Microsoft.Media.LiveEventIngestHeartbeat" | "Microsoft.Media.LiveEventTrackDiscontinuityDetected" | "Microsoft.Resources.ResourceWriteSuccess" | "Microsoft.Resources.ResourceWriteFailure" | "Microsoft.Resources.ResourceWriteCancel" | "Microsoft.Resources.ResourceDeleteSuccess" | "Microsoft.Resources.ResourceDeleteFailure" | "Microsoft.Resources.ResourceDeleteCancel" | "Microsoft.Resources.ResourceActionSuccess" | "Microsoft.Resources.ResourceActionFailure" | "Microsoft.Resources.ResourceActionCancel" | "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners" | "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener" | "Microsoft.Storage.BlobCreated" | "Microsoft.Storage.BlobDeleted" | "Microsoft.Storage.BlobRenamed" | "Microsoft.Storage.DirectoryCreated" | "Microsoft.Storage.DirectoryDeleted" | "Microsoft.Storage.DirectoryRenamed" | "Microsoft.Storage.LifecyclePolicyCompleted" | "Microsoft.Web.AppUpdated" | "Microsoft.Web.BackupOperationStarted" | "Microsoft.Web.BackupOperationCompleted" | "Microsoft.Web.BackupOperationFailed" | "Microsoft.Web.RestoreOperationStarted" | "Microsoft.Web.RestoreOperationCompleted" | "Microsoft.Web.RestoreOperationFailed" | "Microsoft.Web.SlotSwapStarted" | "Microsoft.Web.SlotSwapCompleted" | "Microsoft.Web.SlotSwapFailed" | "Microsoft.Web.SlotSwapWithPreviewStarted" | "Microsoft.Web.SlotSwapWithPreviewCancelled" | "Microsoft.Web.AppServicePlanUpdated"; + +// @public +export interface MachineLearningServicesDatasetDriftDetectedEventData { + baseDatasetId?: string; + dataDriftId?: string; + dataDriftName?: string; + driftCoefficient?: number; + endTime?: Date; + runId?: string; + startTime?: Date; + targetDatasetId?: string; +} + +// @public +export interface MachineLearningServicesModelDeployedEventData { + modelIds?: string; + serviceComputeType?: string; + serviceName?: string; + serviceProperties?: any; + serviceTags?: any; +} + +// @public +export interface MachineLearningServicesModelRegisteredEventData { + modelName?: string; + modelProperties?: any; + modelTags?: any; + modelVersion?: string; +} + +// @public +export interface MachineLearningServicesRunCompletedEventData { + experimentId?: string; + experimentName?: string; + runId?: string; + runProperties?: any; + runTags?: any; + runType?: string; +} + +// @public +export interface MachineLearningServicesRunStatusChangedEventData { + experimentId?: string; + experimentName?: string; + runId?: string; + runProperties?: any; + runStatus?: string; + runTags?: any; + runType?: string; +} + +// @public +export type MapsGeofenceEnteredEventData = MapsGeofenceEventProperties & {}; + +// @public +export interface MapsGeofenceEventProperties { + expiredGeofenceGeometryId?: string[]; + geometries?: MapsGeofenceGeometry[]; + invalidPeriodGeofenceGeometryId?: string[]; + isEventPublished?: boolean; +} + +// @public +export type MapsGeofenceExitedEventData = MapsGeofenceEventProperties & {}; + +// @public +export interface MapsGeofenceGeometry { + deviceId?: string; + distance?: number; + geometryId?: string; + nearestLat?: number; + nearestLon?: number; + udId?: string; +} + +// @public +export type MapsGeofenceResultEventData = MapsGeofenceEventProperties & {}; + +// @public +export type MediaJobCanceledEventData = MediaJobStateChangeEventData & { + outputs?: MediaJobOutputUnion[]; +}; + +// @public +export type MediaJobCancelingEventData = MediaJobStateChangeEventData & {}; + +// @public +export interface MediaJobError { + readonly category?: MediaJobErrorCategory; + readonly code?: MediaJobErrorCode; + readonly details?: MediaJobErrorDetail[]; + readonly message?: string; + readonly retry?: MediaJobRetry; +} + +// @public +export type MediaJobErrorCategory = "Service" | "Download" | "Upload" | "Configuration" | "Content"; + +// @public +export type MediaJobErrorCode = "ServiceError" | "ServiceTransientError" | "DownloadNotAccessible" | "DownloadTransientError" | "UploadNotAccessible" | "UploadTransientError" | "ConfigurationUnsupported" | "ContentMalformed" | "ContentUnsupported"; + +// @public +export interface MediaJobErrorDetail { + readonly code?: string; + readonly message?: string; +} + +// @public +export type MediaJobErroredEventData = MediaJobStateChangeEventData & { + outputs?: MediaJobOutputUnion[]; +}; + +// @public +export type MediaJobFinishedEventData = MediaJobStateChangeEventData & { + outputs?: MediaJobOutputUnion[]; +}; + +// @public +export interface MediaJobOutput { + "@odata.type": "#Microsoft.Media.JobOutputAsset"; + error?: MediaJobError; + label?: string; + odataType?: string; + progress: number; + state: MediaJobState; +} + +// @public +export type MediaJobOutputAsset = MediaJobOutput & { + assetName?: string; +}; + +// @public +export type MediaJobOutputCanceledEventData = MediaJobOutputStateChangeEventData & {}; + +// @public +export type MediaJobOutputCancelingEventData = MediaJobOutputStateChangeEventData & {}; + +// @public +export type MediaJobOutputErroredEventData = MediaJobOutputStateChangeEventData & {}; + +// @public +export type MediaJobOutputFinishedEventData = MediaJobOutputStateChangeEventData & {}; + +// @public +export type MediaJobOutputProcessingEventData = MediaJobOutputStateChangeEventData & {}; + +// @public +export interface MediaJobOutputProgressEventData { + jobCorrelationData?: { + [propertyName: string]: string; + }; + label?: string; + progress?: number; +} + +// @public +export type MediaJobOutputScheduledEventData = MediaJobOutputStateChangeEventData & {}; + +// @public +export interface MediaJobOutputStateChangeEventData { + jobCorrelationData?: { + [propertyName: string]: string; + }; + output?: MediaJobOutputUnion; + readonly previousState?: MediaJobState; +} + +// @public (undocumented) +export type MediaJobOutputUnion = MediaJobOutput | MediaJobOutputAsset; + +// @public +export type MediaJobProcessingEventData = MediaJobStateChangeEventData & {}; + +// @public +export type MediaJobRetry = "DoNotRetry" | "MayRetry"; + +// @public +export type MediaJobScheduledEventData = MediaJobStateChangeEventData & {}; + +// @public +export type MediaJobState = "Canceled" | "Canceling" | "Error" | "Finished" | "Processing" | "Queued" | "Scheduled"; + +// @public +export interface MediaJobStateChangeEventData { + correlationData?: { + [propertyName: string]: string; + }; + readonly previousState?: MediaJobState; + readonly state?: MediaJobState; +} + +// @public +export interface MediaLiveEventConnectionRejectedEventData { + readonly encoderIp?: string; + readonly encoderPort?: string; + readonly ingestUrl?: string; + readonly resultCode?: string; + readonly streamId?: string; +} + +// @public +export interface MediaLiveEventEncoderConnectedEventData { + readonly encoderIp?: string; + readonly encoderPort?: string; + readonly ingestUrl?: string; + readonly streamId?: string; +} + +// @public +export interface MediaLiveEventEncoderDisconnectedEventData { + readonly encoderIp?: string; + readonly encoderPort?: string; + readonly ingestUrl?: string; + readonly resultCode?: string; + readonly streamId?: string; +} + +// @public +export interface MediaLiveEventIncomingDataChunkDroppedEventData { + readonly bitrate?: number; + readonly resultCode?: string; + readonly timescale?: string; + readonly timestamp?: string; + readonly trackName?: string; + readonly trackType?: string; +} + +// @public +export interface MediaLiveEventIncomingStreamReceivedEventData { + readonly bitrate?: number; + readonly duration?: string; + readonly encoderIp?: string; + readonly encoderPort?: string; + readonly ingestUrl?: string; + readonly timescale?: string; + readonly timestamp?: string; + readonly trackName?: string; + readonly trackType?: string; +} + +// @public +export interface MediaLiveEventIncomingStreamsOutOfSyncEventData { + readonly maxLastTimestamp?: string; + readonly minLastTimestamp?: string; + readonly timescaleOfMaxLastTimestamp?: string; + readonly timescaleOfMinLastTimestamp?: string; + readonly typeOfStreamWithMaxLastTimestamp?: string; + readonly typeOfStreamWithMinLastTimestamp?: string; +} + +// @public +export interface MediaLiveEventIncomingVideoStreamsOutOfSyncEventData { + readonly firstDuration?: string; + readonly firstTimestamp?: string; + readonly secondDuration?: string; + readonly secondTimestamp?: string; + readonly timescale?: string; +} + +// @public +export interface MediaLiveEventIngestHeartbeatEventData { + readonly bitrate?: number; + readonly discontinuityCount?: number; + readonly healthy?: boolean; + readonly incomingBitrate?: number; + readonly lastTimestamp?: string; + readonly nonincreasingCount?: number; + readonly overlapCount?: number; + readonly state?: string; + readonly timescale?: string; + readonly trackName?: string; + readonly trackType?: string; + readonly unexpectedBitrate?: boolean; +} + +// @public +export interface MediaLiveEventTrackDiscontinuityDetectedEventData { + readonly bitrate?: number; + readonly discontinuityGap?: string; + readonly newTimestamp?: string; + readonly previousTimestamp?: string; + readonly timescale?: string; + readonly trackName?: string; + readonly trackType?: string; +} + +// @public +export interface ResourceActionCancelEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceActionFailureEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceActionSuccessEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceDeleteCancelEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceDeleteFailureEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceDeleteSuccessEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceWriteCancelEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceWriteFailureEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface ResourceWriteSuccessEventData { + authorization?: string; + claims?: string; + correlationId?: string; + httpRequest?: string; + operationName?: string; + resourceGroup?: string; + resourceProvider?: string; + resourceUri?: string; + status?: string; + subscriptionId?: string; + tenantId?: string; +} + +// @public +export interface SendCloudEventInput { + data?: T; + datacontenttype?: string; + dataschema?: string; + extensionAttributes?: Record; + id?: string; + source: string; + subject?: string; + time?: Date; + type: string; +} + +// @public +export type SendCloudEventsOptions = OperationOptions; + +// @public +export type SendCustomSchemaEventsOptions = OperationOptions; + +// @public +export interface SendEventGridEventInput { + data: T; + dataVersion: string; + eventTime?: Date; + eventType: string; + id?: string; + subject: string; + topic?: string; +} + +// @public +export type SendEventsOptions = OperationOptions; + +// @public +export interface ServiceBusActiveMessagesAvailableWithNoListenersEventData { + entityType?: string; + namespaceName?: string; + queueName?: string; + requestUri?: string; + subscriptionName?: string; + topicName?: string; +} + +// @public +export interface ServiceBusDeadletterMessagesAvailableWithNoListenersEventData { + entityType?: string; + namespaceName?: string; + queueName?: string; + requestUri?: string; + subscriptionName?: string; + topicName?: string; +} + +// @public +export interface SignatureCredential { + signature(): string; +} + +// @public +export type StampKind = "Public" | "AseV1" | "AseV2"; + +// @public +export interface StorageBlobCreatedEventData { + api?: string; + blobType?: string; + clientRequestId?: string; + contentLength?: number; + contentOffset?: number; + contentType?: string; + eTag?: string; + identity?: string; + requestId?: string; + sequencer?: string; + storageDiagnostics?: any; + url?: string; +} + +// @public +export interface StorageBlobDeletedEventData { + api?: string; + blobType?: string; + clientRequestId?: string; + contentType?: string; + identity?: string; + requestId?: string; + sequencer?: string; + storageDiagnostics?: any; + url?: string; +} + +// @public +export interface StorageBlobRenamedEventData { + api?: string; + clientRequestId?: string; + destinationUrl?: string; + identity?: string; + requestId?: string; + sequencer?: string; + sourceUrl?: string; + storageDiagnostics?: any; +} + +// @public +export interface StorageDirectoryCreatedEventData { + api?: string; + clientRequestId?: string; + eTag?: string; + identity?: string; + requestId?: string; + sequencer?: string; + storageDiagnostics?: any; + url?: string; +} + +// @public +export interface StorageDirectoryDeletedEventData { + api?: string; + clientRequestId?: string; + identity?: string; + recursive?: boolean; + requestId?: string; + sequencer?: string; + storageDiagnostics?: any; + url?: string; +} + +// @public +export interface StorageDirectoryRenamedEventData { + api?: string; + clientRequestId?: string; + destinationUrl?: string; + identity?: string; + requestId?: string; + sequencer?: string; + sourceUrl?: string; + storageDiagnostics?: any; +} + +// @public +export interface StorageLifecyclePolicyCompletedEventData { + // Warning: (ae-forgotten-export) The symbol "StorageLifecyclePolicyActionSummaryDetail" needs to be exported by the entry point index.d.ts + deleteSummary?: StorageLifecyclePolicyActionSummaryDetail; + scheduleTime?: string; + tierToArchiveSummary?: StorageLifecyclePolicyActionSummaryDetail; + tierToCoolSummary?: StorageLifecyclePolicyActionSummaryDetail; +} + +// @public +export interface SubscriptionDeletedEventData { + readonly eventSubscriptionId?: string; +} + +// @public +export interface SubscriptionValidationEventData { + readonly validationCode?: string; + readonly validationUrl?: string; +} + +// @public +export interface SystemEventNameToEventData { + "Microsoft.AppConfiguration.KeyValueDeleted": AppConfigurationKeyValueDeletedEventData; + "Microsoft.AppConfiguration.KeyValueModified": AppConfigurationKeyValueModifiedEventData; + "Microsoft.ContainerRegistry.ChartDeleted": ContainerRegistryChartDeletedEventData; + "Microsoft.ContainerRegistry.ChartPushed": ContainerRegistryChartPushedEventData; + "Microsoft.ContainerRegistry.ImageDeleted": ContainerRegistryImageDeletedEventData; + "Microsoft.ContainerRegistry.ImagePushed": ContainerRegistryImagePushedEventData; + "Microsoft.Devices.DeviceConnected": IotHubDeviceConnectedEventData; + "Microsoft.Devices.DeviceCreated": IotHubDeviceCreatedEventData; + "Microsoft.Devices.DeviceDeleted": IotHubDeviceDeletedEventData; + "Microsoft.Devices.DeviceDisconnected": IotHubDeviceDisconnectedEventData; + "Microsoft.Devices.DeviceTelemetry": IotHubDeviceTelemetryEventData; + "Microsoft.EventGrid.SubscriptionDeletedEvent": SubscriptionDeletedEventData; + "Microsoft.EventGrid.SubscriptionValidationEvent": SubscriptionValidationEventData; + "Microsoft.EventHub.CaptureFileCreated": EventHubCaptureFileCreatedEventData; + "Microsoft.MachineLearningServices.DatasetDriftDetected": MachineLearningServicesDatasetDriftDetectedEventData; + "Microsoft.MachineLearningServices.ModelDeployed": MachineLearningServicesModelDeployedEventData; + "Microsoft.MachineLearningServices.ModelRegistered": MachineLearningServicesModelRegisteredEventData; + "Microsoft.MachineLearningServices.RunCompleted": MachineLearningServicesRunCompletedEventData; + "Microsoft.MachineLearningServices.RunStatusChanged": MachineLearningServicesRunStatusChangedEventData; + "Microsoft.Maps.GeofenceEntered": MapsGeofenceEnteredEventData; + "Microsoft.Maps.GeofenceExited": MapsGeofenceExitedEventData; + "Microsoft.Maps.GeofenceResult": MapsGeofenceResultEventData; + "Microsoft.Media.JobCanceled": MediaJobCanceledEventData; + "Microsoft.Media.JobCanceling": MediaJobCancelingEventData; + "Microsoft.Media.JobErrored": MediaJobErroredEventData; + "Microsoft.Media.JobFinished": MediaJobFinishedEventData; + "Microsoft.Media.JobOutputCanceled": MediaJobOutputCanceledEventData; + "Microsoft.Media.JobOutputCanceling": MediaJobOutputCancelingEventData; + "Microsoft.Media.JobOutputErrored": MediaJobOutputErroredEventData; + "Microsoft.Media.JobOutputFinished": MediaJobOutputFinishedEventData; + "Microsoft.Media.JobOutputProcessing": MediaJobOutputProcessingEventData; + "Microsoft.Media.JobOutputProgress": MediaJobOutputProgressEventData; + "Microsoft.Media.JobOutputScheduled": MediaJobOutputScheduledEventData; + "Microsoft.Media.JobOutputStateChange": MediaJobOutputStateChangeEventData; + "Microsoft.Media.JobProcessing": MediaJobProcessingEventData; + "Microsoft.Media.JobScheduled": MediaJobScheduledEventData; + "Microsoft.Media.JobStateChange": MediaJobStateChangeEventData; + "Microsoft.Media.LiveEventConnectionRejected": MediaLiveEventConnectionRejectedEventData; + "Microsoft.Media.LiveEventEncoderConnected": MediaLiveEventEncoderConnectedEventData; + "Microsoft.Media.LiveEventEncoderDisconnected": MediaLiveEventEncoderDisconnectedEventData; + "Microsoft.Media.LiveEventIncomingDataChunkDropped": MediaLiveEventIncomingDataChunkDroppedEventData; + "Microsoft.Media.LiveEventIncomingStreamReceived": MediaLiveEventIncomingStreamReceivedEventData; + "Microsoft.Media.LiveEventIncomingStreamsOutOfSync": MediaLiveEventIncomingStreamsOutOfSyncEventData; + "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync": MediaLiveEventIncomingVideoStreamsOutOfSyncEventData; + "Microsoft.Media.LiveEventIngestHeartbeat": MediaLiveEventIngestHeartbeatEventData; + "Microsoft.Media.LiveEventTrackDiscontinuityDetected": MediaLiveEventTrackDiscontinuityDetectedEventData; + "Microsoft.Resources.ResourceActionCancel": ResourceActionCancelEventData; + "Microsoft.Resources.ResourceActionFailure": ResourceActionFailureEventData; + "Microsoft.Resources.ResourceActionSuccess": ResourceActionSuccessEventData; + "Microsoft.Resources.ResourceDeleteCancel": ResourceDeleteCancelEventData; + "Microsoft.Resources.ResourceDeleteFailure": ResourceDeleteFailureEventData; + "Microsoft.Resources.ResourceDeleteSuccess": ResourceDeleteSuccessEventData; + "Microsoft.Resources.ResourceWriteCancel": ResourceWriteCancelEventData; + "Microsoft.Resources.ResourceWriteFailure": ResourceWriteFailureEventData; + "Microsoft.Resources.ResourceWriteSuccess": ResourceWriteSuccessEventData; + "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners": ServiceBusActiveMessagesAvailableWithNoListenersEventData; + "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener": ServiceBusDeadletterMessagesAvailableWithNoListenersEventData; + "Microsoft.Storage.BlobCreated": StorageBlobCreatedEventData; + "Microsoft.Storage.BlobDeleted": StorageBlobDeletedEventData; + "Microsoft.Storage.BlobRenamed": StorageBlobRenamedEventData; + "Microsoft.Storage.DirectoryCreated": StorageDirectoryCreatedEventData; + "Microsoft.Storage.DirectoryDeleted": StorageDirectoryDeletedEventData; + "Microsoft.Storage.DirectoryRenamed": StorageDirectoryRenamedEventData; + "Microsoft.Storage.LifecyclePolicyCompleted": StorageLifecyclePolicyCompletedEventData; + "Microsoft.Web.AppServicePlanUpdated": WebAppServicePlanUpdatedEventData; + "Microsoft.Web.AppUpdated": WebAppUpdatedEventData; + "Microsoft.Web.BackupOperationCompleted": WebBackupOperationCompletedEventData; + "Microsoft.Web.BackupOperationFailed": WebBackupOperationFailedEventData; + "Microsoft.Web.BackupOperationStarted": WebBackupOperationStartedEventData; + "Microsoft.Web.RestoreOperationCompleted": WebRestoreOperationCompletedEventData; + "Microsoft.Web.RestoreOperationFailed": WebRestoreOperationFailedEventData; + "Microsoft.Web.RestoreOperationStarted": WebRestoreOperationStartedEventData; + "Microsoft.Web.SlotSwapCompleted": WebSlotSwapCompletedEventData; + "Microsoft.Web.SlotSwapFailed": WebSlotSwapFailedEventData; + "Microsoft.Web.SlotSwapStarted": WebSlotSwapStartedEventData; + "Microsoft.Web.SlotSwapWithPreviewCancelled": WebSlotSwapWithPreviewCancelledEventData; + "Microsoft.Web.SlotSwapWithPreviewStarted": WebSlotSwapWithPreviewStartedEventData; +} + +// @public +export interface WebAppServicePlanUpdatedEventData { + address?: string; + appServicePlanEventTypeDetail?: AppServicePlanEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + sku?: WebAppServicePlanUpdatedEventDataSku; + verb?: string; +} + +// @public +export interface WebAppServicePlanUpdatedEventDataSku { + capacity?: string; + family?: string; + name?: string; + size?: string; + tier?: string; +} + +// @public +export interface WebAppUpdatedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebBackupOperationCompletedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebBackupOperationFailedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebBackupOperationStartedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebRestoreOperationCompletedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebRestoreOperationFailedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebRestoreOperationStartedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebSlotSwapCompletedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebSlotSwapFailedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebSlotSwapStartedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebSlotSwapWithPreviewCancelledEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + +// @public +export interface WebSlotSwapWithPreviewStartedEventData { + address?: string; + appEventTypeDetail?: AppEventTypeDetail; + clientRequestId?: string; + correlationRequestId?: string; + name?: string; + requestId?: string; + verb?: string; +} + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/eventgrid/eventgrid/rollup.base.config.js b/sdk/eventgrid/eventgrid/rollup.base.config.js new file mode 100644 index 000000000000..3ddc3cbf7a42 --- /dev/null +++ b/sdk/eventgrid/eventgrid/rollup.base.config.js @@ -0,0 +1,134 @@ +import path from "path"; +import nodeResolve from "@rollup/plugin-node-resolve"; +import multiEntry from "@rollup/plugin-multi-entry"; +import cjs from "@rollup/plugin-commonjs"; +import replace from "@rollup/plugin-replace"; +import shim from "rollup-plugin-shim"; +import { terser } from "rollup-plugin-terser"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import viz from "rollup-plugin-visualizer"; + +const pkg = require("./package.json"); +const depNames = Object.keys(pkg.dependencies); +const devDepNames = Object.keys(pkg.devDependencies); +const input = "dist-esm/src/index.js"; +const production = process.env.NODE_ENV === "production"; + +export function nodeConfig(test = false) { + const externalNodeBuiltins = []; + const baseConfig = { + input: input, + external: depNames.concat(externalNodeBuiltins), + output: { file: "dist/src/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [ + sourcemaps(), + replace({ + delimiters: ["", ""], + values: { + // replace dynamic checks with if (true) since this is for node only. + // Allows rollup's dead code elimination to be more aggressive. + "if (isNode)": "if (true)" + } + }), + nodeResolve({ preferBuiltins: true }), + cjs() + ] + }; + + if (test) { + // Entry points - test files under the `test` folder(common for both browser and node), node specific test files + baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/node/*.spec.js"]; + baseConfig.plugins.unshift(multiEntry({ exports: false })); + + // different output file + baseConfig.output.file = "dist-test/index.node.js"; + + // mark devdeps as external + baseConfig.external.push(...devDepNames); + + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting + // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also + // applies to test code, which causes all tests to be removed by tree-shaking. + baseConfig.treeshake = false; + } else if (production) { + baseConfig.plugins.push(terser()); + } + + return baseConfig; +} + +export function browserConfig(test = false, production = false) { + const baseConfig = { + input: input, + output: { + file: "dist-browser/azure-eventgrid.js", + format: "umd", + name: "Azure.MessagingEventGrid", + sourcemap: true, + globals: { "@azure/core-http": "Azure.Core.HTTP" } + }, + preserveSymlinks: false, + external: ["fs-extra"], + plugins: [ + sourcemaps(), + replace({ + delimiters: ["", ""], + values: { + // replace dynamic checks with if (false) since this is for + // browser only. Rollup's dead code elimination will remove + // any code guarded by if (isNode) { ... } + "if (isNode)": "if (false)" + } + }), + shim({ + constants: `export default {}`, + fs: `export default {}`, + os: `export default {}`, + dotenv: `export function config() { }`, + path: `export default {}` + }), + nodeResolve({ + mainFields: ["module", "browser"], + preferBuiltins: false + }), + cjs({ + namedExports: { + chai: ["assert", "expect", "use"], + events: ["EventEmitter"], + "@opentelemetry/api": ["CanonicalCode", "SpanKind", "TraceFlags"] + } + }), + viz({ filename: "dist-browser/browser-stats.html", sourcemap: false }) + ] + }; + + if (test) { + // Entry points - test files under the `test` folder(common for both browser and node), browser specific test files + baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/browser/*.spec.js"]; + baseConfig.plugins.unshift(multiEntry({ exports: false })); + baseConfig.output.file = "dist-test/index.browser.js"; + + baseConfig.onwarn = (warning) => { + if ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer.indexOf(path.normalize("node_modules/chai/lib") === 0) + ) { + // Chai contains circular references, but they are not fatal and can be ignored. + return; + } + + console.error(`(!) ${warning.message}`); + }; + + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting + // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also + // applies to test code, which causes all tests to be removed by tree-shaking. + baseConfig.treeshake = false; + } else if (production) { + baseConfig.output.file = "dist-browser/azure-eventgrid.min.js"; + baseConfig.plugins.push(terser()); + } + + return baseConfig; +} diff --git a/sdk/eventgrid/eventgrid/rollup.config.js b/sdk/eventgrid/eventgrid/rollup.config.js index 6425b241b4b4..49a26bd6fdd6 100644 --- a/sdk/eventgrid/eventgrid/rollup.config.js +++ b/sdk/eventgrid/eventgrid/rollup.config.js @@ -1,37 +1,14 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; +import * as base from "./rollup.base.config"; -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/eventGridClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/eventgrid.js", - format: "umd", - name: "Azure.Eventgrid", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] -}; +const inputs = []; -export default config; +if (!process.env.ONLY_BROWSER) { + inputs.push(base.nodeConfig()); +} + +if (!process.env.ONLY_NODE) { + inputs.push(base.browserConfig()); + inputs.push(base.browserConfig(false, true)); +} + +export default inputs; diff --git a/sdk/eventgrid/eventgrid/rollup.test.config.js b/sdk/eventgrid/eventgrid/rollup.test.config.js new file mode 100644 index 000000000000..925a4421a53e --- /dev/null +++ b/sdk/eventgrid/eventgrid/rollup.test.config.js @@ -0,0 +1,3 @@ +import * as base from "./rollup.base.config"; + +export default [base.nodeConfig(true), base.browserConfig(true)]; diff --git a/sdk/eventgrid/eventgrid/sample.env b/sdk/eventgrid/eventgrid/sample.env new file mode 100644 index 000000000000..7475a57f5e34 --- /dev/null +++ b/sdk/eventgrid/eventgrid/sample.env @@ -0,0 +1,18 @@ +# An Event Grid Topic configured to use the Event Grid Schema +EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT="https://..eventgrid.azure.net/api/events" +EVENT_GRID_EVENT_GRID_SCHEMA_API_KEY="" + +# An Event Grid Topic configured to use the Cloud Event 1.0 Schema. +EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT="https://..eventgrid.azure.net/api/events" +EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY="" + +# An Event Grid Topic configured to use a custom schema, the topic should be configured with the following mappings: +# typ -> eventType +# sub -> subject +# ver -> dataVersion +EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT="https://..eventgrid.azure.net/api/events" +EVENT_GRID_CUSTOM_SCHEMA_API_KEY="" + +# Our tests assume that TEST_MODE is "playback" by default. You can +# change it to "record" to generate new recordings, or "live" to bypass the recorder entirely. +# TEST_MODE=playback diff --git a/sdk/eventgrid/eventgrid/src/constants.ts b/sdk/eventgrid/eventgrid/src/constants.ts new file mode 100644 index 000000000000..d0be2d9e825b --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/constants.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export const SDK_VERSION: string = "3.0.0-preview.1"; +export const DEFAULT_API_VERSION = "2018-01-01"; diff --git a/sdk/eventgrid/eventgrid/src/consumer.ts b/sdk/eventgrid/eventgrid/src/consumer.ts new file mode 100644 index 000000000000..dcb69aafd1fa --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/consumer.ts @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Serializer } from "@azure/core-http"; +import { CloudEvent as WireCloudEvent } from "./generated/models"; +import { + CustomEventDataDeserializer, + CloudEvent, + EventGridEvent, + cloudEventReservedPropertyNames +} from "./models"; +import { + EventGridEvent as EventGridEventMapper, + CloudEvent as CloudEventMapper +} from "./generated/models/mappers"; +import { parseAndWrap, validateEventGridEvent, validateCloudEventEvent } from "./util"; +import { systemDeserializers } from "./systemEventDecoders"; + +const serializer = new Serializer(); + +/** + * Options for the Event Grid Consumer + */ +export interface EventGridConsumerOptions { + /** + * Custom deserializers to use when decoding a specific event's data, based on the type + * field of the event. + */ + customDeserializers: Record; +} + +/** + * EventGridConsumer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload + * of either a single event or batch of events as well as be used to convert the result of `JSON.parse` into an + * `EventGridEvent` or `CloudEvent` like object. + * + * Unlike normal JSON deseralization, EventGridConsumer does some additional conversions: + * + * - The consumer parses the event time property into a `Date` object, for ease of use. + * - When deserializing an event in the CloudEvent schema, if the event contains binary data, it is base64 decoded + * and returned as an instance of the `Uint8Array` type. + * - The `data` payload from system events is converted to match the interfaces this library defines. + * + * When constructing an `EventGridConsumer`, a map of event types to custom deserializers may be provided. When + * deserializing, if a custom deserializer has been registered for a given event type, it will be called with the + * data object. The object this deserializer returns will replace the existing data object. + */ +export class EventGridConsumer { + readonly customDeserializers: Record; + constructor(options?: EventGridConsumerOptions) { + this.customDeserializers = options?.customDeserializers ?? {}; + } + + /** + * Deserializes events encoded in the Event Grid schema. + * + * @param encodedEvents the JSON encoded representation of either a single event or an array of + * events, encoded in the Event Grid Schema. + */ + public async deserializeEventGridEvents( + encodedEvents: string + ): Promise[]>; + + /** + * Deserializes events encoded in the Event Grid schema. + * + * @param encodedEvents an object representing a single event, encoded in the Event Grid schema. + */ + public async deserializeEventGridEvents( + encodedEvents: object + ): Promise[]>; + public async deserializeEventGridEvents( + encodedEvents: string | object + ): Promise[]> { + const decodedArray = parseAndWrap(encodedEvents); + + const events: EventGridEvent[] = []; + + for (const o of decodedArray) { + validateEventGridEvent(o); + + const deserialized: EventGridEvent = serializer.deserialize(EventGridEventMapper, o, ""); + + if (systemDeserializers[deserialized.eventType]) { + deserialized.data = await systemDeserializers[deserialized.eventType](deserialized.data); + } else if (this.customDeserializers[deserialized.eventType]) { + deserialized.data = await this.customDeserializers[deserialized.eventType]( + deserialized.data + ); + } + + events.push(deserialized as EventGridEvent); + } + + return events; + } + + /** + * Deserializes events encoded in the Cloud Events 1.0 schema. + * + * @param encodedEvents the JSON encoded representation of either a single event or an array of + * events, encoded in the Cloud Events 1.0 Schema. + */ + public async deserializeCloudEvents(encodedEvents: string): Promise[]>; + + /** + * Deserializes events encoded in the Cloud Events 1.0 schema. + * + * @param encodedEvents an object representing a single event, encoded in the Cloud Events 1.0 schema. + */ + public async deserializeCloudEvents(encodedEvents: object): Promise[]>; + public async deserializeCloudEvents( + encodedEvents: string | object + ): Promise[]> { + const decodedArray = parseAndWrap(encodedEvents); + + const events: CloudEvent[] = []; + + for (const o of decodedArray) { + validateCloudEventEvent(o); + + // Check that the required fields are present and of the correct type and the optional fields are missing + // or of the correct type. + + const deserialized: WireCloudEvent = serializer.deserialize(CloudEventMapper, o, ""); + const modelEvent: Record = { + specversion: deserialized.specversion, + id: deserialized.id, + source: deserialized.source, + type: deserialized.type + }; + + if (deserialized.datacontenttype !== undefined) { + modelEvent.datacontenttype = deserialized.datacontenttype; + } + + if (deserialized.dataschema !== undefined) { + modelEvent.dataschema = deserialized.dataschema; + } + + if (deserialized.subject !== undefined) { + modelEvent.subject = deserialized.subject; + } + + if (deserialized.time !== undefined) { + modelEvent.time = deserialized.time; + } + + if (deserialized.data !== undefined) { + modelEvent.data = deserialized.data; + } + + // If the data the event represents binary, it is encoded as base64 text in a different property on the event and we need to transform it. + if (deserialized.dataBase64 !== undefined) { + if (deserialized.data !== undefined) { + throw new TypeError("event contains both a data and data_base64 field"); + } + + if (!(deserialized.dataBase64 instanceof Uint8Array)) { + throw new TypeError("event data_base64 property is invalid"); + } + + modelEvent.data = deserialized.dataBase64; + } + + // If a decoder is registered, apply it to the data. + if (systemDeserializers[modelEvent.type]) { + modelEvent.data = await systemDeserializers[modelEvent.type](modelEvent.data); + } else if (this.customDeserializers[modelEvent.type]) { + modelEvent.data = await this.customDeserializers[modelEvent.type](modelEvent.data); + } + + // Build the "extensionsAttributes" property bag by removing all known top level properties. + const extensionAttributes = { ...deserialized }; + for (const propName of cloudEventReservedPropertyNames) { + delete extensionAttributes[propName]; + } + delete extensionAttributes.dataBase64; + + // If any properties remain, copy them to the model. + if (Object.keys(extensionAttributes).length > 0) { + modelEvent.extensionAttributes = extensionAttributes; + } + + events.push(modelEvent as CloudEvent); + } + + return events; + } +} diff --git a/sdk/eventgrid/eventgrid/src/cryptoHelpers.browser.ts b/sdk/eventgrid/eventgrid/src/cryptoHelpers.browser.ts new file mode 100644 index 000000000000..e9c2986d66a0 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/cryptoHelpers.browser.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/// + +/** + * @internal + * @ignore + */ +export async function sha256Hmac(secret: string, stringToSign: string): Promise { + const key = await self.crypto.subtle.importKey( + "raw", + Uint8Array.from(atob(secret), (c) => c.charCodeAt(0)), + { + name: "HMAC", + hash: "SHA-256" + }, + false, + ["sign"] + ); + + const sigArray = await self.crypto.subtle.sign( + "HMAC", + key, + new TextEncoder().encode(stringToSign) + ); + + // The conversions here are a bit odd but necessary (see "Unicode strings" in the link below) + // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa + return btoa(String.fromCharCode(...new Uint8Array(sigArray))); +} diff --git a/sdk/eventgrid/eventgrid/src/cryptoHelpers.ts b/sdk/eventgrid/eventgrid/src/cryptoHelpers.ts new file mode 100644 index 000000000000..85f2feb312ee --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/cryptoHelpers.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createHmac } from "crypto"; + +/** + * @internal + * @ignore + */ +export async function sha256Hmac(secret: string, stringToSign: string): Promise { + const decodedSecret = Buffer.from(secret, "base64"); + + return createHmac("sha256", decodedSecret) + .update(stringToSign) + .digest("base64"); +} diff --git a/sdk/eventgrid/eventgrid/src/eventGridAuthenticationPolicy.ts b/sdk/eventgrid/eventgrid/src/eventGridAuthenticationPolicy.ts new file mode 100644 index 000000000000..95896bb83492 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/eventGridAuthenticationPolicy.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyCredential } from "@azure/core-auth"; +import { + RequestPolicyFactory, + RequestPolicy, + BaseRequestPolicy, + WebResourceLike, + HttpOperationResponse, + RequestPolicyOptionsLike +} from "@azure/core-http"; + +import { SignatureCredential } from "./sharedAccessSignitureCredential"; +import { isKeyCredentialLike } from "./util"; + +/** + * The name of the header to include when a Shared Key is used for authentication. + */ +const API_KEY_HEADER_NAME = "aeg-sas-key"; + +/** + * The name of the header to include when Shared Access Signature is used for authentication. + */ +const SAS_TOKEN_HEADER_NAME = "aeg-sas-token"; + +/** + * Create an HTTP pipeline policy to authenticate a request + * using an `AzureKeyCredential` for Event Grid + */ +export function createEventGridCredentialPolicy( + credential: KeyCredential | SignatureCredential +): RequestPolicyFactory { + return { + create: (nextPolicy: RequestPolicy, options: RequestPolicyOptionsLike) => { + return new EventGridAzureKeyCredentialPolicy(nextPolicy, options, credential); + } + }; +} + +/** + * A concrete implementation of an AzureKeyCredential policy + * using the appropriate header for Event Grid + */ +class EventGridAzureKeyCredentialPolicy extends BaseRequestPolicy { + private credential: KeyCredential | SignatureCredential; + + constructor( + nextPolicy: RequestPolicy, + options: RequestPolicyOptionsLike, + credential: KeyCredential | SignatureCredential + ) { + super(nextPolicy, options); + this.credential = credential; + } + + public async sendRequest(webResource: WebResourceLike): Promise { + if (!webResource) { + throw new Error("webResource cannot be null or undefined"); + } + + if (isKeyCredentialLike(this.credential)) { + webResource.headers.set(API_KEY_HEADER_NAME, this.credential.key); + } else { + webResource.headers.set(SAS_TOKEN_HEADER_NAME, this.credential.signature()); + } + + return this._nextPolicy.sendRequest(webResource); + } +} diff --git a/sdk/eventgrid/eventgrid/src/eventGridClient.ts b/sdk/eventgrid/eventgrid/src/eventGridClient.ts index 2405169a7c16..04992c0421e3 100644 --- a/sdk/eventgrid/eventgrid/src/eventGridClient.ts +++ b/sdk/eventgrid/eventgrid/src/eventGridClient.ts @@ -1,106 +1,241 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyCredential } from "@azure/core-auth"; +import { + PipelineOptions, + createPipelineFromOptions, + OperationOptions, + generateUuid, + HttpResponse +} from "@azure/core-http"; + +import { createEventGridCredentialPolicy } from "./eventGridAuthenticationPolicy"; +import { SignatureCredential } from "./sharedAccessSignitureCredential"; +import { SDK_VERSION } from "./constants"; +import { + SendCloudEventInput, + SendEventGridEventInput, + cloudEventReservedPropertyNames +} from "./models"; +import { GeneratedClient } from "./generated/generatedClient"; +import { + CloudEvent as CloudEventWireModel, + EventGridEvent as EventGridEventWireModel +} from "./generated/models"; + +/** + * Options for the Event Grid Client. + */ +export type EventGridPublisherClientOptions = PipelineOptions; + +/** + * Options for the send events operation. + */ +export type SendEventsOptions = OperationOptions; + +/** + * Options for the send cloud events operation. */ +export type SendCloudEventsOptions = OperationOptions; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as Parameters from "./models/parameters"; -import { EventGridClientContext } from "./eventGridClientContext"; +/** + * Options for the send custom schema events operation. + */ +export type SendCustomSchemaEventsOptions = OperationOptions; +/** + * The response when sending events to the Event Grid service. + */ +export interface SendEventsResponse { + _response: HttpResponse; +} -class EventGridClient extends EventGridClientContext { +/** + * Client class for publishing events to the Event Grid Service. + */ +export class EventGridPublisherClient { /** - * Initializes a new instance of the EventGridClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options + * The URL to the Event Grid endpoint. */ - constructor(credentials: msRest.ServiceClientCredentials, options?: msRestAzure.AzureServiceClientOptions) { - super(credentials, options); - } + public readonly endpointUrl: string; /** - * Publishes a batch of events to an Azure Event Grid topic. - * @param topicHostname The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net - * @param events An array of events to be published to Event Grid. - * @param [options] The optional parameters - * @returns Promise + * The version of the Even Grid service. */ - publishEvents(topicHostname: string, events: Models.EventGridEvent[], options?: msRest.RequestOptionsBase): Promise; + public readonly apiVersion: string; + + /** + * The AutoRest generated client for the EventGrid dataplane. + */ + private readonly client: GeneratedClient; + + /** + * Creates an instance of EventGridPublisherClient. + * + * Example usage: + * ```ts + * import { EventGridPublisherClient, AzureKeyCredential } from "@azure/eventgrid"; + * + * const client = new EventGridPublisherClient( + * "", + * new AzureKeyCredential("") + * ); + * ``` + * + * @param endpointUrl The URL to the EventGrid endpoint, e.g. https://eg-topic.westus2-1.eventgrid.azure.net/api/events + * @param credential Used to authenticate requests to the service. + * @param options Used to configure the Event Grid Client + */ + constructor( + endpointUrl: string, + credential: KeyCredential | SignatureCredential, + options: EventGridPublisherClientOptions = {} + ) { + this.endpointUrl = endpointUrl; + + const libInfo = `azsdk-js-eventgrid/${SDK_VERSION}`; + const pipelineOptions = { ...options }; + + if (!pipelineOptions.userAgentOptions) { + pipelineOptions.userAgentOptions = {}; + } + + if (pipelineOptions.userAgentOptions.userAgentPrefix) { + pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`; + } else { + pipelineOptions.userAgentOptions.userAgentPrefix = libInfo; + } + + const authPolicy = createEventGridCredentialPolicy(credential); + const pipeline = createPipelineFromOptions(options, authPolicy); + + this.client = new GeneratedClient(pipeline); + this.apiVersion = this.client.apiVersion; + } + /** - * @param topicHostname The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net - * @param events An array of events to be published to Event Grid. - * @param callback The callback + * Publishes events in the Event Grid scheama. The topic must be configured to expect events in the Event Grid schema. + * + * @param message One or more events to publish */ - publishEvents(topicHostname: string, events: Models.EventGridEvent[], callback: msRest.ServiceCallback): void; + sendEvents( + events: SendEventGridEventInput[], + options?: SendEventsOptions + ): Promise { + return this.client + .publishEvents( + this.endpointUrl, + (events || []).map(convertEventGridEventToModelType), + options + ) + .then((r) => { + return { + _response: r._response + }; + }); + } + /** - * @param topicHostname The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net - * @param events An array of events to be published to Event Grid. - * @param options The optional parameters - * @param callback The callback + * Publishes events in the Cloud Events 1.0 schema. The topic must be configured to expect events in the Cloud Events 1.0 schema. + * + * @param message One or more events to publish */ - publishEvents(topicHostname: string, events: Models.EventGridEvent[], options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - publishEvents(topicHostname: string, events: Models.EventGridEvent[], options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - topicHostname, - events, + sendCloudEvents( + events: SendCloudEventInput[], + options?: SendCloudEventsOptions + ): Promise { + return this.client + .publishCloudEventEvents( + this.endpointUrl, + (events || []).map(convertCloudEventToModelType), options - }, - publishEventsOperationSpec, - callback); + ) + .then((r) => { + return { + _response: r._response + }; + }); + } + + /** + * Publishes events written using a custom schema. The topic must be configured to expect events in a custom schema. + * + * @param message One or more events to publish + */ + sendCustomSchemaEvents( + events: Record[], + options?: SendCustomSchemaEventsOptions + ): Promise { + return this.client + .publishCustomEventEvents(this.endpointUrl, events || [], options) + .then((r) => { + return { + _response: r._response + }; + }); } } -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const publishEventsOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "api/events", - urlParameters: [ - Parameters.topicHostname - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "events", - mapper: { - required: true, - serializedName: "events", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "EventGridEvent" - } - } +/** + * @internal + */ +export function convertEventGridEventToModelType( + event: SendEventGridEventInput +): EventGridEventWireModel { + return { + eventType: event.eventType, + eventTime: event.eventTime ?? new Date(), + id: event.id ?? generateUuid(), + subject: event.subject, + topic: event.topic, + data: event.data, + dataVersion: event.dataVersion + }; +} + +/** + * @internal + */ +export function convertCloudEventToModelType(event: SendCloudEventInput): CloudEventWireModel { + if (event.extensionAttributes) { + for (const propName in event.extensionAttributes) { + // Per the cloud events spec: "CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or digits ('0' to '9') from the ASCII character set" + // they also can not match an existing defined property name. + + if ( + !/^[a-z0-9]*$/.test(propName) || + cloudEventReservedPropertyNames.indexOf(propName) !== -1 + ) { + throw new Error(`invalid extension attribute name: ${propName}`); } } - }, - responses: { - 200: {}, - default: { - bodyMapper: Mappers.CloudError + } + + const converted: CloudEventWireModel = { + specversion: "1.0", + type: event.type, + source: event.source, + id: event.id ?? generateUuid(), + time: event.time ?? new Date(), + subject: event.subject, + dataschema: event.dataschema, + ...(event.extensionAttributes ?? []) + }; + + if (event.data instanceof Uint8Array) { + if (!event.datacontenttype) { + throw new Error( + "a data content type must be provided when sending an event with binary data" + ); } - }, - serializer -}; - -export { - EventGridClient, - EventGridClientContext, - Models as EventGridModels, - Mappers as EventGridMappers -}; + + converted.datacontenttype = event.datacontenttype; + converted.dataBase64 = event.data; + } else { + converted.datacontenttype = event.datacontenttype ?? "application/json"; + converted.data = event.data; + } + + return converted; +} diff --git a/sdk/eventgrid/eventgrid/src/eventGridClientContext.ts b/sdk/eventgrid/eventgrid/src/eventGridClientContext.ts deleted file mode 100644 index 965e8c7890a8..000000000000 --- a/sdk/eventgrid/eventgrid/src/eventGridClientContext.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/eventgrid"; -const packageVersion = "2.0.0"; - -export class EventGridClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - apiVersion?: string; - - /** - * Initializes a new instance of the EventGridClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, options?: msRestAzure.AzureServiceClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2018-01-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = "https://{topicHostname}"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/eventgrid/eventgrid/src/generateSharedAccessSignature.ts b/sdk/eventgrid/eventgrid/src/generateSharedAccessSignature.ts new file mode 100644 index 000000000000..ee9b2d381ed4 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/generateSharedAccessSignature.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyCredential } from "@azure/core-auth"; +import { DEFAULT_API_VERSION } from "./constants"; +import { sha256Hmac } from "./cryptoHelpers"; +import { dateToServiceTimeString } from "./util"; + +export interface GenerateSharedAccessSignatureOptions { + /** + * The API Version to include in the signature. If not provided, the default + * API version will be used. + */ + apiVersion?: string; +} + +/** + * Generate a shared access signature, which allows a client to send events to an Event Grid Topic or Domain for a limited period of time. This + * function may only be called when the EventGridPublisherClient was constructed with a KeyCredential instance. + * + * @param endpointUrl The endpoint for the topic or domain you wish to generate a shared access signature for. + * @param credential The credential to use when generating the shared access signatrue. + * @param expiresOn The time at which the shared access signature is no longer valid. + * @param options Options to control how the signature is generated. + */ +export async function generateSharedAccessSignature( + endpointUrl: string, + credential: KeyCredential, + expiresOnUtc: Date, + options?: GenerateSharedAccessSignatureOptions +): Promise { + const expiresOnString = dateToServiceTimeString(expiresOnUtc); + const unsignedSas = `r=${encodeURIComponent( + `${endpointUrl}?apiVersion=${options?.apiVersion || DEFAULT_API_VERSION}` + )}&e=${encodeURIComponent(expiresOnString)}`; + return sha256Hmac(credential.key, unsignedSas).then( + (digest) => `${unsignedSas}&s=${encodeURIComponent(digest)}` + ); +} diff --git a/sdk/eventgrid/eventgrid/src/generated/generatedClient.ts b/sdk/eventgrid/eventgrid/src/generated/generatedClient.ts new file mode 100644 index 000000000000..80ed26cec84a --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/generated/generatedClient.ts @@ -0,0 +1,134 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreHttp from "@azure/core-http"; +import * as Parameters from "./models/parameters"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import { GeneratedClientContext } from "./generatedClientContext"; +import { + GeneratedClientOptionalParams, + EventGridEvent, + CloudEvent +} from "./models"; + +class GeneratedClient extends GeneratedClientContext { + /** + * Initializes a new instance of the GeneratedClient class. + * @param options The parameter options + */ + constructor(options?: GeneratedClientOptionalParams) { + super(options); + } + + /** + * Publishes a batch of events to an Azure Event Grid topic. + * @param topicHostname The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net + * @param events An array of events to be published to Event Grid. + * @param options The options parameters. + */ + publishEvents( + topicHostname: string, + events: EventGridEvent[], + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.sendOperationRequest( + { topicHostname, events, options: operationOptions }, + publishEventsOperationSpec + ) as Promise; + } + + /** + * Publishes a batch of events to an Azure Event Grid topic. + * @param topicHostname The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net + * @param events An array of events to be published to Event Grid. + * @param options The options parameters. + */ + publishCloudEventEvents( + topicHostname: string, + events: CloudEvent[], + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.sendOperationRequest( + { topicHostname, events, options: operationOptions }, + publishCloudEventEventsOperationSpec + ) as Promise; + } + + /** + * Publishes a batch of events to an Azure Event Grid topic. + * @param topicHostname The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net + * @param events An array of events to be published to Event Grid. + * @param options The options parameters. + */ + publishCustomEventEvents( + topicHostname: string, + events: any[], + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.sendOperationRequest( + { topicHostname, events, options: operationOptions }, + publishCustomEventEventsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const publishEventsOperationSpec: coreHttp.OperationSpec = { + path: "/api/events", + httpMethod: "POST", + responses: { 200: {}, default: {} }, + requestBody: Parameters.events, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.topicHostname], + headerParameters: [Parameters.contentType], + mediaType: "json", + serializer +}; +const publishCloudEventEventsOperationSpec: coreHttp.OperationSpec = { + path: "/api/events", + httpMethod: "POST", + responses: { 200: {}, default: {} }, + requestBody: Parameters.events1, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.topicHostname], + headerParameters: [Parameters.contentType1], + mediaType: "json", + serializer +}; +const publishCustomEventEventsOperationSpec: coreHttp.OperationSpec = { + path: "/api/events", + httpMethod: "POST", + responses: { 200: {}, default: {} }, + requestBody: Parameters.events2, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.topicHostname], + headerParameters: [Parameters.contentType], + mediaType: "json", + serializer +}; + +// Operation Specifications + +export { + GeneratedClient, + GeneratedClientContext, + Models as GeneratedModels, + Mappers as GeneratedMappers +}; diff --git a/sdk/eventgrid/eventgrid/src/generated/generatedClientContext.ts b/sdk/eventgrid/eventgrid/src/generated/generatedClientContext.ts new file mode 100644 index 000000000000..0f3881153af0 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/generated/generatedClientContext.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreHttp from "@azure/core-http"; +import { GeneratedClientOptionalParams } from "./models"; + +const packageName = "@azure/eventgrid"; +const packageVersion = "1.0.0"; + +export class GeneratedClientContext extends coreHttp.ServiceClient { + apiVersion: string; + + /** + * Initializes a new instance of the GeneratedClientContext class. + * @param options The parameter options + */ + constructor(options?: GeneratedClientOptionalParams) { + // Initializing default values for options + if (!options) { + options = {}; + } + + if (!options.userAgent) { + const defaultUserAgent = coreHttp.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(undefined, options); + + this.requestContentType = "application/json; charset=utf-8"; + + this.baseUri = options.endpoint || "https://{topicHostname}"; + + // Assigning values to Constant parameters + this.apiVersion = options.apiVersion || "2018-01-01"; + } +} diff --git a/sdk/eventgrid/eventgrid/src/models/index.ts b/sdk/eventgrid/eventgrid/src/generated/models/index.ts similarity index 61% rename from sdk/eventgrid/eventgrid/src/models/index.ts rename to sdk/eventgrid/eventgrid/src/generated/models/index.ts index e8d6da587fb4..386fbe28d891 100644 --- a/sdk/eventgrid/eventgrid/src/models/index.ts +++ b/sdk/eventgrid/eventgrid/src/generated/models/index.ts @@ -1,14 +1,102 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError } from "@azure/ms-rest-azure-js"; +import * as coreHttp from "@azure/core-http"; -export { BaseResource, CloudError }; +export type MediaJobOutputUnion = MediaJobOutput | MediaJobOutputAsset; + +/** + * Properties of an event published to an Event Grid topic using the EventGrid Schema. + */ +export interface EventGridEvent { + /** + * An unique identifier for the event. + */ + id: string; + /** + * The resource path of the event source. + */ + topic?: string; + /** + * A resource path relative to the topic path. + */ + subject: string; + /** + * Event data specific to the event type. + */ + data: any; + /** + * The type of the event that occurred. + */ + eventType: string; + /** + * The time (in UTC) the event was generated. + */ + eventTime: Date; + /** + * The schema version of the event metadata. + */ + readonly metadataVersion?: string; + /** + * The schema version of the data object. + */ + dataVersion: string; +} + +/** + * Properties of an event published to an Event Grid topic using the CloudEvent 1.0 Schema + */ +export interface CloudEvent { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * An identifier for the event. The combination of id and source must be unique for each distinct event. + */ + id: string; + /** + * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. + */ + source: string; + /** + * Event data specific to the event type. + */ + data?: any; + /** + * Event data specific to the event type, encoded as a base64 string. + */ + dataBase64?: Uint8Array; + /** + * Type of event related to the originating occurrence. + */ + type: string; + /** + * The time (in UTC) the event was generated, in RFC3339 format. + */ + time?: Date; + /** + * The version of the CloudEvents specification which the event uses. + */ + specversion: string; + /** + * Identifies the schema that data adheres to. + */ + dataschema?: string; + /** + * Content type of data value. + */ + datacontenttype?: string; + /** + * This describes the subject of the event in the context of the event producer (identified by source). + */ + subject?: string; +} /** * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.BlobCreated event. @@ -23,8 +111,7 @@ export interface StorageBlobCreatedEventData { */ clientRequestId?: string; /** - * The request id generated by the Storage service for the storage API operation that triggered - * this event. + * The request id generated by the Storage service for the storage API operation that triggered this event. */ requestId?: string; /** @@ -32,13 +119,11 @@ export interface StorageBlobCreatedEventData { */ eTag?: string; /** - * The content type of the blob. This is the same as what would be returned in the Content-Type - * header from the blob. + * The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. */ contentType?: string; /** - * The size of the blob in bytes. This is the same as what would be returned in the - * Content-Length header from the blob. + * The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. */ contentLength?: number; /** @@ -54,9 +139,7 @@ export interface StorageBlobCreatedEventData { */ url?: string; /** - * An opaque string value representing the logical sequence of events for any particular blob - * name. Users can use standard string comparison to understand the relative sequence of two - * events on the same blob name. + * An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. */ sequencer?: string; /** @@ -64,8 +147,7 @@ export interface StorageBlobCreatedEventData { */ identity?: string; /** - * For service use only. Diagnostic data occasionally included by the Azure Storage service. This - * property should be ignored by event consumers. + * For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. */ storageDiagnostics?: any; } @@ -83,13 +165,11 @@ export interface StorageBlobDeletedEventData { */ clientRequestId?: string; /** - * The request id generated by the Storage service for the storage API operation that triggered - * this event. + * The request id generated by the Storage service for the storage API operation that triggered this event. */ requestId?: string; /** - * The content type of the blob. This is the same as what would be returned in the Content-Type - * header from the blob. + * The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. */ contentType?: string; /** @@ -101,9 +181,7 @@ export interface StorageBlobDeletedEventData { */ url?: string; /** - * An opaque string value representing the logical sequence of events for any particular blob - * name. Users can use standard string comparison to understand the relative sequence of two - * events on the same blob name. + * An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. */ sequencer?: string; /** @@ -111,15 +189,13 @@ export interface StorageBlobDeletedEventData { */ identity?: string; /** - * For service use only. Diagnostic data occasionally included by the Azure Storage service. This - * property should be ignored by event consumers. + * For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. */ storageDiagnostics?: any; } /** - * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.DirectoryCreated - * event. + * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.DirectoryCreated event. */ export interface StorageDirectoryCreatedEventData { /** @@ -131,8 +207,7 @@ export interface StorageDirectoryCreatedEventData { */ clientRequestId?: string; /** - * The request id generated by the storage service for the storage API operation that triggered - * this event. + * The request id generated by the storage service for the storage API operation that triggered this event. */ requestId?: string; /** @@ -144,9 +219,7 @@ export interface StorageDirectoryCreatedEventData { */ url?: string; /** - * An opaque string value representing the logical sequence of events for any particular - * directory name. Users can use standard string comparison to understand the relative sequence - * of two events on the same directory name. + * An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. */ sequencer?: string; /** @@ -154,15 +227,13 @@ export interface StorageDirectoryCreatedEventData { */ identity?: string; /** - * For service use only. Diagnostic data occasionally included by the Azure Storage service. This - * property should be ignored by event consumers. + * For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. */ storageDiagnostics?: any; } /** - * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.DirectoryDeleted - * event. + * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.DirectoryDeleted event. */ export interface StorageDirectoryDeletedEventData { /** @@ -174,8 +245,7 @@ export interface StorageDirectoryDeletedEventData { */ clientRequestId?: string; /** - * The request id generated by the storage service for the storage API operation that triggered - * this event. + * The request id generated by the storage service for the storage API operation that triggered this event. */ requestId?: string; /** @@ -187,9 +257,7 @@ export interface StorageDirectoryDeletedEventData { */ recursive?: boolean; /** - * An opaque string value representing the logical sequence of events for any particular - * directory name. Users can use standard string comparison to understand the relative sequence - * of two events on the same directory name. + * An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. */ sequencer?: string; /** @@ -197,8 +265,7 @@ export interface StorageDirectoryDeletedEventData { */ identity?: string; /** - * For service use only. Diagnostic data occasionally included by the Azure Storage service. This - * property should be ignored by event consumers. + * For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. */ storageDiagnostics?: any; } @@ -216,8 +283,7 @@ export interface StorageBlobRenamedEventData { */ clientRequestId?: string; /** - * The request id generated by the storage service for the storage API operation that triggered - * this event. + * The request id generated by the storage service for the storage API operation that triggered this event. */ requestId?: string; /** @@ -229,9 +295,7 @@ export interface StorageBlobRenamedEventData { */ destinationUrl?: string; /** - * An opaque string value representing the logical sequence of events for any particular blob - * name. Users can use standard string comparison to understand the relative sequence of two - * events on the same blob name. + * An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. */ sequencer?: string; /** @@ -239,15 +303,13 @@ export interface StorageBlobRenamedEventData { */ identity?: string; /** - * For service use only. Diagnostic data occasionally included by the Azure Storage service. This - * property should be ignored by event consumers. + * For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. */ storageDiagnostics?: any; } /** - * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.DirectoryRenamed - * event. + * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.DirectoryRenamed event. */ export interface StorageDirectoryRenamedEventData { /** @@ -259,8 +321,7 @@ export interface StorageDirectoryRenamedEventData { */ clientRequestId?: string; /** - * The request id generated by the storage service for the storage API operation that triggered - * this event. + * The request id generated by the storage service for the storage API operation that triggered this event. */ requestId?: string; /** @@ -272,9 +333,7 @@ export interface StorageDirectoryRenamedEventData { */ destinationUrl?: string; /** - * An opaque string value representing the logical sequence of events for any particular - * directory name. Users can use standard string comparison to understand the relative sequence - * of two events on the same directory name. + * An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. */ sequencer?: string; /** @@ -282,15 +341,53 @@ export interface StorageDirectoryRenamedEventData { */ identity?: string; /** - * For service use only. Diagnostic data occasionally included by the Azure Storage service. This - * property should be ignored by event consumers. + * For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. */ storageDiagnostics?: any; } /** - * Schema of the Data property of an EventGridEvent for an Microsoft.EventHub.CaptureFileCreated - * event. + * Schema of the Data property of an EventGridEvent for an Microsoft.Storage.LifecyclePolicyCompleted event. + */ +export interface StorageLifecyclePolicyCompletedEventData { + /** + * The time the policy task was scheduled. + */ + scheduleTime?: string; + /** + * Execution statistics of a specific policy action in a Blob Management cycle. + */ + deleteSummary?: StorageLifecyclePolicyActionSummaryDetail; + /** + * Execution statistics of a specific policy action in a Blob Management cycle. + */ + tierToCoolSummary?: StorageLifecyclePolicyActionSummaryDetail; + /** + * Execution statistics of a specific policy action in a Blob Management cycle. + */ + tierToArchiveSummary?: StorageLifecyclePolicyActionSummaryDetail; +} + +/** + * Execution statistics of a specific policy action in a Blob Management cycle. + */ +export interface StorageLifecyclePolicyActionSummaryDetail { + /** + * Total number of objects to be acted on by this action. + */ + totalObjectsCount?: number; + /** + * Number of success operations of this action. + */ + successCount?: number; + /** + * Error messages of this action if any. + */ + errorList?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.EventHub.CaptureFileCreated event. */ export interface EventHubCaptureFileCreatedEventData { /** @@ -332,10 +429,9 @@ export interface EventHubCaptureFileCreatedEventData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteSuccess - * event. This is raised when a resource create or update operation succeeds. + * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteSuccess event. This is raised when a resource create or update operation succeeds. */ -export interface ResourceWriteSuccessData { +export interface ResourceWriteSuccessEventData { /** * The tenant ID of the resource. */ @@ -383,10 +479,9 @@ export interface ResourceWriteSuccessData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteFailure - * event. This is raised when a resource create or update operation fails. + * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteFailure event. This is raised when a resource create or update operation fails. */ -export interface ResourceWriteFailureData { +export interface ResourceWriteFailureEventData { /** * The tenant ID of the resource. */ @@ -434,10 +529,9 @@ export interface ResourceWriteFailureData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteCancel - * event. This is raised when a resource create or update operation is canceled. + * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteCancel event. This is raised when a resource create or update operation is canceled. */ -export interface ResourceWriteCancelData { +export interface ResourceWriteCancelEventData { /** * The tenant ID of the resource. */ @@ -485,10 +579,9 @@ export interface ResourceWriteCancelData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteSuccess - * event. This is raised when a resource delete operation succeeds. + * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteSuccess event. This is raised when a resource delete operation succeeds. */ -export interface ResourceDeleteSuccessData { +export interface ResourceDeleteSuccessEventData { /** * The tenant ID of the resource. */ @@ -536,10 +629,9 @@ export interface ResourceDeleteSuccessData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteFailure - * event. This is raised when a resource delete operation fails. + * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteFailure event. This is raised when a resource delete operation fails. */ -export interface ResourceDeleteFailureData { +export interface ResourceDeleteFailureEventData { /** * The tenant ID of the resource. */ @@ -587,10 +679,9 @@ export interface ResourceDeleteFailureData { } /** - * Schema of the Data property of an EventGridEvent for an Microsoft.Resources.ResourceDeleteCancel - * event. This is raised when a resource delete operation is canceled. + * Schema of the Data property of an EventGridEvent for an Microsoft.Resources.ResourceDeleteCancel event. This is raised when a resource delete operation is canceled. */ -export interface ResourceDeleteCancelData { +export interface ResourceDeleteCancelEventData { /** * The tenant ID of the resource. */ @@ -638,10 +729,9 @@ export interface ResourceDeleteCancelData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionSuccess - * event. This is raised when a resource action operation succeeds. + * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionSuccess event. This is raised when a resource action operation succeeds. */ -export interface ResourceActionSuccessData { +export interface ResourceActionSuccessEventData { /** * The tenant ID of the resource. */ @@ -689,10 +779,9 @@ export interface ResourceActionSuccessData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionFailure - * event. This is raised when a resource action operation fails. + * Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionFailure event. This is raised when a resource action operation fails. */ -export interface ResourceActionFailureData { +export interface ResourceActionFailureEventData { /** * The tenant ID of the resource. */ @@ -740,10 +829,9 @@ export interface ResourceActionFailureData { } /** - * Schema of the Data property of an EventGridEvent for an Microsoft.Resources.ResourceActionCancel - * event. This is raised when a resource action operation is canceled. + * Schema of the Data property of an EventGridEvent for an Microsoft.Resources.ResourceActionCancel event. This is raised when a resource action operation is canceled. */ -export interface ResourceActionCancelData { +export interface ResourceActionCancelEventData { /** * The tenant ID of the resource. */ @@ -791,141 +879,179 @@ export interface ResourceActionCancelData { } /** - * Properties of an event published to an Event Grid topic. + * Schema of the Data property of an EventGridEvent for a Microsoft.EventGrid.SubscriptionValidationEvent. */ -export interface EventGridEvent { - /** - * An unique identifier for the event. - */ - id: string; +export interface SubscriptionValidationEventData { /** - * The resource path of the event source. + * The validation code sent by Azure Event Grid to validate an event subscription. To complete the validation handshake, the subscriber must either respond with this validation code as part of the validation response, or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). */ - topic?: string; + readonly validationCode?: string; /** - * A resource path relative to the topic path. + * The validation URL sent by Azure Event Grid (available starting version 2018-05-01-preview). To complete the validation handshake, the subscriber must either respond with the validationCode as part of the validation response, or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). */ - subject: string; + readonly validationUrl?: string; +} + +/** + * To complete an event subscription validation handshake, a subscriber can use either the validationCode or the validationUrl received in a SubscriptionValidationEvent. When the validationCode is used, the SubscriptionValidationResponse can be used to build the response. + */ +export interface SubscriptionValidationResponse { /** - * Event data specific to the event type. + * The validation response sent by the subscriber to Azure Event Grid to complete the validation of an event subscription. */ - data: any; + validationResponse?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for a Microsoft.EventGrid.SubscriptionDeletedEvent. + */ +export interface SubscriptionDeletedEventData { /** - * The type of the event that occurred. + * The Azure resource ID of the deleted event subscription. */ - eventType: string; + readonly eventSubscriptionId?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for a device life cycle event (DeviceCreated, DeviceDeleted). + */ +export interface DeviceLifeCycleEventProperties { /** - * The time (in UTC) the event was generated. + * The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '. */ - eventTime: Date; + deviceId?: string; /** - * The schema version of the event metadata. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Name of the IoT Hub where the device was created or deleted. */ - readonly metadataVersion?: string; + hubName?: string; /** - * The schema version of the data object. + * Information about the device twin, which is the cloud representation of application device metadata. */ - dataVersion: string; + twin?: DeviceTwinInfo; } /** - * Schema of the Data property of an EventGridEvent for a - * Microsoft.EventGrid.SubscriptionValidationEvent. + * Information about the device twin, which is the cloud representation of application device metadata. */ -export interface SubscriptionValidationEventData { +export interface DeviceTwinInfo { /** - * The validation code sent by Azure Event Grid to validate an event subscription. To complete - * the validation handshake, the subscriber must either respond with this validation code as part - * of the validation response, or perform a GET request on the validationUrl (available starting - * version 2018-05-01-preview). - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority. */ - readonly validationCode?: string; + authenticationType?: string; /** - * The validation URL sent by Azure Event Grid (available starting version 2018-05-01-preview). - * To complete the validation handshake, the subscriber must either respond with the - * validationCode as part of the validation response, or perform a GET request on the - * validationUrl (available starting version 2018-05-01-preview). - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Count of cloud to device messages sent to this device. */ - readonly validationUrl?: string; + cloudToDeviceMessageCount?: number; + /** + * Whether the device is connected or disconnected. + */ + connectionState?: string; + /** + * The unique identifier of the device twin. + */ + deviceId?: string; + /** + * A piece of information that describes the content of the device twin. Each etag is guaranteed to be unique per device twin. + */ + etag?: string; + /** + * The ISO8601 timestamp of the last activity. + */ + lastActivityTime?: string; + /** + * Properties JSON element. + */ + properties?: DeviceTwinInfoProperties; + /** + * Whether the device twin is enabled or disabled. + */ + status?: string; + /** + * The ISO8601 timestamp of the last device twin status update. + */ + statusUpdateTime?: string; + /** + * An integer that is incremented by one each time the device twin is updated. + */ + version?: number; + /** + * The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate. + */ + x509Thumbprint?: DeviceTwinInfoX509Thumbprint; } /** - * To complete an event subscription validation handshake, a subscriber can use either the - * validationCode or the validationUrl received in a SubscriptionValidationEvent. When the - * validationCode is used, the SubscriptionValidationResponse can be used to build the response. + * Properties JSON element. */ -export interface SubscriptionValidationResponse { +export interface DeviceTwinInfoProperties { /** - * The validation response sent by the subscriber to Azure Event Grid to complete the validation - * of an event subscription. + * A portion of the properties that can be written only by the application back-end, and read by the device. */ - validationResponse?: string; + desired?: DeviceTwinProperties; + /** + * A portion of the properties that can be written only by the device, and read by the application back-end. + */ + reported?: DeviceTwinProperties; } /** - * Schema of the Data property of an EventGridEvent for a - * Microsoft.EventGrid.SubscriptionDeletedEvent. + * A portion of the properties that can be written only by the application back-end, and read by the device. */ -export interface SubscriptionDeletedEventData { +export interface DeviceTwinProperties { /** - * The Azure resource ID of the deleted event subscription. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Metadata information for the properties JSON document. */ - readonly eventSubscriptionId?: string; + metadata?: DeviceTwinMetadata; + /** + * Version of device twin properties. + */ + version?: number; } /** - * Schema of the Data property of an EventGridEvent for a device life cycle event (DeviceCreated, - * DeviceDeleted). + * Metadata information for the properties JSON document. */ -export interface DeviceLifeCycleEventProperties { +export interface DeviceTwinMetadata { /** - * The unique identifier of the device. This case-sensitive string can be up to 128 characters - * long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - * - : . + % _ # * ? ! ( ) , = @ ; $ '. + * The ISO8601 timestamp of the last time the properties were updated. */ - deviceId?: string; + lastUpdated?: string; +} + +/** + * The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate. + */ +export interface DeviceTwinInfoX509Thumbprint { /** - * Name of the IoT Hub where the device was created or deleted. + * Primary thumbprint for the x509 certificate. */ - hubName?: string; + primaryThumbprint?: string; /** - * Information about the device twin, which is the cloud representation of application device - * metadata. + * Secondary thumbprint for the x509 certificate. */ - twin?: DeviceTwinInfo; + secondaryThumbprint?: string; } /** * Event data for Microsoft.Devices.DeviceCreated event. */ -export interface IotHubDeviceCreatedEventData extends DeviceLifeCycleEventProperties { -} +export type IotHubDeviceCreatedEventData = DeviceLifeCycleEventProperties & {}; /** * Event data for Microsoft.Devices.DeviceDeleted event. */ -export interface IotHubDeviceDeletedEventData extends DeviceLifeCycleEventProperties { -} +export type IotHubDeviceDeletedEventData = DeviceLifeCycleEventProperties & {}; /** - * Schema of the Data property of an EventGridEvent for a device connection state event - * (DeviceConnected, DeviceDisconnected). + * Schema of the Data property of an EventGridEvent for a device connection state event (DeviceConnected, DeviceDisconnected). */ export interface DeviceConnectionStateEventProperties { /** - * The unique identifier of the device. This case-sensitive string can be up to 128 characters - * long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - * - : . + % _ # * ? ! ( ) , = @ ; $ '. + * The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '. */ deviceId?: string; /** - * The unique identifier of the module. This case-sensitive string can be up to 128 characters - * long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - * - : . + % _ # * ? ! ( ) , = @ ; $ '. + * The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '. */ moduleId?: string; /** @@ -939,16 +1065,24 @@ export interface DeviceConnectionStateEventProperties { } /** - * Event data for Microsoft.Devices.DeviceConnected event. + * Information about the device connection state event. */ -export interface IotHubDeviceConnectedEventData extends DeviceConnectionStateEventProperties { +export interface DeviceConnectionStateEventInfo { + /** + * Sequence number is string representation of a hexadecimal number. string compare can be used to identify the larger number because both in ASCII and HEX numbers come after alphabets. If you are converting the string to hex, then the number is a 256 bit number. + */ + sequenceNumber?: string; } +/** + * Event data for Microsoft.Devices.DeviceConnected event. + */ +export type IotHubDeviceConnectedEventData = DeviceConnectionStateEventProperties & {}; + /** * Event data for Microsoft.Devices.DeviceDisconnected event. */ -export interface IotHubDeviceDisconnectedEventData extends DeviceConnectionStateEventProperties { -} +export type IotHubDeviceDisconnectedEventData = DeviceConnectionStateEventProperties & {}; /** * Schema of the Data property of an EventGridEvent for a device telemetry event (DeviceTelemetry). @@ -959,8 +1093,7 @@ export interface DeviceTelemetryEventProperties { */ body?: any; /** - * Application properties are user-defined strings that can be added to the message. These fields - * are optional. + * Application properties are user-defined strings that can be added to the message. These fields are optional. */ properties?: { [propertyName: string]: string }; /** @@ -972,218 +1105,42 @@ export interface DeviceTelemetryEventProperties { /** * Event data for Microsoft.Devices.DeviceTelemetry event. */ -export interface IotHubDeviceTelemetryEventData extends DeviceTelemetryEventProperties { -} +export type IotHubDeviceTelemetryEventData = DeviceTelemetryEventProperties & {}; /** - * Metadata information for the properties JSON document. + * The content of the event request message. */ -export interface DeviceTwinMetadata { +export interface ContainerRegistryEventData { /** - * The ISO8601 timestamp of the last time the properties were updated. + * The event ID. */ - lastUpdated?: string; -} - -/** - * A portion of the properties that can be written only by the application back-end, and read by - * the device. - */ -export interface DeviceTwinProperties { + id?: string; /** - * Metadata information for the properties JSON document. + * The time at which the event occurred. */ - metadata?: DeviceTwinMetadata; + timestamp?: Date; /** - * Version of device twin properties. + * The action that encompasses the provided event. */ - version?: number; -} - -/** - * Properties JSON element. - */ -export interface DeviceTwinInfoProperties { + action?: string; /** - * A portion of the properties that can be written only by the application back-end, and read by - * the device. + * The target of the event. */ - desired?: DeviceTwinProperties; + target?: ContainerRegistryEventTarget; /** - * A portion of the properties that can be written only by the device, and read by the - * application back-end. - */ - reported?: DeviceTwinProperties; -} - -/** - * The thumbprint is a unique value for the x509 certificate, commonly used to find a particular - * certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 - * algorithm, and does not physically exist in the certificate. - */ -export interface DeviceTwinInfoX509Thumbprint { - /** - * Primary thumbprint for the x509 certificate. - */ - primaryThumbprint?: string; - /** - * Secondary thumbprint for the x509 certificate. - */ - secondaryThumbprint?: string; -} - -/** - * Information about the device twin, which is the cloud representation of application device - * metadata. - */ -export interface DeviceTwinInfo { - /** - * Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority. - */ - authenticationType?: string; - /** - * Count of cloud to device messages sent to this device. - */ - cloudToDeviceMessageCount?: number; - /** - * Whether the device is connected or disconnected. - */ - connectionState?: string; - /** - * The unique identifier of the device twin. - */ - deviceId?: string; - /** - * A piece of information that describes the content of the device twin. Each etag is guaranteed - * to be unique per device twin. - */ - etag?: string; - /** - * The ISO8601 timestamp of the last activity. - */ - lastActivityTime?: string; - /** - * Properties JSON element. - */ - properties?: DeviceTwinInfoProperties; - /** - * Whether the device twin is enabled or disabled. - */ - status?: string; - /** - * The ISO8601 timestamp of the last device twin status update. - */ - statusUpdateTime?: string; - /** - * An integer that is incremented by one each time the device twin is updated. - */ - version?: number; - /** - * The thumbprint is a unique value for the x509 certificate, commonly used to find a particular - * certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 - * algorithm, and does not physically exist in the certificate. - */ - x509Thumbprint?: DeviceTwinInfoX509Thumbprint; -} - -/** - * Information about the device connection state event. - */ -export interface DeviceConnectionStateEventInfo { - /** - * Sequence number is string representation of a hexadecimal number. string compare can be used - * to identify the larger number because both in ASCII and HEX numbers come after alphabets. If - * you are converting the string to hex, then the number is a 256 bit number. - */ - sequenceNumber?: string; -} - -/** - * The content of the event request message. - */ -export interface ContainerRegistryEventData { - /** - * The event ID. - */ - id?: string; - /** - * The time at which the event occurred. - */ - timestamp?: Date; - /** - * The action that encompasses the provided event. - */ - action?: string; - /** - * The target of the event. - */ - target?: ContainerRegistryEventTarget; - /** - * The request that generated the event. + * The request that generated the event. */ request?: ContainerRegistryEventRequest; /** - * The agent that initiated the event. For most situations, this could be from the authorization - * context of the request. + * The agent that initiated the event. For most situations, this could be from the authorization context of the request. */ actor?: ContainerRegistryEventActor; /** - * The registry node that generated the event. Put differently, while the actor initiates the - * event, the source generates it. + * The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. */ source?: ContainerRegistryEventSource; } -/** - * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImagePushed - * event. - */ -export interface ContainerRegistryImagePushedEventData extends ContainerRegistryEventData { -} - -/** - * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImageDeleted - * event. - */ -export interface ContainerRegistryImageDeletedEventData extends ContainerRegistryEventData { -} - -/** - * The content of the event request message. - */ -export interface ContainerRegistryArtifactEventData { - /** - * The event ID. - */ - id?: string; - /** - * The time at which the event occurred. - */ - timestamp?: Date; - /** - * The action that encompasses the provided event. - */ - action?: string; - /** - * The target of the event. - */ - target?: ContainerRegistryArtifactEventTarget; -} - -/** - * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartPushed - * event. - */ -export interface ContainerRegistryChartPushedEventData extends ContainerRegistryArtifactEventData { -} - -/** - * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartDeleted - * event. - */ -export interface ContainerRegistryChartDeletedEventData extends ContainerRegistryArtifactEventData { -} - /** * The target of the event. */ @@ -1227,13 +1184,11 @@ export interface ContainerRegistryEventRequest { */ id?: string; /** - * The IP or hostname and possibly port of the client connection that initiated the event. This - * is the RemoteAddr from the standard http request. + * The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. */ addr?: string; /** - * The externally accessible hostname of the registry instance, as specified by the http host - * header on incoming requests. + * The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. */ host?: string; /** @@ -1247,8 +1202,7 @@ export interface ContainerRegistryEventRequest { } /** - * The agent that initiated the event. For most situations, this could be from the authorization - * context of the request. + * The agent that initiated the event. For most situations, this could be from the authorization context of the request. */ export interface ContainerRegistryEventActor { /** @@ -1258,13 +1212,11 @@ export interface ContainerRegistryEventActor { } /** - * The registry node that generated the event. Put differently, while the actor initiates the - * event, the source generates it. + * The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. */ export interface ContainerRegistryEventSource { /** - * The IP or hostname and the port of the registry node that generated the event. Generally, this - * will be resolved by os.Hostname() along with the running port. + * The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. */ addr?: string; /** @@ -1273,6 +1225,38 @@ export interface ContainerRegistryEventSource { instanceID?: string; } +/** + * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImagePushed event. + */ +export type ContainerRegistryImagePushedEventData = ContainerRegistryEventData & {}; + +/** + * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImageDeleted event. + */ +export type ContainerRegistryImageDeletedEventData = ContainerRegistryEventData & {}; + +/** + * The content of the event request message. + */ +export interface ContainerRegistryArtifactEventData { + /** + * The event ID. + */ + id?: string; + /** + * The time at which the event occurred. + */ + timestamp?: Date; + /** + * The action that encompasses the provided event. + */ + action?: string; + /** + * The target of the event. + */ + target?: ContainerRegistryArtifactEventTarget; +} + /** * The target of the event. */ @@ -1308,8 +1292,17 @@ export interface ContainerRegistryArtifactEventTarget { } /** - * Schema of the Data property of an EventGridEvent for a - * Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners event. + * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartPushed event. + */ +export type ContainerRegistryChartPushedEventData = ContainerRegistryArtifactEventData & {}; + +/** + * Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartDeleted event. + */ +export type ContainerRegistryChartDeletedEventData = ContainerRegistryArtifactEventData & {}; + +/** + * Schema of the Data property of an EventGridEvent for a Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners event. */ export interface ServiceBusActiveMessagesAvailableWithNoListenersEventData { /** @@ -1325,25 +1318,21 @@ export interface ServiceBusActiveMessagesAvailableWithNoListenersEventData { */ entityType?: string; /** - * The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then - * this value will be null. + * The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. */ queueName?: string; /** - * The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this - * value will be null. + * The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. */ topicName?: string; /** - * The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type - * 'queue', then this value will be null. + * The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. */ subscriptionName?: string; } /** - * Schema of the Data property of an EventGridEvent for a - * Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListenersEvent event. + * Schema of the Data property of an EventGridEvent for a Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListenersEvent event. */ export interface ServiceBusDeadletterMessagesAvailableWithNoListenersEventData { /** @@ -1359,18 +1348,15 @@ export interface ServiceBusDeadletterMessagesAvailableWithNoListenersEventData { */ entityType?: string; /** - * The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then - * this value will be null. + * The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. */ queueName?: string; /** - * The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this - * value will be null. + * The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. */ topicName?: string; /** - * The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type - * 'queue', then this value will be null. + * The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. */ subscriptionName?: string; } @@ -1380,15 +1366,11 @@ export interface ServiceBusDeadletterMessagesAvailableWithNoListenersEventData { */ export interface MediaJobStateChangeEventData { /** - * The previous state of the Job. Possible values include: 'Canceled', 'Canceling', 'Error', - * 'Finished', 'Processing', 'Queued', 'Scheduled' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The previous state of the Job. */ readonly previousState?: MediaJobState; /** - * The new state of the Job. Possible values include: 'Canceled', 'Canceling', 'Error', - * 'Finished', 'Processing', 'Queued', 'Scheduled' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The new state of the Job. */ readonly state?: MediaJobState; /** @@ -1397,71 +1379,58 @@ export interface MediaJobStateChangeEventData { correlationData?: { [propertyName: string]: string }; } -/** - * Details of JobOutput errors. - */ -export interface MediaJobErrorDetail { - /** - * Code describing the error detail. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly code?: string; - /** - * A human-readable representation of the error. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; -} - /** * Details of JobOutput errors. */ export interface MediaJobError { /** - * Error code describing the error. Possible values include: 'ServiceError', - * 'ServiceTransientError', 'DownloadNotAccessible', 'DownloadTransientError', - * 'UploadNotAccessible', 'UploadTransientError', 'ConfigurationUnsupported', 'ContentMalformed', - * 'ContentUnsupported' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Error code describing the error. */ readonly code?: MediaJobErrorCode; /** * A human-readable language-dependent representation of the error. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly message?: string; /** - * Helps with categorization of errors. Possible values include: 'Service', 'Download', 'Upload', - * 'Configuration', 'Content' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Helps with categorization of errors. */ readonly category?: MediaJobErrorCategory; /** - * Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact - * Azure support via Azure Portal. Possible values include: 'DoNotRetry', 'MayRetry' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. */ readonly retry?: MediaJobRetry; /** * An array of details about specific errors that led to this reported error. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly details?: MediaJobErrorDetail[]; } /** - * Contains the possible cases for MediaJobOutput. + * Details of JobOutput errors. */ -export type MediaJobOutputUnion = MediaJobOutput | MediaJobOutputAsset; +export interface MediaJobErrorDetail { + /** + * Code describing the error detail. + */ + readonly code?: string; + /** + * A human-readable representation of the error. + */ + readonly message?: string; +} /** * The event data for a Job output. */ export interface MediaJobOutput { /** - * Polymorphic Discriminator + * Polymorphic discriminator, which specifies the different types this object can be */ - odatatype: "MediaJobOutput"; + "@odata.type": "#Microsoft.Media.JobOutputAsset"; + /** + * The discriminator for derived types. + */ + odataType?: string; /** * Gets the Job output error. */ @@ -1475,8 +1444,7 @@ export interface MediaJobOutput { */ progress: number; /** - * Gets the Job output state. Possible values include: 'Canceled', 'Canceling', 'Error', - * 'Finished', 'Processing', 'Queued', 'Scheduled' + * Gets the Job output state. */ state: MediaJobState; } @@ -1484,33 +1452,12 @@ export interface MediaJobOutput { /** * The event data for a Job output asset. */ -export interface MediaJobOutputAsset { - /** - * Polymorphic Discriminator - */ - odatatype: "#Microsoft.Media.JobOutputAsset"; - /** - * Gets the Job output error. - */ - error?: MediaJobError; - /** - * Gets the Job output label. - */ - label?: string; - /** - * Gets the Job output progress. - */ - progress: number; - /** - * Gets the Job output state. Possible values include: 'Canceled', 'Canceling', 'Error', - * 'Finished', 'Processing', 'Queued', 'Scheduled' - */ - state: MediaJobState; +export type MediaJobOutputAsset = MediaJobOutput & { /** * Gets the Job output asset name. */ assetName?: string; -} +}; /** * Job Output Progress Event Data. @@ -1531,14 +1478,11 @@ export interface MediaJobOutputProgressEventData { } /** - * Schema of the Data property of an EventGridEvent for a Microsoft.Media.JobOutputStateChange - * event. + * Schema of the Data property of an EventGridEvent for a Microsoft.Media.JobOutputStateChange event. */ export interface MediaJobOutputStateChangeEventData { /** - * The previous state of the Job. Possible values include: 'Canceled', 'Canceling', 'Error', - * 'Finished', 'Processing', 'Queued', 'Scheduled' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The previous state of the Job. */ readonly previousState?: MediaJobState; /** @@ -1554,86 +1498,77 @@ export interface MediaJobOutputStateChangeEventData { /** * Job scheduled event data */ -export interface MediaJobScheduledEventData extends MediaJobStateChangeEventData { -} +export type MediaJobScheduledEventData = MediaJobStateChangeEventData & {}; /** * Job processing event data */ -export interface MediaJobProcessingEventData extends MediaJobStateChangeEventData { -} +export type MediaJobProcessingEventData = MediaJobStateChangeEventData & {}; /** * Job canceling event data */ -export interface MediaJobCancelingEventData extends MediaJobStateChangeEventData { -} +export type MediaJobCancelingEventData = MediaJobStateChangeEventData & {}; /** * Job finished event data */ -export interface MediaJobFinishedEventData extends MediaJobStateChangeEventData { +export type MediaJobFinishedEventData = MediaJobStateChangeEventData & { /** * Gets the Job outputs. */ outputs?: MediaJobOutputUnion[]; -} +}; /** * Job canceled event data */ -export interface MediaJobCanceledEventData extends MediaJobStateChangeEventData { +export type MediaJobCanceledEventData = MediaJobStateChangeEventData & { /** * Gets the Job outputs. */ outputs?: MediaJobOutputUnion[]; -} +}; /** * Job error state event data */ -export interface MediaJobErroredEventData extends MediaJobStateChangeEventData { +export type MediaJobErroredEventData = MediaJobStateChangeEventData & { /** * Gets the Job outputs. */ outputs?: MediaJobOutputUnion[]; -} +}; /** * Job output canceled event data */ -export interface MediaJobOutputCanceledEventData extends MediaJobOutputStateChangeEventData { -} +export type MediaJobOutputCanceledEventData = MediaJobOutputStateChangeEventData & {}; /** * Job output canceling event data */ -export interface MediaJobOutputCancelingEventData extends MediaJobOutputStateChangeEventData { -} +export type MediaJobOutputCancelingEventData = MediaJobOutputStateChangeEventData & {}; /** * Job output error event data */ -export interface MediaJobOutputErroredEventData extends MediaJobOutputStateChangeEventData { -} +export type MediaJobOutputErroredEventData = MediaJobOutputStateChangeEventData & {}; /** * Job output finished event data */ -export interface MediaJobOutputFinishedEventData extends MediaJobOutputStateChangeEventData { -} +export type MediaJobOutputFinishedEventData = MediaJobOutputStateChangeEventData & {}; /** * Job output processing event data */ -export interface MediaJobOutputProcessingEventData extends MediaJobOutputStateChangeEventData { -} +export type MediaJobOutputProcessingEventData = MediaJobOutputStateChangeEventData & {}; /** * Job output scheduled event data */ -export interface MediaJobOutputScheduledEventData extends MediaJobOutputStateChangeEventData { -} +export type MediaJobOutputScheduledEventData = MediaJobOutputStateChangeEventData & {}; /** * Encoder connect event data. @@ -1641,22 +1576,18 @@ export interface MediaJobOutputScheduledEventData extends MediaJobOutputStateCha export interface MediaLiveEventEncoderConnectedEventData { /** * Gets the ingest URL provided by the live event. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly ingestUrl?: string; /** * Gets the stream Id. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly streamId?: string; /** * Gets the remote IP. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderIp?: string; /** * Gets the remote port. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderPort?: string; } @@ -1667,27 +1598,22 @@ export interface MediaLiveEventEncoderConnectedEventData { export interface MediaLiveEventConnectionRejectedEventData { /** * Gets the ingest URL provided by the live event. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly ingestUrl?: string; /** * Gets the stream Id. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly streamId?: string; /** * Gets the remote IP. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderIp?: string; /** * Gets the remote port. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderPort?: string; /** * Gets the result code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly resultCode?: string; } @@ -1698,27 +1624,22 @@ export interface MediaLiveEventConnectionRejectedEventData { export interface MediaLiveEventEncoderDisconnectedEventData { /** * Gets the ingest URL provided by the live event. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly ingestUrl?: string; /** * Gets the stream Id. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly streamId?: string; /** * Gets the remote IP. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderIp?: string; /** * Gets the remote port. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderPort?: string; /** * Gets the result code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly resultCode?: string; } @@ -1729,47 +1650,38 @@ export interface MediaLiveEventEncoderDisconnectedEventData { export interface MediaLiveEventIncomingStreamReceivedEventData { /** * Gets the ingest URL provided by the live event. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly ingestUrl?: string; /** * Gets the type of the track (Audio / Video). - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackType?: string; /** * Gets the track name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackName?: string; /** * Gets the bitrate of the track. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly bitrate?: number; /** * Gets the remote IP. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderIp?: string; /** * Gets the remote port. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly encoderPort?: string; /** * Gets the first timestamp of the data chunk received. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timestamp?: string; /** * Gets the duration of the first data chunk. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly duration?: string; /** * Gets the timescale in which timestamp is represented. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timescale?: string; } @@ -1780,32 +1692,26 @@ export interface MediaLiveEventIncomingStreamReceivedEventData { export interface MediaLiveEventIncomingStreamsOutOfSyncEventData { /** * Gets the minimum last timestamp received. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly minLastTimestamp?: string; /** * Gets the type of stream with minimum last timestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly typeOfStreamWithMinLastTimestamp?: string; /** * Gets the maximum timestamp among all the tracks (audio or video). - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly maxLastTimestamp?: string; /** * Gets the type of stream with maximum last timestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly typeOfStreamWithMaxLastTimestamp?: string; /** * Gets the timescale in which "MinLastTimestamp" is represented. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timescaleOfMinLastTimestamp?: string; /** * Gets the timescale in which "MaxLastTimestamp" is represented. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timescaleOfMaxLastTimestamp?: string; } @@ -1816,27 +1722,22 @@ export interface MediaLiveEventIncomingStreamsOutOfSyncEventData { export interface MediaLiveEventIncomingVideoStreamsOutOfSyncEventData { /** * Gets the first timestamp received for one of the quality levels. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly firstTimestamp?: string; /** * Gets the duration of the data chunk with first timestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly firstDuration?: string; /** * Gets the timestamp received for some other quality levels. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly secondTimestamp?: string; /** * Gets the duration of the data chunk with second timestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly secondDuration?: string; /** * Gets the timescale in which both the timestamps and durations are represented. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timescale?: string; } @@ -1847,32 +1748,26 @@ export interface MediaLiveEventIncomingVideoStreamsOutOfSyncEventData { export interface MediaLiveEventIncomingDataChunkDroppedEventData { /** * Gets the timestamp of the data chunk dropped. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timestamp?: string; /** * Gets the type of the track (Audio / Video). - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackType?: string; /** * Gets the bitrate of the track. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly bitrate?: number; /** * Gets the timescale of the Timestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timescale?: string; /** * Gets the result code for fragment drop operation. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly resultCode?: string; /** * Gets the name of the track for which fragment is dropped. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackName?: string; } @@ -1883,62 +1778,50 @@ export interface MediaLiveEventIncomingDataChunkDroppedEventData { export interface MediaLiveEventIngestHeartbeatEventData { /** * Gets the type of the track (Audio / Video). - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackType?: string; /** * Gets the track name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackName?: string; /** * Gets the bitrate of the track. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly bitrate?: number; /** * Gets the incoming bitrate. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly incomingBitrate?: number; /** * Gets the last timestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly lastTimestamp?: string; /** * Gets the timescale of the last timestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timescale?: string; /** * Gets the fragment Overlap count. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly overlapCount?: number; /** * Gets the fragment Discontinuity count. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly discontinuityCount?: number; /** * Gets Non increasing count. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly nonincreasingCount?: number; /** * Gets a value indicating whether unexpected bitrate is present or not. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly unexpectedBitrate?: boolean; /** * Gets the state of the live event. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly state?: string; /** * Gets a value indicating whether preview is healthy or not. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly healthy?: boolean; } @@ -1949,86 +1832,56 @@ export interface MediaLiveEventIngestHeartbeatEventData { export interface MediaLiveEventTrackDiscontinuityDetectedEventData { /** * Gets the type of the track (Audio / Video). - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackType?: string; /** * Gets the track name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly trackName?: string; /** * Gets the bitrate. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly bitrate?: number; /** * Gets the timestamp of the previous fragment. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly previousTimestamp?: string; /** * Gets the timestamp of the current fragment. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly newTimestamp?: string; /** * Gets the timescale in which both timestamps and discontinuity gap are represented. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly timescale?: string; /** * Gets the discontinuity gap between PreviousTimestamp and NewTimestamp. - * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly discontinuityGap?: string; } /** - * Schema of the Data property of an EventGridEvent for a Geofence event (GeofenceEntered, - * GeofenceExited, GeofenceResult). + * Schema of the Data property of an EventGridEvent for a Geofence event (GeofenceEntered, GeofenceExited, GeofenceResult). */ export interface MapsGeofenceEventProperties { /** - * Lists of the geometry ID of the geofence which is expired relative to the user time in the - * request. + * Lists of the geometry ID of the geofence which is expired relative to the user time in the request. */ expiredGeofenceGeometryId?: string[]; /** - * Lists the fence geometries that either fully contain the coordinate position or have an - * overlap with the searchBuffer around the fence. + * Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. */ geometries?: MapsGeofenceGeometry[]; /** - * Lists of the geometry ID of the geofence which is in invalid period relative to the user time - * in the request. + * Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. */ invalidPeriodGeofenceGeometryId?: string[]; /** - * True if at least one event is published to the Azure Maps event subscriber, false if no event - * is published to the Azure Maps event subscriber. + * True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. */ isEventPublished?: boolean; } -/** - * Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceEntered event. - */ -export interface MapsGeofenceEnteredEventData extends MapsGeofenceEventProperties { -} - -/** - * Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceExited event. - */ -export interface MapsGeofenceExitedEventData extends MapsGeofenceEventProperties { -} - -/** - * Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceResult event. - */ -export interface MapsGeofenceResultEventData extends MapsGeofenceEventProperties { -} - /** * The geofence geometry. */ @@ -2038,14 +1891,7 @@ export interface MapsGeofenceGeometry { */ deviceId?: string; /** - * Distance from the coordinate to the closest border of the geofence. Positive means the - * coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more - * than the value of searchBuffer away from the closest geofence border, then the value is 999. - * Negative means the coordinate is inside of the geofence. If the coordinate is inside the - * polygon, but more than the value of searchBuffer away from the closest geofencing border,then - * the value is -999. A value of 999 means that there is great confidence the coordinate is well - * outside the geofence. A value of -999 means that there is great confidence the coordinate is - * well within the geofence. + * Distance from the coordinate to the closest border of the geofence. Positive means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more than the value of searchBuffer away from the closest geofence border, then the value is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside the polygon, but more than the value of searchBuffer away from the closest geofencing border,then the value is -999. A value of 999 means that there is great confidence the coordinate is well outside the geofence. A value of -999 means that there is great confidence the coordinate is well within the geofence. */ distance?: number; /** @@ -2061,15 +1907,28 @@ export interface MapsGeofenceGeometry { */ nearestLon?: number; /** - * The unique id returned from user upload service when uploading a geofence. Will not be - * included in geofencing post API. + * The unique id returned from user upload service when uploading a geofence. Will not be included in geofencing post API. */ udId?: string; } /** - * Schema of the Data property of an EventGridEvent for an - * Microsoft.AppConfiguration.KeyValueModified event. + * Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceEntered event. + */ +export type MapsGeofenceEnteredEventData = MapsGeofenceEventProperties & {}; + +/** + * Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceExited event. + */ +export type MapsGeofenceExitedEventData = MapsGeofenceEventProperties & {}; + +/** + * Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceResult event. + */ +export type MapsGeofenceResultEventData = MapsGeofenceEventProperties & {}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.AppConfiguration.KeyValueModified event. */ export interface AppConfigurationKeyValueModifiedEventData { /** @@ -2087,8 +1946,7 @@ export interface AppConfigurationKeyValueModifiedEventData { } /** - * Schema of the Data property of an EventGridEvent for an - * Microsoft.AppConfiguration.KeyValueDeleted event. + * Schema of the Data property of an EventGridEvent for an Microsoft.AppConfiguration.KeyValueDeleted event. */ export interface AppConfigurationKeyValueDeletedEventData { /** @@ -2106,8 +1964,7 @@ export interface AppConfigurationKeyValueDeletedEventData { } /** - * Schema of the Data property of an EventGridEvent for a - * Microsoft.SignalRService.ClientConnectionConnected event. + * Schema of the Data property of an EventGridEvent for a Microsoft.SignalRService.ClientConnectionConnected event. */ export interface SignalRServiceClientConnectionConnectedEventData { /** @@ -2129,8 +1986,7 @@ export interface SignalRServiceClientConnectionConnectedEventData { } /** - * Schema of the Data property of an EventGridEvent for a - * Microsoft.SignalRService.ClientConnectionDisconnected event. + * Schema of the Data property of an EventGridEvent for a Microsoft.SignalRService.ClientConnectionDisconnected event. */ export interface SignalRServiceClientConnectionDisconnectedEventData { /** @@ -2462,8 +2318,7 @@ export interface KeyVaultSecretExpiredEventData { } /** - * Schema of the Data property of an EventGridEvent for an - * Microsoft.MachineLearningServices.ModelRegistered event. + * Schema of the Data property of an EventGridEvent for an Microsoft.MachineLearningServices.ModelRegistered event. */ export interface MachineLearningServicesModelRegisteredEventData { /** @@ -2473,7 +2328,7 @@ export interface MachineLearningServicesModelRegisteredEventData { /** * The version of the model that was registered. */ - modelVersion?: number; + modelVersion?: string; /** * The tags of the model that was registered. */ @@ -2485,8 +2340,7 @@ export interface MachineLearningServicesModelRegisteredEventData { } /** - * Schema of the Data property of an EventGridEvent for an - * Microsoft.MachineLearningServices.ModelDeployed event. + * Schema of the Data property of an EventGridEvent for an Microsoft.MachineLearningServices.ModelDeployed event. */ export interface MachineLearningServicesModelDeployedEventData { /** @@ -2512,8 +2366,7 @@ export interface MachineLearningServicesModelDeployedEventData { } /** - * Schema of the Data property of an EventGridEvent for an - * Microsoft.MachineLearningServices.RunCompleted event. + * Schema of the Data property of an EventGridEvent for an Microsoft.MachineLearningServices.RunCompleted event. */ export interface MachineLearningServicesRunCompletedEventData { /** @@ -2543,8 +2396,7 @@ export interface MachineLearningServicesRunCompletedEventData { } /** - * Schema of the Data property of an EventGridEvent for an - * Microsoft.MachineLearningServices.DatasetDriftDetected event. + * Schema of the Data property of an EventGridEvent for an Microsoft.MachineLearningServices.DatasetDriftDetected event. */ export interface MachineLearningServicesDatasetDriftDetectedEventData { /** @@ -2582,36 +2434,678 @@ export interface MachineLearningServicesDatasetDriftDetectedEventData { } /** - * Defines values for MediaJobState. - * Possible values include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', 'Queued', - * 'Scheduled' - * @readonly - * @enum {string} - */ -export type MediaJobState = 'Canceled' | 'Canceling' | 'Error' | 'Finished' | 'Processing' | 'Queued' | 'Scheduled'; - -/** - * Defines values for MediaJobErrorCode. - * Possible values include: 'ServiceError', 'ServiceTransientError', 'DownloadNotAccessible', - * 'DownloadTransientError', 'UploadNotAccessible', 'UploadTransientError', - * 'ConfigurationUnsupported', 'ContentMalformed', 'ContentUnsupported' - * @readonly - * @enum {string} + * Schema of the Data property of an EventGridEvent for an Microsoft.MachineLearningServices.RunStatusChanged event. */ -export type MediaJobErrorCode = 'ServiceError' | 'ServiceTransientError' | 'DownloadNotAccessible' | 'DownloadTransientError' | 'UploadNotAccessible' | 'UploadTransientError' | 'ConfigurationUnsupported' | 'ContentMalformed' | 'ContentUnsupported'; +export interface MachineLearningServicesRunStatusChangedEventData { + /** + * The ID of the experiment that the Machine Learning Run belongs to. + */ + experimentId?: string; + /** + * The name of the experiment that the Machine Learning Run belongs to. + */ + experimentName?: string; + /** + * The ID of the Machine Learning Run. + */ + runId?: string; + /** + * The Run Type of the Machine Learning Run. + */ + runType?: string; + /** + * The tags of the Machine Learning Run. + */ + runTags?: any; + /** + * The properties of the Machine Learning Run. + */ + runProperties?: any; + /** + * The status of the Machine Learning Run. + */ + runStatus?: string; +} /** - * Defines values for MediaJobErrorCategory. - * Possible values include: 'Service', 'Download', 'Upload', 'Configuration', 'Content' - * @readonly - * @enum {string} + * Schema of the Data property of an EventGridEvent for an Microsoft.Cache.PatchingCompleted event. + */ +export interface RedisPatchingCompletedEventData { + /** + * The time at which the event occurred. + */ + timestamp?: Date; + /** + * The name of this event. + */ + name?: string; + /** + * The status of this event. Failed or succeeded + */ + status?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Cache.ScalingCompleted event. + */ +export interface RedisScalingCompletedEventData { + /** + * The time at which the event occurred. + */ + timestamp?: Date; + /** + * The name of this event. + */ + name?: string; + /** + * The status of this event. Failed or succeeded + */ + status?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Cache.ExportRDBCompleted event. + */ +export interface RedisExportRDBCompletedEventData { + /** + * The time at which the event occurred. + */ + timestamp?: Date; + /** + * The name of this event. + */ + name?: string; + /** + * The status of this event. Failed or succeeded + */ + status?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Cache.ImportRDBCompleted event. + */ +export interface RedisImportRDBCompletedEventData { + /** + * The time at which the event occurred. + */ + timestamp?: Date; + /** + * The name of this event. + */ + name?: string; + /** + * The status of this event. Failed or succeeded + */ + status?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.AppUpdated event. + */ +export interface WebAppUpdatedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Detail of action on the app. + */ +export interface AppEventTypeDetail { + /** + * Type of action of the operation. + */ + action?: AppAction; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.BackupOperationStarted event. + */ +export interface WebBackupOperationStartedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.BackupOperationCompleted event. + */ +export interface WebBackupOperationCompletedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.BackupOperationFailed event. + */ +export interface WebBackupOperationFailedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.RestoreOperationStarted event. + */ +export interface WebRestoreOperationStartedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.RestoreOperationCompleted event. + */ +export interface WebRestoreOperationCompletedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.RestoreOperationFailed event. + */ +export interface WebRestoreOperationFailedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.SlotSwapStarted event. + */ +export interface WebSlotSwapStartedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.SlotSwapCompleted event. + */ +export interface WebSlotSwapCompletedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.SlotSwapFailed event. + */ +export interface WebSlotSwapFailedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.SlotSwapWithPreviewStarted event. + */ +export interface WebSlotSwapWithPreviewStartedEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.SlotSwapWithPreviewCancelled event. */ -export type MediaJobErrorCategory = 'Service' | 'Download' | 'Upload' | 'Configuration' | 'Content'; +export interface WebSlotSwapWithPreviewCancelledEventData { + /** + * Detail of action on the app. + */ + appEventTypeDetail?: AppEventTypeDetail; + /** + * name of the web site that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the site API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the site API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the site API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Web.AppServicePlanUpdated event. + */ +export interface WebAppServicePlanUpdatedEventData { + /** + * Detail of action on the app service plan. + */ + appServicePlanEventTypeDetail?: AppServicePlanEventTypeDetail; + /** + * sku of app service plan. + */ + sku?: WebAppServicePlanUpdatedEventDataSku; + /** + * name of the app service plan that had this event. + */ + name?: string; + /** + * The client request id generated by the app service for the app service plan API operation that triggered this event. + */ + clientRequestId?: string; + /** + * The correlation request id generated by the app service for the app service plan API operation that triggered this event. + */ + correlationRequestId?: string; + /** + * The request id generated by the app service for the app service plan API operation that triggered this event. + */ + requestId?: string; + /** + * HTTP request URL of this operation. + */ + address?: string; + /** + * HTTP verb of this operation. + */ + verb?: string; +} + +/** + * Detail of action on the app service plan. + */ +export interface AppServicePlanEventTypeDetail { + /** + * Kind of environment where app service plan is. + */ + stampKind?: StampKind; + /** + * Type of action on the app service plan. + */ + action?: "Updated"; + /** + * Asynchronous operation status of the operation on the app service plan. + */ + status?: AsyncStatus; +} + +/** + * sku of app service plan. + */ +export interface WebAppServicePlanUpdatedEventDataSku { + /** + * name of app service plan sku. + */ + name?: string; + /** + * tier of app service plan sku. + */ + tier?: string; + /** + * size of app service plan sku. + */ + size?: string; + /** + * family of app service plan sku. + */ + family?: string; + /** + * capacity of app service plan sku. + */ + capacity?: string; +} + +/** + * Defines values for AppAction. + */ +export type AppAction = + | "Restarted" + | "Stopped" + | "ChangedAppSettings" + | "Started" + | "Completed" + | "Failed"; +/** + * Defines values for StampKind. + */ +export type StampKind = "Public" | "AseV1" | "AseV2"; +/** + * Defines values for AsyncStatus. + */ +export type AsyncStatus = "Started" | "Completed" | "Failed"; +/** + * Defines values for MediaJobState. + */ +export type MediaJobState = + | "Canceled" + | "Canceling" + | "Error" + | "Finished" + | "Processing" + | "Queued" + | "Scheduled"; +/** + * Defines values for MediaJobErrorCode. + */ +export type MediaJobErrorCode = + | "ServiceError" + | "ServiceTransientError" + | "DownloadNotAccessible" + | "DownloadTransientError" + | "UploadNotAccessible" + | "UploadTransientError" + | "ConfigurationUnsupported" + | "ContentMalformed" + | "ContentUnsupported"; +/** + * Defines values for MediaJobErrorCategory. + */ +export type MediaJobErrorCategory = + | "Service" + | "Download" + | "Upload" + | "Configuration" + | "Content"; /** * Defines values for MediaJobRetry. - * Possible values include: 'DoNotRetry', 'MayRetry' - * @readonly - * @enum {string} */ -export type MediaJobRetry = 'DoNotRetry' | 'MayRetry'; +export type MediaJobRetry = "DoNotRetry" | "MayRetry"; + +/** + * Optional parameters. + */ +export interface GeneratedClientOptionalParams + extends coreHttp.ServiceClientOptions { + /** + * Api Version + */ + apiVersion?: string; + /** + * Overrides client endpoint. + */ + endpoint?: string; +} diff --git a/sdk/eventgrid/eventgrid/src/models/mappers.ts b/sdk/eventgrid/eventgrid/src/generated/models/mappers.ts similarity index 69% rename from sdk/eventgrid/eventgrid/src/models/mappers.ts rename to sdk/eventgrid/eventgrid/src/generated/models/mappers.ts index ce98ef624266..d28a0c5687f2 100644 --- a/sdk/eventgrid/eventgrid/src/models/mappers.ts +++ b/sdk/eventgrid/eventgrid/src/generated/models/mappers.ts @@ -1,19 +1,152 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreHttp from "@azure/core-http"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; +export const EventGridEvent: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "EventGridEvent", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + topic: { + serializedName: "topic", + type: { + name: "String" + } + }, + subject: { + serializedName: "subject", + required: true, + type: { + name: "String" + } + }, + data: { + serializedName: "data", + required: true, + type: { + name: "any" + } + }, + eventType: { + serializedName: "eventType", + required: true, + type: { + name: "String" + } + }, + eventTime: { + serializedName: "eventTime", + required: true, + type: { + name: "DateTime" + } + }, + metadataVersion: { + serializedName: "metadataVersion", + readOnly: true, + type: { + name: "String" + } + }, + dataVersion: { + serializedName: "dataVersion", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CloudEvent: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CloudEvent", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + source: { + serializedName: "source", + required: true, + type: { + name: "String" + } + }, + data: { + serializedName: "data", + type: { + name: "any" + } + }, + dataBase64: { + serializedName: "data_base64", + type: { + name: "ByteArray" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + }, + time: { + serializedName: "time", + type: { + name: "DateTime" + } + }, + specversion: { + serializedName: "specversion", + required: true, + type: { + name: "String" + } + }, + dataschema: { + serializedName: "dataschema", + type: { + name: "String" + } + }, + datacontenttype: { + serializedName: "datacontenttype", + type: { + name: "String" + } + }, + subject: { + serializedName: "subject", + type: { + name: "String" + } + } + } + } +}; -export const StorageBlobCreatedEventData: msRest.CompositeMapper = { - serializedName: "StorageBlobCreatedEventData", +export const StorageBlobCreatedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "StorageBlobCreatedEventData", @@ -87,15 +220,14 @@ export const StorageBlobCreatedEventData: msRest.CompositeMapper = { storageDiagnostics: { serializedName: "storageDiagnostics", type: { - name: "Object" + name: "any" } } } } }; -export const StorageBlobDeletedEventData: msRest.CompositeMapper = { - serializedName: "StorageBlobDeletedEventData", +export const StorageBlobDeletedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "StorageBlobDeletedEventData", @@ -151,15 +283,14 @@ export const StorageBlobDeletedEventData: msRest.CompositeMapper = { storageDiagnostics: { serializedName: "storageDiagnostics", type: { - name: "Object" + name: "any" } } } } }; -export const StorageDirectoryCreatedEventData: msRest.CompositeMapper = { - serializedName: "StorageDirectoryCreatedEventData", +export const StorageDirectoryCreatedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "StorageDirectoryCreatedEventData", @@ -209,15 +340,14 @@ export const StorageDirectoryCreatedEventData: msRest.CompositeMapper = { storageDiagnostics: { serializedName: "storageDiagnostics", type: { - name: "Object" + name: "any" } } } } }; -export const StorageDirectoryDeletedEventData: msRest.CompositeMapper = { - serializedName: "StorageDirectoryDeletedEventData", +export const StorageDirectoryDeletedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "StorageDirectoryDeletedEventData", @@ -267,15 +397,14 @@ export const StorageDirectoryDeletedEventData: msRest.CompositeMapper = { storageDiagnostics: { serializedName: "storageDiagnostics", type: { - name: "Object" + name: "any" } } } } }; -export const StorageBlobRenamedEventData: msRest.CompositeMapper = { - serializedName: "StorageBlobRenamedEventData", +export const StorageBlobRenamedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "StorageBlobRenamedEventData", @@ -325,15 +454,14 @@ export const StorageBlobRenamedEventData: msRest.CompositeMapper = { storageDiagnostics: { serializedName: "storageDiagnostics", type: { - name: "Object" + name: "any" } } } } }; -export const StorageDirectoryRenamedEventData: msRest.CompositeMapper = { - serializedName: "StorageDirectoryRenamedEventData", +export const StorageDirectoryRenamedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "StorageDirectoryRenamedEventData", @@ -383,15 +511,77 @@ export const StorageDirectoryRenamedEventData: msRest.CompositeMapper = { storageDiagnostics: { serializedName: "storageDiagnostics", type: { - name: "Object" + name: "any" + } + } + } + } +}; + +export const StorageLifecyclePolicyCompletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "StorageLifecyclePolicyCompletedEventData", + modelProperties: { + scheduleTime: { + serializedName: "scheduleTime", + type: { + name: "String" + } + }, + deleteSummary: { + serializedName: "deleteSummary", + type: { + name: "Composite", + className: "StorageLifecyclePolicyActionSummaryDetail" + } + }, + tierToCoolSummary: { + serializedName: "tierToCoolSummary", + type: { + name: "Composite", + className: "StorageLifecyclePolicyActionSummaryDetail" + } + }, + tierToArchiveSummary: { + serializedName: "tierToArchiveSummary", + type: { + name: "Composite", + className: "StorageLifecyclePolicyActionSummaryDetail" + } + } + } + } +}; + +export const StorageLifecyclePolicyActionSummaryDetail: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "StorageLifecyclePolicyActionSummaryDetail", + modelProperties: { + totalObjectsCount: { + serializedName: "totalObjectsCount", + type: { + name: "Number" + } + }, + successCount: { + serializedName: "successCount", + type: { + name: "Number" + } + }, + errorList: { + serializedName: "errorList", + type: { + name: "String" } } } } }; -export const EventHubCaptureFileCreatedEventData: msRest.CompositeMapper = { - serializedName: "EventHubCaptureFileCreatedEventData", +export const EventHubCaptureFileCreatedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "EventHubCaptureFileCreatedEventData", @@ -454,11 +644,10 @@ export const EventHubCaptureFileCreatedEventData: msRest.CompositeMapper = { } }; -export const ResourceWriteSuccessData: msRest.CompositeMapper = { - serializedName: "ResourceWriteSuccessData", +export const ResourceWriteSuccessEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceWriteSuccessData", + className: "ResourceWriteSuccessEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -530,11 +719,10 @@ export const ResourceWriteSuccessData: msRest.CompositeMapper = { } }; -export const ResourceWriteFailureData: msRest.CompositeMapper = { - serializedName: "ResourceWriteFailureData", +export const ResourceWriteFailureEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceWriteFailureData", + className: "ResourceWriteFailureEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -606,11 +794,10 @@ export const ResourceWriteFailureData: msRest.CompositeMapper = { } }; -export const ResourceWriteCancelData: msRest.CompositeMapper = { - serializedName: "ResourceWriteCancelData", +export const ResourceWriteCancelEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceWriteCancelData", + className: "ResourceWriteCancelEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -682,11 +869,10 @@ export const ResourceWriteCancelData: msRest.CompositeMapper = { } }; -export const ResourceDeleteSuccessData: msRest.CompositeMapper = { - serializedName: "ResourceDeleteSuccessData", +export const ResourceDeleteSuccessEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceDeleteSuccessData", + className: "ResourceDeleteSuccessEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -758,11 +944,10 @@ export const ResourceDeleteSuccessData: msRest.CompositeMapper = { } }; -export const ResourceDeleteFailureData: msRest.CompositeMapper = { - serializedName: "ResourceDeleteFailureData", +export const ResourceDeleteFailureEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceDeleteFailureData", + className: "ResourceDeleteFailureEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -834,11 +1019,10 @@ export const ResourceDeleteFailureData: msRest.CompositeMapper = { } }; -export const ResourceDeleteCancelData: msRest.CompositeMapper = { - serializedName: "ResourceDeleteCancelData", +export const ResourceDeleteCancelEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceDeleteCancelData", + className: "ResourceDeleteCancelEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -910,11 +1094,10 @@ export const ResourceDeleteCancelData: msRest.CompositeMapper = { } }; -export const ResourceActionSuccessData: msRest.CompositeMapper = { - serializedName: "ResourceActionSuccessData", +export const ResourceActionSuccessEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceActionSuccessData", + className: "ResourceActionSuccessEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -986,11 +1169,10 @@ export const ResourceActionSuccessData: msRest.CompositeMapper = { } }; -export const ResourceActionFailureData: msRest.CompositeMapper = { - serializedName: "ResourceActionFailureData", +export const ResourceActionFailureEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceActionFailureData", + className: "ResourceActionFailureEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -1062,11 +1244,10 @@ export const ResourceActionFailureData: msRest.CompositeMapper = { } }; -export const ResourceActionCancelData: msRest.CompositeMapper = { - serializedName: "ResourceActionCancelData", +export const ResourceActionCancelEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ResourceActionCancelData", + className: "ResourceActionCancelEventData", modelProperties: { tenantId: { serializedName: "tenantId", @@ -1138,87 +1319,21 @@ export const ResourceActionCancelData: msRest.CompositeMapper = { } }; -export const EventGridEvent: msRest.CompositeMapper = { - serializedName: "EventGridEvent", - type: { - name: "Composite", - className: "EventGridEvent", - modelProperties: { - id: { - required: true, - serializedName: "id", - type: { - name: "String" - } - }, - topic: { - serializedName: "topic", - type: { - name: "String" - } - }, - subject: { - required: true, - serializedName: "subject", - type: { - name: "String" - } - }, - data: { - required: true, - serializedName: "data", - type: { - name: "Object" - } - }, - eventType: { - required: true, - serializedName: "eventType", - type: { - name: "String" - } - }, - eventTime: { - required: true, - serializedName: "eventTime", - type: { - name: "DateTime" - } - }, - metadataVersion: { - readOnly: true, - serializedName: "metadataVersion", - type: { - name: "String" - } - }, - dataVersion: { - required: true, - serializedName: "dataVersion", - type: { - name: "String" - } - } - } - } -}; - -export const SubscriptionValidationEventData: msRest.CompositeMapper = { - serializedName: "SubscriptionValidationEventData", +export const SubscriptionValidationEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "SubscriptionValidationEventData", modelProperties: { validationCode: { - readOnly: true, serializedName: "validationCode", + readOnly: true, type: { name: "String" } }, validationUrl: { - readOnly: true, serializedName: "validationUrl", + readOnly: true, type: { name: "String" } @@ -1227,8 +1342,7 @@ export const SubscriptionValidationEventData: msRest.CompositeMapper = { } }; -export const SubscriptionValidationResponse: msRest.CompositeMapper = { - serializedName: "SubscriptionValidationResponse", +export const SubscriptionValidationResponse: coreHttp.CompositeMapper = { type: { name: "Composite", className: "SubscriptionValidationResponse", @@ -1243,15 +1357,14 @@ export const SubscriptionValidationResponse: msRest.CompositeMapper = { } }; -export const SubscriptionDeletedEventData: msRest.CompositeMapper = { - serializedName: "SubscriptionDeletedEventData", +export const SubscriptionDeletedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "SubscriptionDeletedEventData", modelProperties: { eventSubscriptionId: { - readOnly: true, serializedName: "eventSubscriptionId", + readOnly: true, type: { name: "String" } @@ -1260,8 +1373,7 @@ export const SubscriptionDeletedEventData: msRest.CompositeMapper = { } }; -export const DeviceLifeCycleEventProperties: msRest.CompositeMapper = { - serializedName: "DeviceLifeCycleEventProperties", +export const DeviceLifeCycleEventProperties: coreHttp.CompositeMapper = { type: { name: "Composite", className: "DeviceLifeCycleEventProperties", @@ -1289,152 +1401,107 @@ export const DeviceLifeCycleEventProperties: msRest.CompositeMapper = { } }; -export const IotHubDeviceCreatedEventData: msRest.CompositeMapper = { - serializedName: "IotHubDeviceCreatedEventData", - type: { - name: "Composite", - className: "IotHubDeviceCreatedEventData", - modelProperties: { - ...DeviceLifeCycleEventProperties.type.modelProperties - } - } -}; - -export const IotHubDeviceDeletedEventData: msRest.CompositeMapper = { - serializedName: "IotHubDeviceDeletedEventData", - type: { - name: "Composite", - className: "IotHubDeviceDeletedEventData", - modelProperties: { - ...DeviceLifeCycleEventProperties.type.modelProperties - } - } -}; - -export const DeviceConnectionStateEventProperties: msRest.CompositeMapper = { - serializedName: "DeviceConnectionStateEventProperties", +export const DeviceTwinInfo: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "DeviceConnectionStateEventProperties", + className: "DeviceTwinInfo", modelProperties: { - deviceId: { - serializedName: "deviceId", + authenticationType: { + serializedName: "authenticationType", type: { name: "String" } }, - moduleId: { - serializedName: "moduleId", + cloudToDeviceMessageCount: { + serializedName: "cloudToDeviceMessageCount", + type: { + name: "Number" + } + }, + connectionState: { + serializedName: "connectionState", type: { name: "String" } }, - hubName: { - serializedName: "hubName", + deviceId: { + serializedName: "deviceId", type: { name: "String" } }, - deviceConnectionStateEventInfo: { - serializedName: "deviceConnectionStateEventInfo", + etag: { + serializedName: "etag", type: { - name: "Composite", - className: "DeviceConnectionStateEventInfo" + name: "String" } - } - } - } -}; - -export const IotHubDeviceConnectedEventData: msRest.CompositeMapper = { - serializedName: "IotHubDeviceConnectedEventData", - type: { - name: "Composite", - className: "IotHubDeviceConnectedEventData", - modelProperties: { - ...DeviceConnectionStateEventProperties.type.modelProperties - } - } -}; - -export const IotHubDeviceDisconnectedEventData: msRest.CompositeMapper = { - serializedName: "IotHubDeviceDisconnectedEventData", - type: { - name: "Composite", - className: "IotHubDeviceDisconnectedEventData", - modelProperties: { - ...DeviceConnectionStateEventProperties.type.modelProperties - } - } -}; - -export const DeviceTelemetryEventProperties: msRest.CompositeMapper = { - serializedName: "DeviceTelemetryEventProperties", - type: { - name: "Composite", - className: "DeviceTelemetryEventProperties", - modelProperties: { - body: { - serializedName: "body", + }, + lastActivityTime: { + serializedName: "lastActivityTime", type: { - name: "Object" + name: "String" } }, properties: { serializedName: "properties", type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } + name: "Composite", + className: "DeviceTwinInfoProperties" } }, - systemProperties: { - serializedName: "systemProperties", + status: { + serializedName: "status", type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } + name: "String" + } + }, + statusUpdateTime: { + serializedName: "statusUpdateTime", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "Number" + } + }, + x509Thumbprint: { + serializedName: "x509Thumbprint", + type: { + name: "Composite", + className: "DeviceTwinInfoX509Thumbprint" } } } } }; -export const IotHubDeviceTelemetryEventData: msRest.CompositeMapper = { - serializedName: "IotHubDeviceTelemetryEventData", +export const DeviceTwinInfoProperties: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "IotHubDeviceTelemetryEventData", - modelProperties: { - ...DeviceTelemetryEventProperties.type.modelProperties - } - } -}; - -export const DeviceTwinMetadata: msRest.CompositeMapper = { - serializedName: "DeviceTwinMetadata", - type: { - name: "Composite", - className: "DeviceTwinMetadata", + className: "DeviceTwinInfoProperties", modelProperties: { - lastUpdated: { - serializedName: "lastUpdated", + desired: { + serializedName: "desired", type: { - name: "String" + name: "Composite", + className: "DeviceTwinProperties" + } + }, + reported: { + serializedName: "reported", + type: { + name: "Composite", + className: "DeviceTwinProperties" } } } } }; -export const DeviceTwinProperties: msRest.CompositeMapper = { - serializedName: "DeviceTwinProperties", +export const DeviceTwinProperties: coreHttp.CompositeMapper = { type: { name: "Composite", className: "DeviceTwinProperties", @@ -1456,32 +1523,22 @@ export const DeviceTwinProperties: msRest.CompositeMapper = { } }; -export const DeviceTwinInfoProperties: msRest.CompositeMapper = { - serializedName: "DeviceTwinInfo_properties", +export const DeviceTwinMetadata: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "DeviceTwinInfoProperties", + className: "DeviceTwinMetadata", modelProperties: { - desired: { - serializedName: "desired", - type: { - name: "Composite", - className: "DeviceTwinProperties" - } - }, - reported: { - serializedName: "reported", + lastUpdated: { + serializedName: "lastUpdated", type: { - name: "Composite", - className: "DeviceTwinProperties" + name: "String" } } } } }; -export const DeviceTwinInfoX509Thumbprint: msRest.CompositeMapper = { - serializedName: "DeviceTwinInfo_x509Thumbprint", +export const DeviceTwinInfoX509Thumbprint: coreHttp.CompositeMapper = { type: { name: "Composite", className: "DeviceTwinInfoX509Thumbprint", @@ -1502,102 +1559,135 @@ export const DeviceTwinInfoX509Thumbprint: msRest.CompositeMapper = { } }; -export const DeviceTwinInfo: msRest.CompositeMapper = { - serializedName: "DeviceTwinInfo", +export const IotHubDeviceCreatedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "DeviceTwinInfo", + className: "IotHubDeviceCreatedEventData", + modelProperties: { + ...DeviceLifeCycleEventProperties.type.modelProperties + } + } +}; + +export const IotHubDeviceDeletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "IotHubDeviceDeletedEventData", + modelProperties: { + ...DeviceLifeCycleEventProperties.type.modelProperties + } + } +}; + +export const DeviceConnectionStateEventProperties: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceConnectionStateEventProperties", modelProperties: { - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String" - } - }, - cloudToDeviceMessageCount: { - serializedName: "cloudToDeviceMessageCount", - type: { - name: "Number" - } - }, - connectionState: { - serializedName: "connectionState", - type: { - name: "String" - } - }, deviceId: { serializedName: "deviceId", type: { name: "String" } }, - etag: { - serializedName: "etag", + moduleId: { + serializedName: "moduleId", type: { name: "String" } }, - lastActivityTime: { - serializedName: "lastActivityTime", + hubName: { + serializedName: "hubName", type: { name: "String" } }, - properties: { - serializedName: "properties", + deviceConnectionStateEventInfo: { + serializedName: "deviceConnectionStateEventInfo", type: { name: "Composite", - className: "DeviceTwinInfoProperties" + className: "DeviceConnectionStateEventInfo" } - }, - status: { - serializedName: "status", + } + } + } +}; + +export const DeviceConnectionStateEventInfo: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceConnectionStateEventInfo", + modelProperties: { + sequenceNumber: { + serializedName: "sequenceNumber", type: { name: "String" } - }, - statusUpdateTime: { - serializedName: "statusUpdateTime", + } + } + } +}; + +export const IotHubDeviceConnectedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "IotHubDeviceConnectedEventData", + modelProperties: { + ...DeviceConnectionStateEventProperties.type.modelProperties + } + } +}; + +export const IotHubDeviceDisconnectedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "IotHubDeviceDisconnectedEventData", + modelProperties: { + ...DeviceConnectionStateEventProperties.type.modelProperties + } + } +}; + +export const DeviceTelemetryEventProperties: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceTelemetryEventProperties", + modelProperties: { + body: { + serializedName: "body", type: { - name: "String" + name: "any" } }, - version: { - serializedName: "version", + properties: { + serializedName: "properties", type: { - name: "Number" + name: "Dictionary", + value: { type: { name: "String" } } } }, - x509Thumbprint: { - serializedName: "x509Thumbprint", + systemProperties: { + serializedName: "systemProperties", type: { - name: "Composite", - className: "DeviceTwinInfoX509Thumbprint" + name: "Dictionary", + value: { type: { name: "String" } } } } } } }; -export const DeviceConnectionStateEventInfo: msRest.CompositeMapper = { - serializedName: "DeviceConnectionStateEventInfo", +export const IotHubDeviceTelemetryEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "DeviceConnectionStateEventInfo", + className: "IotHubDeviceTelemetryEventData", modelProperties: { - sequenceNumber: { - serializedName: "sequenceNumber", - type: { - name: "String" - } - } + ...DeviceTelemetryEventProperties.type.modelProperties } } }; -export const ContainerRegistryEventData: msRest.CompositeMapper = { - serializedName: "ContainerRegistryEventData", +export const ContainerRegistryEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "ContainerRegistryEventData", @@ -1652,90 +1742,10 @@ export const ContainerRegistryEventData: msRest.CompositeMapper = { } }; -export const ContainerRegistryImagePushedEventData: msRest.CompositeMapper = { - serializedName: "ContainerRegistryImagePushedEventData", - type: { - name: "Composite", - className: "ContainerRegistryImagePushedEventData", - modelProperties: { - ...ContainerRegistryEventData.type.modelProperties - } - } -}; - -export const ContainerRegistryImageDeletedEventData: msRest.CompositeMapper = { - serializedName: "ContainerRegistryImageDeletedEventData", +export const ContainerRegistryEventTarget: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "ContainerRegistryImageDeletedEventData", - modelProperties: { - ...ContainerRegistryEventData.type.modelProperties - } - } -}; - -export const ContainerRegistryArtifactEventData: msRest.CompositeMapper = { - serializedName: "ContainerRegistryArtifactEventData", - type: { - name: "Composite", - className: "ContainerRegistryArtifactEventData", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - timestamp: { - serializedName: "timestamp", - type: { - name: "DateTime" - } - }, - action: { - serializedName: "action", - type: { - name: "String" - } - }, - target: { - serializedName: "target", - type: { - name: "Composite", - className: "ContainerRegistryArtifactEventTarget" - } - } - } - } -}; - -export const ContainerRegistryChartPushedEventData: msRest.CompositeMapper = { - serializedName: "ContainerRegistryChartPushedEventData", - type: { - name: "Composite", - className: "ContainerRegistryChartPushedEventData", - modelProperties: { - ...ContainerRegistryArtifactEventData.type.modelProperties - } - } -}; - -export const ContainerRegistryChartDeletedEventData: msRest.CompositeMapper = { - serializedName: "ContainerRegistryChartDeletedEventData", - type: { - name: "Composite", - className: "ContainerRegistryChartDeletedEventData", - modelProperties: { - ...ContainerRegistryArtifactEventData.type.modelProperties - } - } -}; - -export const ContainerRegistryEventTarget: msRest.CompositeMapper = { - serializedName: "ContainerRegistryEventTarget", - type: { - name: "Composite", - className: "ContainerRegistryEventTarget", + className: "ContainerRegistryEventTarget", modelProperties: { mediaType: { serializedName: "mediaType", @@ -1783,8 +1793,7 @@ export const ContainerRegistryEventTarget: msRest.CompositeMapper = { } }; -export const ContainerRegistryEventRequest: msRest.CompositeMapper = { - serializedName: "ContainerRegistryEventRequest", +export const ContainerRegistryEventRequest: coreHttp.CompositeMapper = { type: { name: "Composite", className: "ContainerRegistryEventRequest", @@ -1823,8 +1832,7 @@ export const ContainerRegistryEventRequest: msRest.CompositeMapper = { } }; -export const ContainerRegistryEventActor: msRest.CompositeMapper = { - serializedName: "ContainerRegistryEventActor", +export const ContainerRegistryEventActor: coreHttp.CompositeMapper = { type: { name: "Composite", className: "ContainerRegistryEventActor", @@ -1839,8 +1847,7 @@ export const ContainerRegistryEventActor: msRest.CompositeMapper = { } }; -export const ContainerRegistryEventSource: msRest.CompositeMapper = { - serializedName: "ContainerRegistryEventSource", +export const ContainerRegistryEventSource: coreHttp.CompositeMapper = { type: { name: "Composite", className: "ContainerRegistryEventSource", @@ -1861,8 +1868,61 @@ export const ContainerRegistryEventSource: msRest.CompositeMapper = { } }; -export const ContainerRegistryArtifactEventTarget: msRest.CompositeMapper = { - serializedName: "ContainerRegistryArtifactEventTarget", +export const ContainerRegistryImagePushedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerRegistryImagePushedEventData", + modelProperties: { + ...ContainerRegistryEventData.type.modelProperties + } + } +}; + +export const ContainerRegistryImageDeletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerRegistryImageDeletedEventData", + modelProperties: { + ...ContainerRegistryEventData.type.modelProperties + } + } +}; + +export const ContainerRegistryArtifactEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerRegistryArtifactEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + action: { + serializedName: "action", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "Composite", + className: "ContainerRegistryArtifactEventTarget" + } + } + } + } +}; + +export const ContainerRegistryArtifactEventTarget: coreHttp.CompositeMapper = { type: { name: "Composite", className: "ContainerRegistryArtifactEventTarget", @@ -1913,8 +1973,27 @@ export const ContainerRegistryArtifactEventTarget: msRest.CompositeMapper = { } }; -export const ServiceBusActiveMessagesAvailableWithNoListenersEventData: msRest.CompositeMapper = { - serializedName: "ServiceBusActiveMessagesAvailableWithNoListenersEventData", +export const ContainerRegistryChartPushedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerRegistryChartPushedEventData", + modelProperties: { + ...ContainerRegistryArtifactEventData.type.modelProperties + } + } +}; + +export const ContainerRegistryChartDeletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerRegistryChartDeletedEventData", + modelProperties: { + ...ContainerRegistryArtifactEventData.type.modelProperties + } + } +}; + +export const ServiceBusActiveMessagesAvailableWithNoListenersEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "ServiceBusActiveMessagesAvailableWithNoListenersEventData", @@ -1959,8 +2038,7 @@ export const ServiceBusActiveMessagesAvailableWithNoListenersEventData: msRest.C } }; -export const ServiceBusDeadletterMessagesAvailableWithNoListenersEventData: msRest.CompositeMapper = { - serializedName: "ServiceBusDeadletterMessagesAvailableWithNoListenersEventData", +export const ServiceBusDeadletterMessagesAvailableWithNoListenersEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "ServiceBusDeadletterMessagesAvailableWithNoListenersEventData", @@ -2005,16 +2083,14 @@ export const ServiceBusDeadletterMessagesAvailableWithNoListenersEventData: msRe } }; -export const MediaJobStateChangeEventData: msRest.CompositeMapper = { - serializedName: "MediaJobStateChangeEventData", +export const MediaJobStateChangeEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaJobStateChangeEventData", modelProperties: { previousState: { - nullable: false, - readOnly: true, serializedName: "previousState", + readOnly: true, type: { name: "Enum", allowedValues: [ @@ -2029,9 +2105,8 @@ export const MediaJobStateChangeEventData: msRest.CompositeMapper = { } }, state: { - nullable: false, - readOnly: true, serializedName: "state", + readOnly: true, type: { name: "Enum", allowedValues: [ @@ -2049,51 +2124,21 @@ export const MediaJobStateChangeEventData: msRest.CompositeMapper = { serializedName: "correlationData", type: { name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const MediaJobErrorDetail: msRest.CompositeMapper = { - serializedName: "MediaJobErrorDetail", - type: { - name: "Composite", - className: "MediaJobErrorDetail", - modelProperties: { - code: { - readOnly: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" + value: { type: { name: "String" } } } } } } }; -export const MediaJobError: msRest.CompositeMapper = { - serializedName: "MediaJobError", +export const MediaJobError: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaJobError", modelProperties: { code: { - nullable: false, - readOnly: true, serializedName: "code", + readOnly: true, type: { name: "Enum", allowedValues: [ @@ -2110,16 +2155,15 @@ export const MediaJobError: msRest.CompositeMapper = { } }, message: { - readOnly: true, serializedName: "message", + readOnly: true, type: { name: "String" } }, category: { - nullable: false, - readOnly: true, serializedName: "category", + readOnly: true, type: { name: "Enum", allowedValues: [ @@ -2132,27 +2176,20 @@ export const MediaJobError: msRest.CompositeMapper = { } }, retry: { - nullable: false, - readOnly: true, serializedName: "retry", + readOnly: true, type: { name: "Enum", - allowedValues: [ - "DoNotRetry", - "MayRetry" - ] + allowedValues: ["DoNotRetry", "MayRetry"] } }, details: { - readOnly: true, serializedName: "details", + readOnly: true, type: { name: "Sequence", element: { - type: { - name: "Composite", - className: "MediaJobErrorDetail" - } + type: { name: "Composite", className: "MediaJobErrorDetail" } } } } @@ -2160,17 +2197,45 @@ export const MediaJobError: msRest.CompositeMapper = { } }; -export const MediaJobOutput: msRest.CompositeMapper = { - serializedName: "MediaJobOutput", +export const MediaJobErrorDetail: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MediaJobErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const MediaJobOutput: coreHttp.CompositeMapper = { type: { name: "Composite", + className: "MediaJobOutput", + uberParent: "MediaJobOutput", polymorphicDiscriminator: { - serializedName: "@odata.type", - clientName: "odatatype" + serializedName: "@odata\\.type", + clientName: "@odata\\.type" }, - uberParent: "MediaJobOutput", - className: "MediaJobOutput", modelProperties: { + odataType: { + serializedName: "@odata\\.type", + type: { + name: "String" + } + }, error: { serializedName: "error", type: { @@ -2185,15 +2250,15 @@ export const MediaJobOutput: msRest.CompositeMapper = { } }, progress: { - required: true, serializedName: "progress", + required: true, type: { name: "Number" } }, state: { - required: true, serializedName: "state", + required: true, type: { name: "Enum", allowedValues: [ @@ -2206,25 +2271,18 @@ export const MediaJobOutput: msRest.CompositeMapper = { "Scheduled" ] } - }, - odatatype: { - required: true, - serializedName: "@odata\\.type", - type: { - name: "String" - } } } } }; -export const MediaJobOutputAsset: msRest.CompositeMapper = { +export const MediaJobOutputAsset: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputAsset", type: { name: "Composite", - polymorphicDiscriminator: MediaJobOutput.type.polymorphicDiscriminator, - uberParent: "MediaJobOutput", className: "MediaJobOutputAsset", + uberParent: "MediaJobOutput", + polymorphicDiscriminator: MediaJobOutput.type.polymorphicDiscriminator, modelProperties: { ...MediaJobOutput.type.modelProperties, assetName: { @@ -2237,7 +2295,7 @@ export const MediaJobOutputAsset: msRest.CompositeMapper = { } }; -export const MediaJobOutputProgressEventData: msRest.CompositeMapper = { +export const MediaJobOutputProgressEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputProgress", type: { name: "Composite", @@ -2259,27 +2317,21 @@ export const MediaJobOutputProgressEventData: msRest.CompositeMapper = { serializedName: "jobCorrelationData", type: { name: "Dictionary", - value: { - type: { - name: "String" - } - } + value: { type: { name: "String" } } } } } } }; -export const MediaJobOutputStateChangeEventData: msRest.CompositeMapper = { - serializedName: "MediaJobOutputStateChangeEventData", +export const MediaJobOutputStateChangeEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaJobOutputStateChangeEventData", modelProperties: { previousState: { - nullable: false, - readOnly: true, serializedName: "previousState", + readOnly: true, type: { name: "Enum", allowedValues: [ @@ -2304,18 +2356,14 @@ export const MediaJobOutputStateChangeEventData: msRest.CompositeMapper = { serializedName: "jobCorrelationData", type: { name: "Dictionary", - value: { - type: { - name: "String" - } - } + value: { type: { name: "String" } } } } } } }; -export const MediaJobScheduledEventData: msRest.CompositeMapper = { +export const MediaJobScheduledEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobScheduled", type: { name: "Composite", @@ -2326,7 +2374,7 @@ export const MediaJobScheduledEventData: msRest.CompositeMapper = { } }; -export const MediaJobProcessingEventData: msRest.CompositeMapper = { +export const MediaJobProcessingEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobProcessing", type: { name: "Composite", @@ -2337,7 +2385,7 @@ export const MediaJobProcessingEventData: msRest.CompositeMapper = { } }; -export const MediaJobCancelingEventData: msRest.CompositeMapper = { +export const MediaJobCancelingEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobCanceling", type: { name: "Composite", @@ -2348,7 +2396,7 @@ export const MediaJobCancelingEventData: msRest.CompositeMapper = { } }; -export const MediaJobFinishedEventData: msRest.CompositeMapper = { +export const MediaJobFinishedEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobFinished", type: { name: "Composite", @@ -2359,19 +2407,14 @@ export const MediaJobFinishedEventData: msRest.CompositeMapper = { serializedName: "outputs", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "MediaJobOutput" - } - } + element: { type: { name: "Composite", className: "MediaJobOutput" } } } } } } }; -export const MediaJobCanceledEventData: msRest.CompositeMapper = { +export const MediaJobCanceledEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobCanceled", type: { name: "Composite", @@ -2382,19 +2425,14 @@ export const MediaJobCanceledEventData: msRest.CompositeMapper = { serializedName: "outputs", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "MediaJobOutput" - } - } + element: { type: { name: "Composite", className: "MediaJobOutput" } } } } } } }; -export const MediaJobErroredEventData: msRest.CompositeMapper = { +export const MediaJobErroredEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobErrored", type: { name: "Composite", @@ -2405,19 +2443,14 @@ export const MediaJobErroredEventData: msRest.CompositeMapper = { serializedName: "outputs", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "MediaJobOutput" - } - } + element: { type: { name: "Composite", className: "MediaJobOutput" } } } } } } }; -export const MediaJobOutputCanceledEventData: msRest.CompositeMapper = { +export const MediaJobOutputCanceledEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputCanceled", type: { name: "Composite", @@ -2428,7 +2461,7 @@ export const MediaJobOutputCanceledEventData: msRest.CompositeMapper = { } }; -export const MediaJobOutputCancelingEventData: msRest.CompositeMapper = { +export const MediaJobOutputCancelingEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputCanceling", type: { name: "Composite", @@ -2439,7 +2472,7 @@ export const MediaJobOutputCancelingEventData: msRest.CompositeMapper = { } }; -export const MediaJobOutputErroredEventData: msRest.CompositeMapper = { +export const MediaJobOutputErroredEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputErrored", type: { name: "Composite", @@ -2450,7 +2483,7 @@ export const MediaJobOutputErroredEventData: msRest.CompositeMapper = { } }; -export const MediaJobOutputFinishedEventData: msRest.CompositeMapper = { +export const MediaJobOutputFinishedEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputFinished", type: { name: "Composite", @@ -2461,7 +2494,7 @@ export const MediaJobOutputFinishedEventData: msRest.CompositeMapper = { } }; -export const MediaJobOutputProcessingEventData: msRest.CompositeMapper = { +export const MediaJobOutputProcessingEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputProcessing", type: { name: "Composite", @@ -2472,7 +2505,7 @@ export const MediaJobOutputProcessingEventData: msRest.CompositeMapper = { } }; -export const MediaJobOutputScheduledEventData: msRest.CompositeMapper = { +export const MediaJobOutputScheduledEventData: coreHttp.CompositeMapper = { serializedName: "#Microsoft.Media.JobOutputScheduled", type: { name: "Composite", @@ -2483,36 +2516,35 @@ export const MediaJobOutputScheduledEventData: msRest.CompositeMapper = { } }; -export const MediaLiveEventEncoderConnectedEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventEncoderConnectedEventData", +export const MediaLiveEventEncoderConnectedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventEncoderConnectedEventData", modelProperties: { ingestUrl: { - readOnly: true, serializedName: "ingestUrl", + readOnly: true, type: { name: "String" } }, streamId: { - readOnly: true, serializedName: "streamId", + readOnly: true, type: { name: "String" } }, encoderIp: { - readOnly: true, serializedName: "encoderIp", + readOnly: true, type: { name: "String" } }, encoderPort: { - readOnly: true, serializedName: "encoderPort", + readOnly: true, type: { name: "String" } @@ -2521,43 +2553,42 @@ export const MediaLiveEventEncoderConnectedEventData: msRest.CompositeMapper = { } }; -export const MediaLiveEventConnectionRejectedEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventConnectionRejectedEventData", +export const MediaLiveEventConnectionRejectedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventConnectionRejectedEventData", modelProperties: { ingestUrl: { - readOnly: true, serializedName: "ingestUrl", + readOnly: true, type: { name: "String" } }, streamId: { - readOnly: true, serializedName: "streamId", + readOnly: true, type: { name: "String" } }, encoderIp: { - readOnly: true, serializedName: "encoderIp", + readOnly: true, type: { name: "String" } }, encoderPort: { - readOnly: true, serializedName: "encoderPort", + readOnly: true, type: { name: "String" } }, resultCode: { - readOnly: true, serializedName: "resultCode", + readOnly: true, type: { name: "String" } @@ -2566,43 +2597,42 @@ export const MediaLiveEventConnectionRejectedEventData: msRest.CompositeMapper = } }; -export const MediaLiveEventEncoderDisconnectedEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventEncoderDisconnectedEventData", +export const MediaLiveEventEncoderDisconnectedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventEncoderDisconnectedEventData", modelProperties: { ingestUrl: { - readOnly: true, serializedName: "ingestUrl", + readOnly: true, type: { name: "String" } }, streamId: { - readOnly: true, serializedName: "streamId", + readOnly: true, type: { name: "String" } }, encoderIp: { - readOnly: true, serializedName: "encoderIp", + readOnly: true, type: { name: "String" } }, encoderPort: { - readOnly: true, serializedName: "encoderPort", + readOnly: true, type: { name: "String" } }, resultCode: { - readOnly: true, serializedName: "resultCode", + readOnly: true, type: { name: "String" } @@ -2611,71 +2641,70 @@ export const MediaLiveEventEncoderDisconnectedEventData: msRest.CompositeMapper } }; -export const MediaLiveEventIncomingStreamReceivedEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventIncomingStreamReceivedEventData", +export const MediaLiveEventIncomingStreamReceivedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventIncomingStreamReceivedEventData", modelProperties: { ingestUrl: { - readOnly: true, serializedName: "ingestUrl", + readOnly: true, type: { name: "String" } }, trackType: { - readOnly: true, serializedName: "trackType", + readOnly: true, type: { name: "String" } }, trackName: { - readOnly: true, serializedName: "trackName", + readOnly: true, type: { name: "String" } }, bitrate: { - readOnly: true, serializedName: "bitrate", + readOnly: true, type: { name: "Number" } }, encoderIp: { - readOnly: true, serializedName: "encoderIp", + readOnly: true, type: { name: "String" } }, encoderPort: { - readOnly: true, serializedName: "encoderPort", + readOnly: true, type: { name: "String" } }, timestamp: { - readOnly: true, serializedName: "timestamp", + readOnly: true, type: { name: "String" } }, duration: { - readOnly: true, serializedName: "duration", + readOnly: true, type: { name: "String" } }, timescale: { - readOnly: true, serializedName: "timescale", + readOnly: true, type: { name: "String" } @@ -2684,50 +2713,49 @@ export const MediaLiveEventIncomingStreamReceivedEventData: msRest.CompositeMapp } }; -export const MediaLiveEventIncomingStreamsOutOfSyncEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventIncomingStreamsOutOfSyncEventData", +export const MediaLiveEventIncomingStreamsOutOfSyncEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventIncomingStreamsOutOfSyncEventData", modelProperties: { minLastTimestamp: { - readOnly: true, serializedName: "minLastTimestamp", + readOnly: true, type: { name: "String" } }, typeOfStreamWithMinLastTimestamp: { - readOnly: true, serializedName: "typeOfStreamWithMinLastTimestamp", + readOnly: true, type: { name: "String" } }, maxLastTimestamp: { - readOnly: true, serializedName: "maxLastTimestamp", + readOnly: true, type: { name: "String" } }, typeOfStreamWithMaxLastTimestamp: { - readOnly: true, serializedName: "typeOfStreamWithMaxLastTimestamp", + readOnly: true, type: { name: "String" } }, timescaleOfMinLastTimestamp: { - readOnly: true, serializedName: "timescaleOfMinLastTimestamp", + readOnly: true, type: { name: "String" } }, timescaleOfMaxLastTimestamp: { - readOnly: true, serializedName: "timescaleOfMaxLastTimestamp", + readOnly: true, type: { name: "String" } @@ -2736,43 +2764,42 @@ export const MediaLiveEventIncomingStreamsOutOfSyncEventData: msRest.CompositeMa } }; -export const MediaLiveEventIncomingVideoStreamsOutOfSyncEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventIncomingVideoStreamsOutOfSyncEventData", +export const MediaLiveEventIncomingVideoStreamsOutOfSyncEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventIncomingVideoStreamsOutOfSyncEventData", modelProperties: { firstTimestamp: { - readOnly: true, serializedName: "firstTimestamp", + readOnly: true, type: { name: "String" } }, firstDuration: { - readOnly: true, serializedName: "firstDuration", + readOnly: true, type: { name: "String" } }, secondTimestamp: { - readOnly: true, serializedName: "secondTimestamp", + readOnly: true, type: { name: "String" } }, secondDuration: { - readOnly: true, serializedName: "secondDuration", + readOnly: true, type: { name: "String" } }, timescale: { - readOnly: true, serializedName: "timescale", + readOnly: true, type: { name: "String" } @@ -2781,50 +2808,49 @@ export const MediaLiveEventIncomingVideoStreamsOutOfSyncEventData: msRest.Compos } }; -export const MediaLiveEventIncomingDataChunkDroppedEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventIncomingDataChunkDroppedEventData", +export const MediaLiveEventIncomingDataChunkDroppedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventIncomingDataChunkDroppedEventData", modelProperties: { timestamp: { - readOnly: true, serializedName: "timestamp", + readOnly: true, type: { name: "String" } }, trackType: { - readOnly: true, serializedName: "trackType", + readOnly: true, type: { name: "String" } }, bitrate: { - readOnly: true, serializedName: "bitrate", + readOnly: true, type: { name: "Number" } }, timescale: { - readOnly: true, serializedName: "timescale", + readOnly: true, type: { name: "String" } }, resultCode: { - readOnly: true, serializedName: "resultCode", + readOnly: true, type: { name: "String" } }, trackName: { - readOnly: true, serializedName: "trackName", + readOnly: true, type: { name: "String" } @@ -2833,92 +2859,91 @@ export const MediaLiveEventIncomingDataChunkDroppedEventData: msRest.CompositeMa } }; -export const MediaLiveEventIngestHeartbeatEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventIngestHeartbeatEventData", +export const MediaLiveEventIngestHeartbeatEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventIngestHeartbeatEventData", modelProperties: { trackType: { - readOnly: true, serializedName: "trackType", + readOnly: true, type: { name: "String" } }, trackName: { - readOnly: true, serializedName: "trackName", + readOnly: true, type: { name: "String" } }, bitrate: { - readOnly: true, serializedName: "bitrate", + readOnly: true, type: { name: "Number" } }, incomingBitrate: { - readOnly: true, serializedName: "incomingBitrate", + readOnly: true, type: { name: "Number" } }, lastTimestamp: { - readOnly: true, serializedName: "lastTimestamp", + readOnly: true, type: { name: "String" } }, timescale: { - readOnly: true, serializedName: "timescale", + readOnly: true, type: { name: "String" } }, overlapCount: { - readOnly: true, serializedName: "overlapCount", + readOnly: true, type: { name: "Number" } }, discontinuityCount: { - readOnly: true, serializedName: "discontinuityCount", + readOnly: true, type: { name: "Number" } }, nonincreasingCount: { - readOnly: true, serializedName: "nonincreasingCount", + readOnly: true, type: { name: "Number" } }, unexpectedBitrate: { - readOnly: true, serializedName: "unexpectedBitrate", + readOnly: true, type: { name: "Boolean" } }, state: { - readOnly: true, serializedName: "state", + readOnly: true, type: { name: "String" } }, healthy: { - readOnly: true, serializedName: "healthy", + readOnly: true, type: { name: "Boolean" } @@ -2927,57 +2952,1060 @@ export const MediaLiveEventIngestHeartbeatEventData: msRest.CompositeMapper = { } }; -export const MediaLiveEventTrackDiscontinuityDetectedEventData: msRest.CompositeMapper = { - serializedName: "MediaLiveEventTrackDiscontinuityDetectedEventData", +export const MediaLiveEventTrackDiscontinuityDetectedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", className: "MediaLiveEventTrackDiscontinuityDetectedEventData", modelProperties: { trackType: { - readOnly: true, serializedName: "trackType", + readOnly: true, type: { name: "String" } }, trackName: { - readOnly: true, serializedName: "trackName", + readOnly: true, type: { name: "String" } }, bitrate: { - readOnly: true, serializedName: "bitrate", + readOnly: true, type: { name: "Number" } }, previousTimestamp: { - readOnly: true, serializedName: "previousTimestamp", + readOnly: true, type: { name: "String" } }, newTimestamp: { - readOnly: true, serializedName: "newTimestamp", + readOnly: true, type: { name: "String" } }, timescale: { - readOnly: true, serializedName: "timescale", + readOnly: true, type: { name: "String" } }, discontinuityGap: { - readOnly: true, serializedName: "discontinuityGap", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const MapsGeofenceEventProperties: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MapsGeofenceEventProperties", + modelProperties: { + expiredGeofenceGeometryId: { + serializedName: "expiredGeofenceGeometryId", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + geometries: { + serializedName: "geometries", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "MapsGeofenceGeometry" } + } + } + }, + invalidPeriodGeofenceGeometryId: { + serializedName: "invalidPeriodGeofenceGeometryId", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + isEventPublished: { + serializedName: "isEventPublished", + type: { + name: "Boolean" + } + } + } + } +}; + +export const MapsGeofenceGeometry: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MapsGeofenceGeometry", + modelProperties: { + deviceId: { + serializedName: "deviceId", + type: { + name: "String" + } + }, + distance: { + serializedName: "distance", + type: { + name: "Number" + } + }, + geometryId: { + serializedName: "geometryId", + type: { + name: "String" + } + }, + nearestLat: { + serializedName: "nearestLat", + type: { + name: "Number" + } + }, + nearestLon: { + serializedName: "nearestLon", + type: { + name: "Number" + } + }, + udId: { + serializedName: "udId", + type: { + name: "String" + } + } + } + } +}; + +export const MapsGeofenceEnteredEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MapsGeofenceEnteredEventData", + modelProperties: { + ...MapsGeofenceEventProperties.type.modelProperties + } + } +}; + +export const MapsGeofenceExitedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MapsGeofenceExitedEventData", + modelProperties: { + ...MapsGeofenceEventProperties.type.modelProperties + } + } +}; + +export const MapsGeofenceResultEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MapsGeofenceResultEventData", + modelProperties: { + ...MapsGeofenceEventProperties.type.modelProperties + } + } +}; + +export const AppConfigurationKeyValueModifiedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AppConfigurationKeyValueModifiedEventData", + modelProperties: { + key: { + serializedName: "key", + type: { + name: "String" + } + }, + label: { + serializedName: "label", + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const AppConfigurationKeyValueDeletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AppConfigurationKeyValueDeletedEventData", + modelProperties: { + key: { + serializedName: "key", + type: { + name: "String" + } + }, + label: { + serializedName: "label", + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const SignalRServiceClientConnectionConnectedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRServiceClientConnectionConnectedEventData", + modelProperties: { + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + hubName: { + serializedName: "hubName", + type: { + name: "String" + } + }, + connectionId: { + serializedName: "connectionId", + type: { + name: "String" + } + }, + userId: { + serializedName: "userId", + type: { + name: "String" + } + } + } + } +}; + +export const SignalRServiceClientConnectionDisconnectedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRServiceClientConnectionDisconnectedEventData", + modelProperties: { + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + hubName: { + serializedName: "hubName", + type: { + name: "String" + } + }, + connectionId: { + serializedName: "connectionId", + type: { + name: "String" + } + }, + userId: { + serializedName: "userId", + type: { + name: "String" + } + }, + errorMessage: { + serializedName: "errorMessage", + type: { + name: "String" + } + } + } + } +}; + +export const KeyVaultCertificateNewVersionCreatedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultCertificateNewVersionCreatedEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultCertificateNearExpiryEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultCertificateNearExpiryEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultCertificateExpiredEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultCertificateExpiredEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultKeyNewVersionCreatedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultKeyNewVersionCreatedEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultKeyNearExpiryEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultKeyNearExpiryEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultKeyExpiredEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultKeyExpiredEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultSecretNewVersionCreatedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultSecretNewVersionCreatedEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultSecretNearExpiryEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultSecretNearExpiryEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const KeyVaultSecretExpiredEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultSecretExpiredEventData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + vaultName: { + serializedName: "vaultName", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + objectName: { + serializedName: "objectName", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + nbf: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + exp: { + serializedName: "exp", + type: { + name: "Number" + } + } + } + } +}; + +export const MachineLearningServicesModelRegisteredEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MachineLearningServicesModelRegisteredEventData", + modelProperties: { + modelName: { + serializedName: "modelName", + type: { + name: "String" + } + }, + modelVersion: { + serializedName: "modelVersion", + type: { + name: "String" + } + }, + modelTags: { + serializedName: "modelTags", + type: { + name: "any" + } + }, + modelProperties: { + serializedName: "modelProperties", + type: { + name: "any" + } + } + } + } +}; + +export const MachineLearningServicesModelDeployedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MachineLearningServicesModelDeployedEventData", + modelProperties: { + serviceName: { + serializedName: "serviceName", + type: { + name: "String" + } + }, + serviceComputeType: { + serializedName: "serviceComputeType", + type: { + name: "String" + } + }, + modelIds: { + serializedName: "modelIds", + type: { + name: "String" + } + }, + serviceTags: { + serializedName: "serviceTags", + type: { + name: "any" + } + }, + serviceProperties: { + serializedName: "serviceProperties", + type: { + name: "any" + } + } + } + } +}; + +export const MachineLearningServicesRunCompletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MachineLearningServicesRunCompletedEventData", + modelProperties: { + experimentId: { + serializedName: "experimentId", + type: { + name: "String" + } + }, + experimentName: { + serializedName: "experimentName", + type: { + name: "String" + } + }, + runId: { + serializedName: "runId", + type: { + name: "String" + } + }, + runType: { + serializedName: "runType", + type: { + name: "String" + } + }, + runTags: { + serializedName: "runTags", + type: { + name: "any" + } + }, + runProperties: { + serializedName: "runProperties", + type: { + name: "any" + } + } + } + } +}; + +export const MachineLearningServicesDatasetDriftDetectedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MachineLearningServicesDatasetDriftDetectedEventData", + modelProperties: { + dataDriftId: { + serializedName: "dataDriftId", + type: { + name: "String" + } + }, + dataDriftName: { + serializedName: "dataDriftName", + type: { + name: "String" + } + }, + runId: { + serializedName: "runId", + type: { + name: "String" + } + }, + baseDatasetId: { + serializedName: "baseDatasetId", + type: { + name: "String" + } + }, + targetDatasetId: { + serializedName: "targetDatasetId", + type: { + name: "String" + } + }, + driftCoefficient: { + serializedName: "driftCoefficient", + type: { + name: "Number" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const MachineLearningServicesRunStatusChangedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MachineLearningServicesRunStatusChangedEventData", + modelProperties: { + experimentId: { + serializedName: "experimentId", + type: { + name: "String" + } + }, + experimentName: { + serializedName: "experimentName", + type: { + name: "String" + } + }, + runId: { + serializedName: "runId", + type: { + name: "String" + } + }, + runType: { + serializedName: "runType", + type: { + name: "String" + } + }, + runTags: { + serializedName: "runTags", + type: { + name: "any" + } + }, + runProperties: { + serializedName: "runProperties", + type: { + name: "any" + } + }, + runStatus: { + serializedName: "runStatus", + type: { + name: "String" + } + } + } + } +}; + +export const RedisPatchingCompletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "RedisPatchingCompletedEventData", + modelProperties: { + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const RedisScalingCompletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "RedisScalingCompletedEventData", + modelProperties: { + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const RedisExportRDBCompletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "RedisExportRDBCompletedEventData", + modelProperties: { + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", type: { name: "String" } @@ -2986,127 +4014,77 @@ export const MediaLiveEventTrackDiscontinuityDetectedEventData: msRest.Composite } }; -export const MapsGeofenceEventProperties: msRest.CompositeMapper = { - serializedName: "MapsGeofenceEventProperties", +export const RedisImportRDBCompletedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "MapsGeofenceEventProperties", + className: "RedisImportRDBCompletedEventData", modelProperties: { - expiredGeofenceGeometryId: { - serializedName: "expiredGeofenceGeometryId", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - geometries: { - serializedName: "geometries", + timestamp: { + serializedName: "timestamp", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MapsGeofenceGeometry" - } - } + name: "DateTime" } }, - invalidPeriodGeofenceGeometryId: { - serializedName: "invalidPeriodGeofenceGeometryId", + name: { + serializedName: "name", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" } }, - isEventPublished: { - serializedName: "isEventPublished", + status: { + serializedName: "status", type: { - name: "Boolean" + name: "String" } } } } }; -export const MapsGeofenceEnteredEventData: msRest.CompositeMapper = { - serializedName: "MapsGeofenceEnteredEventData", - type: { - name: "Composite", - className: "MapsGeofenceEnteredEventData", - modelProperties: { - ...MapsGeofenceEventProperties.type.modelProperties - } - } -}; - -export const MapsGeofenceExitedEventData: msRest.CompositeMapper = { - serializedName: "MapsGeofenceExitedEventData", - type: { - name: "Composite", - className: "MapsGeofenceExitedEventData", - modelProperties: { - ...MapsGeofenceEventProperties.type.modelProperties - } - } -}; - -export const MapsGeofenceResultEventData: msRest.CompositeMapper = { - serializedName: "MapsGeofenceResultEventData", - type: { - name: "Composite", - className: "MapsGeofenceResultEventData", - modelProperties: { - ...MapsGeofenceEventProperties.type.modelProperties - } - } -}; - -export const MapsGeofenceGeometry: msRest.CompositeMapper = { - serializedName: "MapsGeofenceGeometry", +export const WebAppUpdatedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "MapsGeofenceGeometry", + className: "WebAppUpdatedEventData", modelProperties: { - deviceId: { - serializedName: "deviceId", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", + type: { + name: "Composite", + className: "AppEventTypeDetail" + } + }, + name: { + serializedName: "name", type: { name: "String" } }, - distance: { - serializedName: "distance", + clientRequestId: { + serializedName: "clientRequestId", type: { - name: "Number" + name: "String" } }, - geometryId: { - serializedName: "geometryId", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - nearestLat: { - serializedName: "nearestLat", + requestId: { + serializedName: "requestId", type: { - name: "Number" + name: "String" } }, - nearestLon: { - serializedName: "nearestLon", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - udId: { - serializedName: "udId", + verb: { + serializedName: "verb", type: { name: "String" } @@ -3115,26 +4093,13 @@ export const MapsGeofenceGeometry: msRest.CompositeMapper = { } }; -export const AppConfigurationKeyValueModifiedEventData: msRest.CompositeMapper = { - serializedName: "AppConfigurationKeyValueModifiedEventData", +export const AppEventTypeDetail: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "AppConfigurationKeyValueModifiedEventData", + className: "AppEventTypeDetail", modelProperties: { - key: { - serializedName: "key", - type: { - name: "String" - } - }, - label: { - serializedName: "label", - type: { - name: "String" - } - }, - etag: { - serializedName: "etag", + action: { + serializedName: "action", type: { name: "String" } @@ -3143,60 +4108,50 @@ export const AppConfigurationKeyValueModifiedEventData: msRest.CompositeMapper = } }; -export const AppConfigurationKeyValueDeletedEventData: msRest.CompositeMapper = { - serializedName: "AppConfigurationKeyValueDeletedEventData", +export const WebBackupOperationStartedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "AppConfigurationKeyValueDeletedEventData", + className: "WebBackupOperationStartedEventData", modelProperties: { - key: { - serializedName: "key", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - label: { - serializedName: "label", + name: { + serializedName: "name", type: { name: "String" } }, - etag: { - serializedName: "etag", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } - } - } - } -}; - -export const SignalRServiceClientConnectionConnectedEventData: msRest.CompositeMapper = { - serializedName: "SignalRServiceClientConnectionConnectedEventData", - type: { - name: "Composite", - className: "SignalRServiceClientConnectionConnectedEventData", - modelProperties: { - timestamp: { - serializedName: "timestamp", + }, + correlationRequestId: { + serializedName: "correlationRequestId", type: { - name: "DateTime" + name: "String" } }, - hubName: { - serializedName: "hubName", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - connectionId: { - serializedName: "connectionId", + address: { + serializedName: "address", type: { name: "String" } }, - userId: { - serializedName: "userId", + verb: { + serializedName: "verb", type: { name: "String" } @@ -3205,38 +4160,50 @@ export const SignalRServiceClientConnectionConnectedEventData: msRest.CompositeM } }; -export const SignalRServiceClientConnectionDisconnectedEventData: msRest.CompositeMapper = { - serializedName: "SignalRServiceClientConnectionDisconnectedEventData", +export const WebBackupOperationCompletedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "SignalRServiceClientConnectionDisconnectedEventData", + className: "WebBackupOperationCompletedEventData", modelProperties: { - timestamp: { - serializedName: "timestamp", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "DateTime" + name: "Composite", + className: "AppEventTypeDetail" } }, - hubName: { - serializedName: "hubName", + name: { + serializedName: "name", type: { name: "String" } }, - connectionId: { - serializedName: "connectionId", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - userId: { - serializedName: "userId", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - errorMessage: { - serializedName: "errorMessage", + requestId: { + serializedName: "requestId", + type: { + name: "String" + } + }, + address: { + serializedName: "address", + type: { + name: "String" + } + }, + verb: { + serializedName: "verb", type: { name: "String" } @@ -3245,654 +4212,602 @@ export const SignalRServiceClientConnectionDisconnectedEventData: msRest.Composi } }; -export const KeyVaultCertificateNewVersionCreatedEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultCertificateNewVersionCreatedEventData", +export const WebBackupOperationFailedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultCertificateNewVersionCreatedEventData", + className: "WebBackupOperationFailedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultCertificateNearExpiryEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultCertificateNearExpiryEventData", +export const WebRestoreOperationStartedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultCertificateNearExpiryEventData", + className: "WebRestoreOperationStartedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultCertificateExpiredEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultCertificateExpiredEventData", +export const WebRestoreOperationCompletedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultCertificateExpiredEventData", + className: "WebRestoreOperationCompletedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultKeyNewVersionCreatedEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultKeyNewVersionCreatedEventData", +export const WebRestoreOperationFailedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultKeyNewVersionCreatedEventData", + className: "WebRestoreOperationFailedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultKeyNearExpiryEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultKeyNearExpiryEventData", +export const WebSlotSwapStartedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultKeyNearExpiryEventData", + className: "WebSlotSwapStartedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultKeyExpiredEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultKeyExpiredEventData", +export const WebSlotSwapCompletedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultKeyExpiredEventData", + className: "WebSlotSwapCompletedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultSecretNewVersionCreatedEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultSecretNewVersionCreatedEventData", +export const WebSlotSwapFailedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultSecretNewVersionCreatedEventData", + className: "WebSlotSwapFailedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultSecretNearExpiryEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultSecretNearExpiryEventData", +export const WebSlotSwapWithPreviewStartedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultSecretNearExpiryEventData", + className: "WebSlotSwapWithPreviewStartedEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const KeyVaultSecretExpiredEventData: msRest.CompositeMapper = { - serializedName: "KeyVaultSecretExpiredEventData", +export const WebSlotSwapWithPreviewCancelledEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultSecretExpiredEventData", + className: "WebSlotSwapWithPreviewCancelledEventData", modelProperties: { - id: { - serializedName: "id", + appEventTypeDetail: { + serializedName: "appEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppEventTypeDetail" } }, - vaultName: { - serializedName: "vaultName", + name: { + serializedName: "name", type: { name: "String" } }, - objectType: { - serializedName: "objectType", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - objectName: { - serializedName: "objectName", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - version: { - serializedName: "version", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - nbf: { - serializedName: "nbf", + address: { + serializedName: "address", type: { - name: "Number" + name: "String" } }, - exp: { - serializedName: "exp", + verb: { + serializedName: "verb", type: { - name: "Number" + name: "String" } } } } }; -export const MachineLearningServicesModelRegisteredEventData: msRest.CompositeMapper = { - serializedName: "MachineLearningServicesModelRegisteredEventData", +export const WebAppServicePlanUpdatedEventData: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "MachineLearningServicesModelRegisteredEventData", + className: "WebAppServicePlanUpdatedEventData", modelProperties: { - modelName: { - serializedName: "modelName", + appServicePlanEventTypeDetail: { + serializedName: "appServicePlanEventTypeDetail", type: { - name: "String" + name: "Composite", + className: "AppServicePlanEventTypeDetail" } }, - modelVersion: { - serializedName: "modelVersion", + sku: { + serializedName: "sku", type: { - name: "Number" + name: "Composite", + className: "WebAppServicePlanUpdatedEventDataSku" } }, - modelTags: { - serializedName: "modelTags", + name: { + serializedName: "name", type: { - name: "Object" + name: "String" } }, - modelProperties: { - serializedName: "modelProperties", - type: { - name: "Object" - } - } - } - } -}; - -export const MachineLearningServicesModelDeployedEventData: msRest.CompositeMapper = { - serializedName: "MachineLearningServicesModelDeployedEventData", - type: { - name: "Composite", - className: "MachineLearningServicesModelDeployedEventData", - modelProperties: { - serviceName: { - serializedName: "serviceName", + clientRequestId: { + serializedName: "clientRequestId", type: { name: "String" } }, - serviceComputeType: { - serializedName: "serviceComputeType", + correlationRequestId: { + serializedName: "correlationRequestId", type: { name: "String" } }, - modelIds: { - serializedName: "modelIds", + requestId: { + serializedName: "requestId", type: { name: "String" } }, - serviceTags: { - serializedName: "serviceTags", + address: { + serializedName: "address", type: { - name: "Object" + name: "String" } }, - serviceProperties: { - serializedName: "serviceProperties", + verb: { + serializedName: "verb", type: { - name: "Object" + name: "String" } } } } }; -export const MachineLearningServicesRunCompletedEventData: msRest.CompositeMapper = { - serializedName: "MachineLearningServicesRunCompletedEventData", +export const AppServicePlanEventTypeDetail: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "MachineLearningServicesRunCompletedEventData", + className: "AppServicePlanEventTypeDetail", modelProperties: { - experimentId: { - serializedName: "experimentId", - type: { - name: "String" - } - }, - experimentName: { - serializedName: "experimentName", + stampKind: { + serializedName: "stampKind", type: { name: "String" } }, - runId: { - serializedName: "runId", + action: { + defaultValue: "Updated", + isConstant: true, + serializedName: "action", type: { name: "String" } }, - runType: { - serializedName: "runType", + status: { + serializedName: "status", type: { name: "String" } - }, - runTags: { - serializedName: "runTags", - type: { - name: "Object" - } - }, - runProperties: { - serializedName: "runProperties", - type: { - name: "Object" - } } } } }; -export const MachineLearningServicesDatasetDriftDetectedEventData: msRest.CompositeMapper = { - serializedName: "MachineLearningServicesDatasetDriftDetectedEventData", +export const WebAppServicePlanUpdatedEventDataSku: coreHttp.CompositeMapper = { type: { name: "Composite", - className: "MachineLearningServicesDatasetDriftDetectedEventData", + className: "WebAppServicePlanUpdatedEventDataSku", modelProperties: { - dataDriftId: { - serializedName: "dataDriftId", + name: { + serializedName: "name", type: { name: "String" } }, - dataDriftName: { - serializedName: "dataDriftName", + tier: { + serializedName: "Tier", type: { name: "String" } }, - runId: { - serializedName: "runId", + size: { + serializedName: "Size", type: { name: "String" } }, - baseDatasetId: { - serializedName: "baseDatasetId", + family: { + serializedName: "Family", type: { name: "String" } }, - targetDatasetId: { - serializedName: "targetDatasetId", + capacity: { + serializedName: "Capacity", type: { name: "String" } - }, - driftCoefficient: { - serializedName: "driftCoefficient", - type: { - name: "Number" - } - }, - startTime: { - serializedName: "startTime", - type: { - name: "DateTime" - } - }, - endTime: { - serializedName: "endTime", - type: { - name: "DateTime" - } } } } }; -export const discriminators = { - 'MediaJobOutput' : MediaJobOutput, - 'MediaJobOutput.#Microsoft.Media.JobOutputAsset' : MediaJobOutputAsset - +export let discriminators = { + MediaJobOutput: MediaJobOutput, + "MediaJobOutput.#Microsoft.Media.JobOutputAsset": MediaJobOutputAsset }; diff --git a/sdk/eventgrid/eventgrid/src/generated/models/parameters.ts b/sdk/eventgrid/eventgrid/src/generated/models/parameters.ts new file mode 100644 index 000000000000..3c29844c7328 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/generated/models/parameters.ts @@ -0,0 +1,97 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-http"; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const events: OperationParameter = { + parameterPath: "events", + mapper: { + serializedName: "events", + required: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "EventGridEvent" } } + } + } +}; + +export const topicHostname: OperationURLParameter = { + parameterPath: "topicHostname", + mapper: { + serializedName: "topicHostname", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2018-01-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const contentType1: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/cloudevents-batch+json; charset=utf-8", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const events1: OperationParameter = { + parameterPath: "events", + mapper: { + serializedName: "events", + required: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "CloudEvent" } } + } + } +}; + +export const events2: OperationParameter = { + parameterPath: "events", + mapper: { + serializedName: "events", + required: true, + type: { + name: "Sequence", + element: { type: { name: "any" } } + } + } +}; diff --git a/sdk/eventgrid/eventgrid/src/index.ts b/sdk/eventgrid/eventgrid/src/index.ts new file mode 100644 index 000000000000..0b9eb253d07b --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/index.ts @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { AzureKeyCredential } from "@azure/core-auth"; + +export { + CloudEvent, + CustomEventDataDeserializer, + EventGridEvent, + SendCloudEventInput, + SendEventGridEventInput +} from "./models"; + +export { + EventGridPublisherClient, + EventGridPublisherClientOptions, + SendEventsOptions, + SendCloudEventsOptions, + SendCustomSchemaEventsOptions +} from "./eventGridClient"; + +export { + SignatureCredential, + EventGridSharedAccessSignatureCredential +} from "./sharedAccessSignitureCredential"; + +export { EventGridConsumer, EventGridConsumerOptions } from "./consumer"; + +export { + generateSharedAccessSignature, + GenerateSharedAccessSignatureOptions +} from "./generateSharedAccessSignature"; + +export { isSystemEvent, KnownSystemEventTypes, SystemEventNameToEventData } from "./predicates"; + +export { + AppConfigurationKeyValueDeletedEventData, + AppConfigurationKeyValueModifiedEventData, + AppEventTypeDetail, + AppServicePlanEventTypeDetail, + ContainerRegistryArtifactEventTarget, + ContainerRegistryEventData, + ContainerRegistryImagePushedEventData, + ContainerRegistryImageDeletedEventData, + ContainerRegistryChartDeletedEventData, + ContainerRegistryChartPushedEventData, + DeviceConnectionStateEventInfo, + DeviceTwinInfo, + DeviceTwinInfoProperties, + DeviceTwinInfoX509Thumbprint, + IotHubDeviceCreatedEventData, + IotHubDeviceDeletedEventData, + IotHubDeviceConnectedEventData, + IotHubDeviceDisconnectedEventData, + IotHubDeviceTelemetryEventData, + SubscriptionValidationEventData, + SubscriptionDeletedEventData, + EventHubCaptureFileCreatedEventData, + MachineLearningServicesDatasetDriftDetectedEventData, + MachineLearningServicesModelDeployedEventData, + MachineLearningServicesModelRegisteredEventData, + MachineLearningServicesRunCompletedEventData, + MachineLearningServicesRunStatusChangedEventData, + MapsGeofenceEventProperties, + MapsGeofenceEnteredEventData, + MapsGeofenceExitedEventData, + MapsGeofenceResultEventData, + MediaJobStateChangeEventData, + MediaJobOutputStateChangeEventData, + MediaJobScheduledEventData, + MediaJobProcessingEventData, + MediaJobCancelingEventData, + MediaJobFinishedEventData, + MediaJobCanceledEventData, + MediaJobError, + MediaJobErrorCategory, + MediaJobErrorDetail, + MediaJobErrorCode, + MediaJobRetry, + MediaJobErroredEventData, + MediaJobOutputCanceledEventData, + MediaJobOutputCancelingEventData, + MediaJobOutputErroredEventData, + MediaJobOutputFinishedEventData, + MediaJobOutputProcessingEventData, + MediaJobOutputScheduledEventData, + MediaJobOutputProgressEventData, + MediaJobOutputUnion, + MediaJobState, + MediaLiveEventEncoderConnectedEventData, + MediaLiveEventConnectionRejectedEventData, + MediaLiveEventEncoderDisconnectedEventData, + MediaLiveEventIncomingStreamReceivedEventData, + MediaLiveEventIncomingStreamsOutOfSyncEventData, + MediaLiveEventIncomingVideoStreamsOutOfSyncEventData, + MediaLiveEventIncomingDataChunkDroppedEventData, + MediaLiveEventIngestHeartbeatEventData, + MediaLiveEventTrackDiscontinuityDetectedEventData, + ResourceWriteSuccessEventData, + ResourceWriteFailureEventData, + ResourceWriteCancelEventData, + ResourceDeleteSuccessEventData, + ResourceDeleteFailureEventData, + ResourceDeleteCancelEventData, + ResourceActionSuccessEventData, + ResourceActionFailureEventData, + ResourceActionCancelEventData, + ServiceBusActiveMessagesAvailableWithNoListenersEventData, + ServiceBusDeadletterMessagesAvailableWithNoListenersEventData, + StorageBlobCreatedEventData, + StorageBlobDeletedEventData, + StorageBlobRenamedEventData, + StorageDirectoryCreatedEventData, + StorageDirectoryDeletedEventData, + StorageDirectoryRenamedEventData, + StorageLifecyclePolicyCompletedEventData, + WebAppUpdatedEventData, + WebBackupOperationStartedEventData, + WebBackupOperationCompletedEventData, + WebBackupOperationFailedEventData, + WebRestoreOperationStartedEventData, + WebRestoreOperationCompletedEventData, + WebRestoreOperationFailedEventData, + WebSlotSwapStartedEventData, + WebSlotSwapCompletedEventData, + WebSlotSwapFailedEventData, + WebSlotSwapWithPreviewStartedEventData, + WebSlotSwapWithPreviewCancelledEventData, + WebAppServicePlanUpdatedEventData, + WebAppServicePlanUpdatedEventDataSku, + AppAction, + StampKind, + AsyncStatus, + ContainerRegistryArtifactEventData, + ContainerRegistryEventActor, + ContainerRegistryEventRequest, + ContainerRegistryEventSource, + ContainerRegistryEventTarget, + DeviceConnectionStateEventProperties, + DeviceLifeCycleEventProperties, + DeviceTelemetryEventProperties, + MapsGeofenceGeometry, + MediaJobOutput, + MediaJobOutputAsset, + DeviceTwinProperties, + DeviceTwinMetadata +} from "./generated/models"; diff --git a/sdk/eventgrid/eventgrid/src/logger.ts b/sdk/eventgrid/eventgrid/src/logger.ts new file mode 100644 index 000000000000..81ab74e89343 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/logger.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; + +/** + * The @azure/logger configuration for this package. + */ +export const logger = createClientLogger("eventgrid"); diff --git a/sdk/eventgrid/eventgrid/src/models.ts b/sdk/eventgrid/eventgrid/src/models.ts new file mode 100644 index 000000000000..161da86ccd6f --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/models.ts @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** + * The shape of the input for EventGridProducerClient#sendEvents + */ +export interface SendEventGridEventInput { + /** + * The type of the event. + */ + eventType: string; + /** + * The time the event was generated. If not provided, the current time will be used. + */ + eventTime?: Date; + /** + * An unique identifier for the event. If an ID is not provided, a random UUID will be generated + * and used. + */ + id?: string; + /** + * The resource path of the event source. + */ + topic?: string; + /** + * A resource path relative to the topic path. + */ + subject: string; + /** + * The schema version of the data object. + */ + dataVersion: string; + /** + * Event data specific to the event type. + */ + data: T; +} + +/** + * An event in the in the Event Grid Schema. + */ +export interface EventGridEvent { + /** + * The type of the event. + */ + eventType: string; + /** + * The time the event was generated. + */ + eventTime: Date; + /** + * An unique identifier for the event. + */ + id: string; + /** + * The resource path of the event source. + */ + topic?: string; + /** + * A resource path relative to the topic path. + */ + subject: string; + /** + * The schema version of the data object. + */ + dataVersion: string; + /** + * Event data specific to the event type. + */ + data: T; +} + +/** + * * The shape of the input for EventGridProducerClient#sendCloudEvents + */ +export interface SendCloudEventInput { + /** + * Type of event related to the originating occurrence. + */ + type: string; + /** + * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. + */ + source: string; + /** + * An identifier for the event. The combination of id and source must be unique for each distinct event. If an ID is not provided, + * a random UUID will be generated and used. + */ + id?: string; + /** + * The time the event was generated. If not provided, the current time will be used. + */ + time?: Date; + /** + * Identifies the schema that data adheres to. + */ + dataschema?: string; + /** + * Content type of data value. + */ + datacontenttype?: string; + /** + * Event data specific to the event type. + */ + data?: T; + /** + * This describes the subject of the event in the context of the event producer (identified by source). + */ + subject?: string; + /** + * Additional context attributes for the event. The Cloud Event specification refers to these as "extension attributes". + */ + extensionAttributes?: Record; +} + +/** + * An event in the Cloud Event 1.0 schema. + */ +export interface CloudEvent { + /** + * Type of event related to the originating occurrence. + */ + type: string; + /** + * Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event. + */ + source: string; + /** + * An identifier for the event. The combination of id and source must be unique for each distinct event. + */ + id: string; + /** + * The time the event was generated. + */ + time?: Date; + /** + * Identifies the schema that data adheres to. + */ + dataschema?: string; + /** + * Content type of data value. + */ + datacontenttype?: string; + /** + * Event data specific to the event type. + */ + data?: T; + /** + * This describes the subject of the event in the context of the event producer (identified by source). + */ + subject?: string; + /** + * Additional context attributes for the event. The Cloud Event specification refers to these as "extension attributes". + */ + extensionAttributes?: Record; +} + +/** + * Property names defined by the CloudEvents 1.0 specification, these may not be reused as the names of extension properties. + */ +export const cloudEventReservedPropertyNames = [ + "specversion", + "id", + "source", + "type", + "datacontenttype", + "dataschema", + "subject", + "time", + "data" +]; + +/** + * A function which provides custom logic to be used when decoding events. + */ +export type CustomEventDataDeserializer = (o: any) => Promise; diff --git a/sdk/eventgrid/eventgrid/src/models/parameters.ts b/sdk/eventgrid/eventgrid/src/models/parameters.ts deleted file mode 100644 index e2fe552eddfe..000000000000 --- a/sdk/eventgrid/eventgrid/src/models/parameters.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; - -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", - mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', - type: { - name: "String" - } - } -}; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - required: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; -export const topicHostname: msRest.OperationURLParameter = { - parameterPath: "topicHostname", - mapper: { - required: true, - serializedName: "topicHostname", - defaultValue: '', - type: { - name: "String" - } - }, - skipEncoding: true -}; diff --git a/sdk/eventgrid/eventgrid/src/predicates.ts b/sdk/eventgrid/eventgrid/src/predicates.ts new file mode 100644 index 000000000000..805e9844e910 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/predicates.ts @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + AppConfigurationKeyValueDeletedEventData, + AppConfigurationKeyValueModifiedEventData, + ContainerRegistryImagePushedEventData, + ContainerRegistryImageDeletedEventData, + ContainerRegistryChartDeletedEventData, + ContainerRegistryChartPushedEventData, + IotHubDeviceCreatedEventData, + IotHubDeviceDeletedEventData, + IotHubDeviceConnectedEventData, + IotHubDeviceDisconnectedEventData, + IotHubDeviceTelemetryEventData, + SubscriptionValidationEventData, + SubscriptionDeletedEventData, + EventHubCaptureFileCreatedEventData, + MachineLearningServicesDatasetDriftDetectedEventData, + MachineLearningServicesModelDeployedEventData, + MachineLearningServicesModelRegisteredEventData, + MachineLearningServicesRunCompletedEventData, + MachineLearningServicesRunStatusChangedEventData, + MapsGeofenceEnteredEventData, + MapsGeofenceExitedEventData, + MapsGeofenceResultEventData, + MediaJobStateChangeEventData, + MediaJobOutputStateChangeEventData, + MediaJobScheduledEventData, + MediaJobProcessingEventData, + MediaJobCancelingEventData, + MediaJobFinishedEventData, + MediaJobCanceledEventData, + MediaJobErroredEventData, + MediaJobOutputCanceledEventData, + MediaJobOutputCancelingEventData, + MediaJobOutputErroredEventData, + MediaJobOutputFinishedEventData, + MediaJobOutputProcessingEventData, + MediaJobOutputScheduledEventData, + MediaJobOutputProgressEventData, + MediaLiveEventEncoderConnectedEventData, + MediaLiveEventConnectionRejectedEventData, + MediaLiveEventEncoderDisconnectedEventData, + MediaLiveEventIncomingStreamReceivedEventData, + MediaLiveEventIncomingStreamsOutOfSyncEventData, + MediaLiveEventIncomingVideoStreamsOutOfSyncEventData, + MediaLiveEventIncomingDataChunkDroppedEventData, + MediaLiveEventIngestHeartbeatEventData, + MediaLiveEventTrackDiscontinuityDetectedEventData, + ResourceWriteSuccessEventData, + ResourceWriteFailureEventData, + ResourceWriteCancelEventData, + ResourceDeleteSuccessEventData, + ResourceDeleteFailureEventData, + ResourceDeleteCancelEventData, + ResourceActionSuccessEventData, + ResourceActionFailureEventData, + ResourceActionCancelEventData, + ServiceBusActiveMessagesAvailableWithNoListenersEventData, + ServiceBusDeadletterMessagesAvailableWithNoListenersEventData, + StorageBlobCreatedEventData, + StorageBlobDeletedEventData, + StorageBlobRenamedEventData, + StorageDirectoryCreatedEventData, + StorageDirectoryDeletedEventData, + StorageDirectoryRenamedEventData, + WebAppUpdatedEventData, + WebBackupOperationStartedEventData, + WebBackupOperationCompletedEventData, + WebBackupOperationFailedEventData, + WebRestoreOperationStartedEventData, + WebRestoreOperationCompletedEventData, + WebRestoreOperationFailedEventData, + WebSlotSwapStartedEventData, + WebSlotSwapCompletedEventData, + WebSlotSwapFailedEventData, + WebSlotSwapWithPreviewStartedEventData, + WebSlotSwapWithPreviewCancelledEventData, + WebAppServicePlanUpdatedEventData, + StorageLifecyclePolicyCompletedEventData +} from "./generated/models"; + +import { CloudEvent, EventGridEvent } from "./models"; + +/** + * The Event Types for all System Events. These may be used with `isSystemEvent` to determine if an + * event is a system event of a given type. + */ +export type KnownSystemEventTypes = + | "Microsoft.AppConfiguration.KeyValueDeleted" + | "Microsoft.AppConfiguration.KeyValueModified" + | "Microsoft.ContainerRegistry.ImagePushed" + | "Microsoft.ContainerRegistry.ImageDeleted" + | "Microsoft.ContainerRegistry.ChartDeleted" + | "Microsoft.ContainerRegistry.ChartPushed" + | "Microsoft.Devices.DeviceCreated" + | "Microsoft.Devices.DeviceDeleted" + | "Microsoft.Devices.DeviceConnected" + | "Microsoft.Devices.DeviceDisconnected" + | "Microsoft.Devices.DeviceTelemetry" + | "Microsoft.EventGrid.SubscriptionValidationEvent" + | "Microsoft.EventGrid.SubscriptionDeletedEvent" + | "Microsoft.EventHub.CaptureFileCreated" + | "Microsoft.MachineLearningServices.DatasetDriftDetected" + | "Microsoft.MachineLearningServices.ModelDeployed" + | "Microsoft.MachineLearningServices.ModelRegistered" + | "Microsoft.MachineLearningServices.RunCompleted" + | "Microsoft.MachineLearningServices.RunStatusChanged" + | "Microsoft.Maps.GeofenceEntered" + | "Microsoft.Maps.GeofenceExited" + | "Microsoft.Maps.GeofenceResult" + | "Microsoft.Media.JobStateChange" + | "Microsoft.Media.JobOutputStateChange" + | "Microsoft.Media.JobScheduled" + | "Microsoft.Media.JobProcessing" + | "Microsoft.Media.JobCanceling" + | "Microsoft.Media.JobFinished" + | "Microsoft.Media.JobCanceled" + | "Microsoft.Media.JobErrored" + | "Microsoft.Media.JobOutputCanceled" + | "Microsoft.Media.JobOutputCanceling" + | "Microsoft.Media.JobOutputErrored" + | "Microsoft.Media.JobOutputFinished" + | "Microsoft.Media.JobOutputProcessing" + | "Microsoft.Media.JobOutputScheduled" + | "Microsoft.Media.JobOutputProgress" + | "Microsoft.Media.LiveEventEncoderConnected" + | "Microsoft.Media.LiveEventConnectionRejected" + | "Microsoft.Media.LiveEventEncoderDisconnected" + | "Microsoft.Media.LiveEventIncomingStreamReceived" + | "Microsoft.Media.LiveEventIncomingStreamsOutOfSync" + | "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync" + | "Microsoft.Media.LiveEventIncomingDataChunkDropped" + | "Microsoft.Media.LiveEventIngestHeartbeat" + | "Microsoft.Media.LiveEventTrackDiscontinuityDetected" + | "Microsoft.Resources.ResourceWriteSuccess" + | "Microsoft.Resources.ResourceWriteFailure" + | "Microsoft.Resources.ResourceWriteCancel" + | "Microsoft.Resources.ResourceDeleteSuccess" + | "Microsoft.Resources.ResourceDeleteFailure" + | "Microsoft.Resources.ResourceDeleteCancel" + | "Microsoft.Resources.ResourceActionSuccess" + | "Microsoft.Resources.ResourceActionFailure" + | "Microsoft.Resources.ResourceActionCancel" + | "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners" + | "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener" + | "Microsoft.Storage.BlobCreated" + | "Microsoft.Storage.BlobDeleted" + | "Microsoft.Storage.BlobRenamed" + | "Microsoft.Storage.DirectoryCreated" + | "Microsoft.Storage.DirectoryDeleted" + | "Microsoft.Storage.DirectoryRenamed" + | "Microsoft.Storage.LifecyclePolicyCompleted" + | "Microsoft.Web.AppUpdated" + | "Microsoft.Web.BackupOperationStarted" + | "Microsoft.Web.BackupOperationCompleted" + | "Microsoft.Web.BackupOperationFailed" + | "Microsoft.Web.RestoreOperationStarted" + | "Microsoft.Web.RestoreOperationCompleted" + | "Microsoft.Web.RestoreOperationFailed" + | "Microsoft.Web.SlotSwapStarted" + | "Microsoft.Web.SlotSwapCompleted" + | "Microsoft.Web.SlotSwapFailed" + | "Microsoft.Web.SlotSwapWithPreviewStarted" + | "Microsoft.Web.SlotSwapWithPreviewCancelled" + | "Microsoft.Web.AppServicePlanUpdated"; + +/** + * A mapping of event type names to event data type interfaces. + * + * @ignore + */ +export interface SystemEventNameToEventData { + /** An interface for the event data of a "Microsoft.AppConfiguration.KeyValueDeleted" event. */ + "Microsoft.AppConfiguration.KeyValueDeleted": AppConfigurationKeyValueDeletedEventData; + /** An interface for the event data of a "Microsoft.AppConfiguration.KeyValueModified" event. */ + "Microsoft.AppConfiguration.KeyValueModified": AppConfigurationKeyValueModifiedEventData; + /** An interface for the event data of a "Microsoft.ContainerRegistry.ImagePushed" event. */ + "Microsoft.ContainerRegistry.ImagePushed": ContainerRegistryImagePushedEventData; + /** An interface for the event data of a "Microsoft.ContainerRegistry.ImageDeleted" event. */ + "Microsoft.ContainerRegistry.ImageDeleted": ContainerRegistryImageDeletedEventData; + /** An interface for the event data of a "Microsoft.ContainerRegistry.ChartDeleted" event. */ + "Microsoft.ContainerRegistry.ChartDeleted": ContainerRegistryChartDeletedEventData; + /** An interface for the event data of a "Microsoft.ContainerRegistry.ChartPushed" event. */ + "Microsoft.ContainerRegistry.ChartPushed": ContainerRegistryChartPushedEventData; + /** An interface for the event data of a "Microsoft.Devices.DeviceCreated" event. */ + "Microsoft.Devices.DeviceCreated": IotHubDeviceCreatedEventData; + /** An interface for the event data of a "Microsoft.Devices.DeviceDeleted" event. */ + "Microsoft.Devices.DeviceDeleted": IotHubDeviceDeletedEventData; + /** An interface for the event data of a "Microsoft.Devices.DeviceConnected" event. */ + "Microsoft.Devices.DeviceConnected": IotHubDeviceConnectedEventData; + /** An interface for the event data of a "Microsoft.Devices.DeviceDisconnected" event. */ + "Microsoft.Devices.DeviceDisconnected": IotHubDeviceDisconnectedEventData; + /** An interface for the event data of a "Microsoft.Devices.DeviceTelemetry" event. */ + "Microsoft.Devices.DeviceTelemetry": IotHubDeviceTelemetryEventData; + /** An interface for the event data of a "Microsoft.EventGrid.SubscriptionValidationEvent" event. */ + "Microsoft.EventGrid.SubscriptionValidationEvent": SubscriptionValidationEventData; + /** An interface for the event data of a "Microsoft.EventGrid.SubscriptionDeletedEvent" event. */ + "Microsoft.EventGrid.SubscriptionDeletedEvent": SubscriptionDeletedEventData; + /** An interface for the event data of a "Microsoft.EventHub.CaptureFileCreated" event. */ + "Microsoft.EventHub.CaptureFileCreated": EventHubCaptureFileCreatedEventData; + /** An interface for the event data of a "Microsoft.MachineLearningServices.DatasetDriftDetected" event. */ + "Microsoft.MachineLearningServices.DatasetDriftDetected": MachineLearningServicesDatasetDriftDetectedEventData; + /** An interface for the event data of a "Microsoft.MachineLearningServices.ModelDeployed" event. */ + "Microsoft.MachineLearningServices.ModelDeployed": MachineLearningServicesModelDeployedEventData; + /** An interface for the event data of a "Microsoft.MachineLearningServices.ModelRegistered" event. */ + "Microsoft.MachineLearningServices.ModelRegistered": MachineLearningServicesModelRegisteredEventData; + /** An interface for the event data of a "Microsoft.MachineLearningServices.RunCompleted" event. */ + "Microsoft.MachineLearningServices.RunCompleted": MachineLearningServicesRunCompletedEventData; + /** An interface for the event data of a "Microsoft.MachineLearningServices.RunStatusChanged" event. */ + "Microsoft.MachineLearningServices.RunStatusChanged": MachineLearningServicesRunStatusChangedEventData; + /** An interface for the event data of a "Microsoft.Maps.GeofenceEntered" event. */ + "Microsoft.Maps.GeofenceEntered": MapsGeofenceEnteredEventData; + /** An interface for the event data of a "Microsoft.Maps.GeofenceExited" event. */ + "Microsoft.Maps.GeofenceExited": MapsGeofenceExitedEventData; + /** An interface for the event data of a "Microsoft.Maps.GeofenceResult" event. */ + "Microsoft.Maps.GeofenceResult": MapsGeofenceResultEventData; + /** An interface for the event data of a "Microsoft.Media.JobStateChange" event. */ + "Microsoft.Media.JobStateChange": MediaJobStateChangeEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputStateChange" event. */ + "Microsoft.Media.JobOutputStateChange": MediaJobOutputStateChangeEventData; + /** An interface for the event data of a "Microsoft.Media.JobScheduled" event. */ + "Microsoft.Media.JobScheduled": MediaJobScheduledEventData; + /** An interface for the event data of a "Microsoft.Media.JobProcessing" event. */ + "Microsoft.Media.JobProcessing": MediaJobProcessingEventData; + /** An interface for the event data of a "Microsoft.Media.JobCanceling" event. */ + "Microsoft.Media.JobCanceling": MediaJobCancelingEventData; + /** An interface for the event data of a "Microsoft.Media.JobFinished" event. */ + "Microsoft.Media.JobFinished": MediaJobFinishedEventData; + /** An interface for the event data of a "Microsoft.Media.JobCanceled" event. */ + "Microsoft.Media.JobCanceled": MediaJobCanceledEventData; + /** An interface for the event data of a "Microsoft.Media.JobErrored" event. */ + "Microsoft.Media.JobErrored": MediaJobErroredEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputCanceled" event. */ + "Microsoft.Media.JobOutputCanceled": MediaJobOutputCanceledEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputCanceling" event. */ + "Microsoft.Media.JobOutputCanceling": MediaJobOutputCancelingEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputErrored" event. */ + "Microsoft.Media.JobOutputErrored": MediaJobOutputErroredEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputFinished" event. */ + "Microsoft.Media.JobOutputFinished": MediaJobOutputFinishedEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputProcessing" event. */ + "Microsoft.Media.JobOutputProcessing": MediaJobOutputProcessingEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputScheduled" event. */ + "Microsoft.Media.JobOutputScheduled": MediaJobOutputScheduledEventData; + /** An interface for the event data of a "Microsoft.Media.JobOutputProgress" event. */ + "Microsoft.Media.JobOutputProgress": MediaJobOutputProgressEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventEncoderConnected" event. */ + "Microsoft.Media.LiveEventEncoderConnected": MediaLiveEventEncoderConnectedEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventConnectionRejected" event. */ + "Microsoft.Media.LiveEventConnectionRejected": MediaLiveEventConnectionRejectedEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventEncoderDisconnected" event. */ + "Microsoft.Media.LiveEventEncoderDisconnected": MediaLiveEventEncoderDisconnectedEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventIncomingStreamReceived" event. */ + "Microsoft.Media.LiveEventIncomingStreamReceived": MediaLiveEventIncomingStreamReceivedEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventIncomingStreamsOutOfSync" event. */ + "Microsoft.Media.LiveEventIncomingStreamsOutOfSync": MediaLiveEventIncomingStreamsOutOfSyncEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync" event. */ + "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync": MediaLiveEventIncomingVideoStreamsOutOfSyncEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventIncomingDataChunkDropped" event. */ + "Microsoft.Media.LiveEventIncomingDataChunkDropped": MediaLiveEventIncomingDataChunkDroppedEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventIngestHeartbeat" event. */ + "Microsoft.Media.LiveEventIngestHeartbeat": MediaLiveEventIngestHeartbeatEventData; + /** An interface for the event data of a "Microsoft.Media.LiveEventTrackDiscontinuityDetected" event. */ + "Microsoft.Media.LiveEventTrackDiscontinuityDetected": MediaLiveEventTrackDiscontinuityDetectedEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceWriteSuccess" event. */ + "Microsoft.Resources.ResourceWriteSuccess": ResourceWriteSuccessEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceWriteFailure" event. */ + "Microsoft.Resources.ResourceWriteFailure": ResourceWriteFailureEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceWriteCancel" event. */ + "Microsoft.Resources.ResourceWriteCancel": ResourceWriteCancelEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceDeleteSuccess" event. */ + "Microsoft.Resources.ResourceDeleteSuccess": ResourceDeleteSuccessEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceDeleteFailure" event. */ + "Microsoft.Resources.ResourceDeleteFailure": ResourceDeleteFailureEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceDeleteCancel" event. */ + "Microsoft.Resources.ResourceDeleteCancel": ResourceDeleteCancelEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceActionSuccess" event. */ + "Microsoft.Resources.ResourceActionSuccess": ResourceActionSuccessEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceActionFailure" event. */ + "Microsoft.Resources.ResourceActionFailure": ResourceActionFailureEventData; + /** An interface for the event data of a "Microsoft.Resources.ResourceActionCancel" event. */ + "Microsoft.Resources.ResourceActionCancel": ResourceActionCancelEventData; + /** An interface for the event data of a "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners" event. */ + "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners": ServiceBusActiveMessagesAvailableWithNoListenersEventData; + /** An interface for the event data of a "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener" event. */ + "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener": ServiceBusDeadletterMessagesAvailableWithNoListenersEventData; + /** An interface for the event data of a "Microsoft.Storage.BlobCreated" event. */ + "Microsoft.Storage.BlobCreated": StorageBlobCreatedEventData; + /** An interface for the event data of a "Microsoft.Storage.BlobDeleted" event. */ + "Microsoft.Storage.BlobDeleted": StorageBlobDeletedEventData; + /** An interface for the event data of a "Microsoft.Storage.BlobRenamed" event. */ + "Microsoft.Storage.BlobRenamed": StorageBlobRenamedEventData; + /** An interface for the event data of a "Microsoft.Storage.DirectoryCreated" event. */ + "Microsoft.Storage.DirectoryCreated": StorageDirectoryCreatedEventData; + /** An interface for the event data of a "Microsoft.Storage.DirectoryDeleted" event. */ + "Microsoft.Storage.DirectoryDeleted": StorageDirectoryDeletedEventData; + /** An interface for the event data of a "Microsoft.Storage.DirectoryRenamed" event. */ + "Microsoft.Storage.DirectoryRenamed": StorageDirectoryRenamedEventData; + /** An interface for the event data of a "Microsoft.Storage.LifecyclePolicyCompleted" event. */ + "Microsoft.Storage.LifecyclePolicyCompleted": StorageLifecyclePolicyCompletedEventData; + /** An interface for the event data of a "Microsoft.Web.AppUpdated" event. */ + "Microsoft.Web.AppUpdated": WebAppUpdatedEventData; + /** An interface for the event data of a "Microsoft.Web.BackupOperationStarted" event. */ + "Microsoft.Web.BackupOperationStarted": WebBackupOperationStartedEventData; + /** An interface for the event data of a "Microsoft.Web.BackupOperationCompleted" event. */ + "Microsoft.Web.BackupOperationCompleted": WebBackupOperationCompletedEventData; + /** An interface for the event data of a "Microsoft.Web.BackupOperationFailed" event. */ + "Microsoft.Web.BackupOperationFailed": WebBackupOperationFailedEventData; + /** An interface for the event data of a "Microsoft.Web.RestoreOperationStarted" event. */ + "Microsoft.Web.RestoreOperationStarted": WebRestoreOperationStartedEventData; + /** An interface for the event data of a "Microsoft.Web.RestoreOperationCompleted" event. */ + "Microsoft.Web.RestoreOperationCompleted": WebRestoreOperationCompletedEventData; + /** An interface for the event data of a "Microsoft.Web.RestoreOperationFailed" event. */ + "Microsoft.Web.RestoreOperationFailed": WebRestoreOperationFailedEventData; + /** An interface for the event data of a "Microsoft.Web.SlotSwapStarted" event. */ + "Microsoft.Web.SlotSwapStarted": WebSlotSwapStartedEventData; + /** An interface for the event data of a "Microsoft.Web.SlotSwapCompleted" event. */ + "Microsoft.Web.SlotSwapCompleted": WebSlotSwapCompletedEventData; + /** An interface for the event data of a "Microsoft.Web.SlotSwapFailed" event. */ + "Microsoft.Web.SlotSwapFailed": WebSlotSwapFailedEventData; + /** An interface for the event data of a "Microsoft.Web.SlotSwapWithPreviewStarted" event. */ + "Microsoft.Web.SlotSwapWithPreviewStarted": WebSlotSwapWithPreviewStartedEventData; + /** An interface for the event data of a "Microsoft.Web.SlotSwapWithPreviewCancelled" event. */ + "Microsoft.Web.SlotSwapWithPreviewCancelled": WebSlotSwapWithPreviewCancelledEventData; + /** An interface for the event data of a "Microsoft.Web.AppServicePlanUpdated" event. */ + "Microsoft.Web.AppServicePlanUpdated": WebAppServicePlanUpdatedEventData; +} + +/** + * isCloudEventLike returns "true" when the event is a CloudEvent + * + * @param o Either an EventGrid our CloudEvent event. + */ +function isCloudEventLike( + o: EventGridEvent | CloudEvent +): o is CloudEvent { + return (o as any).source !== undefined; +} + +/** + * iSystemEvent returns "true" when a given event is a system event of a given type. When using + * TypeScript, this function acts as a custom type guard and allows the TypeScript compiler to + * identify the underlying data + * + * @param eventType The type of system event to check for, e.g., "Microsoft.AppConfiguration.KeyValueDeleted" + * @param event The event to test. + */ +export function isSystemEvent( + eventType: T, + event: EventGridEvent +): event is EventGridEvent; + +/** + * iSystemEvent returns "true" when a given event is a system event of a given type. When using + * TypeScript, this function acts as a custom type guard and allows the TypeScript compiler to + * identify the underlying data + * + * @param eventType The type of system event to check for, e.g., "Microsoft.AppConfiguration.KeyValueDeleted" + * @param event The event to test. + */ +export function isSystemEvent( + eventType: T, + event: CloudEvent +): event is CloudEvent; + +export function isSystemEvent( + eventType: T, + event: EventGridEvent | CloudEvent +): event is + | EventGridEvent + | CloudEvent { + if (isCloudEventLike(event)) { + return event.type === eventType; + } else { + return event.eventType === eventType; + } +} diff --git a/sdk/eventgrid/eventgrid/src/sharedAccessSignitureCredential.ts b/sdk/eventgrid/eventgrid/src/sharedAccessSignitureCredential.ts new file mode 100644 index 000000000000..73306480da20 --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/sharedAccessSignitureCredential.ts @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** + * Represents a credential defined by a shared signature. + */ +export interface SignatureCredential { + /** + * The signature to be used in authentication. + */ + signature(): string; +} + +/** + * A credential type which allows using a "shared access signature" to authenticate with EventGrid + * when sending events. + * + * A shared access signiture may be generated by using `EventGridPublisherClient#generateSharedAccessSignature` + */ +export class EventGridSharedAccessSignatureCredential implements SignatureCredential { + private _signature: string; + + /** + * The value of the signature to be used in authentication + */ + public signature(): string { + return this._signature; + } + + /** + * Create an instance of an EventGridSharedAccessSignatureCredential for use + * with a service client. + * + * @param {string} signature the signature to use in authentication + */ + constructor(signature: string) { + if (!signature) { + throw new Error("signature must be a non-empty string"); + } + + this._signature = signature; + } + + /** + * Change the value of the signature. + * + * Updates will take effect upon the next request after + * updating the signature value. + * + * @param {string} newSignature the new signature value to be used + */ + public update(newSignature: string): void { + this._signature = newSignature; + } +} diff --git a/sdk/eventgrid/eventgrid/src/systemEventDecoders.ts b/sdk/eventgrid/eventgrid/src/systemEventDecoders.ts new file mode 100644 index 000000000000..73e25ef0a48d --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/systemEventDecoders.ts @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Mapper, Serializer } from "@azure/core-http"; +import { CustomEventDataDeserializer } from "./models"; +import { + AppConfigurationKeyValueDeletedEventData, + AppConfigurationKeyValueModifiedEventData, + AppEventTypeDetail, + AppServicePlanEventTypeDetail, + ContainerRegistryArtifactEventData, + ContainerRegistryArtifactEventTarget, + ContainerRegistryChartDeletedEventData, + ContainerRegistryChartPushedEventData, + ContainerRegistryEventActor, + ContainerRegistryEventData, + ContainerRegistryEventRequest, + ContainerRegistryEventSource, + ContainerRegistryEventTarget, + ContainerRegistryImageDeletedEventData, + ContainerRegistryImagePushedEventData, + DeviceConnectionStateEventInfo, + DeviceConnectionStateEventProperties, + DeviceLifeCycleEventProperties, + DeviceTelemetryEventProperties, + DeviceTwinInfo, + DeviceTwinInfoProperties, + DeviceTwinInfoX509Thumbprint, + DeviceTwinMetadata, + DeviceTwinProperties, + EventHubCaptureFileCreatedEventData, + IotHubDeviceConnectedEventData, + IotHubDeviceCreatedEventData, + IotHubDeviceDeletedEventData, + IotHubDeviceDisconnectedEventData, + IotHubDeviceTelemetryEventData, + KeyVaultCertificateExpiredEventData, + KeyVaultCertificateNearExpiryEventData, + KeyVaultCertificateNewVersionCreatedEventData, + KeyVaultKeyExpiredEventData, + KeyVaultKeyNearExpiryEventData, + KeyVaultKeyNewVersionCreatedEventData, + KeyVaultSecretExpiredEventData, + KeyVaultSecretNearExpiryEventData, + KeyVaultSecretNewVersionCreatedEventData, + MachineLearningServicesDatasetDriftDetectedEventData, + MachineLearningServicesModelDeployedEventData, + MachineLearningServicesModelRegisteredEventData, + MachineLearningServicesRunCompletedEventData, + MachineLearningServicesRunStatusChangedEventData, + MapsGeofenceEnteredEventData, + MapsGeofenceEventProperties, + MapsGeofenceExitedEventData, + MapsGeofenceGeometry, + MapsGeofenceResultEventData, + MediaJobCanceledEventData, + MediaJobCancelingEventData, + MediaJobError, + MediaJobErrorDetail, + MediaJobErroredEventData, + MediaJobFinishedEventData, + MediaJobOutput, + MediaJobOutputAsset, + MediaJobOutputCanceledEventData, + MediaJobOutputCancelingEventData, + MediaJobOutputErroredEventData, + MediaJobOutputFinishedEventData, + MediaJobOutputProcessingEventData, + MediaJobOutputProgressEventData, + MediaJobOutputScheduledEventData, + MediaJobOutputStateChangeEventData, + MediaJobProcessingEventData, + MediaJobScheduledEventData, + MediaJobStateChangeEventData, + MediaLiveEventConnectionRejectedEventData, + MediaLiveEventEncoderConnectedEventData, + MediaLiveEventEncoderDisconnectedEventData, + MediaLiveEventIncomingDataChunkDroppedEventData, + MediaLiveEventIncomingStreamReceivedEventData, + MediaLiveEventIncomingStreamsOutOfSyncEventData, + MediaLiveEventIncomingVideoStreamsOutOfSyncEventData, + MediaLiveEventIngestHeartbeatEventData, + MediaLiveEventTrackDiscontinuityDetectedEventData, + RedisExportRDBCompletedEventData, + RedisImportRDBCompletedEventData, + RedisPatchingCompletedEventData, + RedisScalingCompletedEventData, + ResourceActionCancelEventData, + ResourceActionFailureEventData, + ResourceActionSuccessEventData, + ResourceDeleteCancelEventData, + ResourceDeleteFailureEventData, + ResourceDeleteSuccessEventData, + ResourceWriteCancelEventData, + ResourceWriteFailureEventData, + ResourceWriteSuccessEventData, + ServiceBusActiveMessagesAvailableWithNoListenersEventData, + ServiceBusDeadletterMessagesAvailableWithNoListenersEventData, + SignalRServiceClientConnectionConnectedEventData, + SignalRServiceClientConnectionDisconnectedEventData, + StorageBlobCreatedEventData, + StorageBlobDeletedEventData, + StorageBlobRenamedEventData, + StorageDirectoryCreatedEventData, + StorageDirectoryDeletedEventData, + StorageDirectoryRenamedEventData, + StorageLifecyclePolicyActionSummaryDetail, + StorageLifecyclePolicyCompletedEventData, + SubscriptionDeletedEventData, + SubscriptionValidationEventData, + SubscriptionValidationResponse, + WebAppServicePlanUpdatedEventData, + WebAppServicePlanUpdatedEventDataSku, + WebAppUpdatedEventData, + WebBackupOperationCompletedEventData, + WebBackupOperationFailedEventData, + WebBackupOperationStartedEventData, + WebRestoreOperationCompletedEventData, + WebRestoreOperationFailedEventData, + WebRestoreOperationStartedEventData, + WebSlotSwapCompletedEventData, + WebSlotSwapFailedEventData, + WebSlotSwapStartedEventData, + WebSlotSwapWithPreviewCancelledEventData, + WebSlotSwapWithPreviewStartedEventData +} from "./generated/models/mappers"; + +const serializer = new Serializer({ + AppConfigurationKeyValueDeletedEventData: AppConfigurationKeyValueDeletedEventData, + AppConfigurationKeyValueModifiedEventData: AppConfigurationKeyValueModifiedEventData, + AppEventTypeDetail: AppEventTypeDetail, + AppServicePlanEventTypeDetail: AppServicePlanEventTypeDetail, + ContainerRegistryArtifactEventData: ContainerRegistryArtifactEventData, + ContainerRegistryArtifactEventTarget: ContainerRegistryArtifactEventTarget, + ContainerRegistryChartDeletedEventData: ContainerRegistryChartDeletedEventData, + ContainerRegistryChartPushedEventData: ContainerRegistryChartPushedEventData, + ContainerRegistryEventActor: ContainerRegistryEventActor, + ContainerRegistryEventData: ContainerRegistryEventData, + ContainerRegistryEventRequest: ContainerRegistryEventRequest, + ContainerRegistryEventSource: ContainerRegistryEventSource, + ContainerRegistryEventTarget: ContainerRegistryEventTarget, + ContainerRegistryImageDeletedEventData: ContainerRegistryImageDeletedEventData, + ContainerRegistryImagePushedEventData: ContainerRegistryImagePushedEventData, + DeviceConnectionStateEventInfo: DeviceConnectionStateEventInfo, + DeviceConnectionStateEventProperties: DeviceConnectionStateEventProperties, + DeviceLifeCycleEventProperties: DeviceLifeCycleEventProperties, + DeviceTelemetryEventProperties: DeviceTelemetryEventProperties, + DeviceTwinInfo: DeviceTwinInfo, + DeviceTwinInfoProperties: DeviceTwinInfoProperties, + DeviceTwinInfoX509Thumbprint: DeviceTwinInfoX509Thumbprint, + DeviceTwinMetadata: DeviceTwinMetadata, + DeviceTwinProperties: DeviceTwinProperties, + EventHubCaptureFileCreatedEventData: EventHubCaptureFileCreatedEventData, + IotHubDeviceConnectedEventData: IotHubDeviceConnectedEventData, + IotHubDeviceCreatedEventData: IotHubDeviceCreatedEventData, + IotHubDeviceDeletedEventData: IotHubDeviceDeletedEventData, + IotHubDeviceDisconnectedEventData: IotHubDeviceDisconnectedEventData, + IotHubDeviceTelemetryEventData: IotHubDeviceTelemetryEventData, + KeyVaultCertificateExpiredEventData: KeyVaultCertificateExpiredEventData, + KeyVaultCertificateNearExpiryEventData: KeyVaultCertificateNearExpiryEventData, + KeyVaultCertificateNewVersionCreatedEventData: KeyVaultCertificateNewVersionCreatedEventData, + KeyVaultKeyExpiredEventData: KeyVaultKeyExpiredEventData, + KeyVaultKeyNearExpiryEventData: KeyVaultKeyNearExpiryEventData, + KeyVaultKeyNewVersionCreatedEventData: KeyVaultKeyNewVersionCreatedEventData, + KeyVaultSecretExpiredEventData: KeyVaultSecretExpiredEventData, + KeyVaultSecretNearExpiryEventData: KeyVaultSecretNearExpiryEventData, + KeyVaultSecretNewVersionCreatedEventData: KeyVaultSecretNewVersionCreatedEventData, + MachineLearningServicesDatasetDriftDetectedEventData: MachineLearningServicesDatasetDriftDetectedEventData, + MachineLearningServicesModelDeployedEventData: MachineLearningServicesModelDeployedEventData, + MachineLearningServicesModelRegisteredEventData: MachineLearningServicesModelRegisteredEventData, + MachineLearningServicesRunCompletedEventData: MachineLearningServicesRunCompletedEventData, + MachineLearningServicesRunStatusChangedEventData: MachineLearningServicesRunStatusChangedEventData, + MapsGeofenceEnteredEventData: MapsGeofenceEnteredEventData, + MapsGeofenceEventProperties: MapsGeofenceEventProperties, + MapsGeofenceExitedEventData: MapsGeofenceExitedEventData, + MapsGeofenceGeometry: MapsGeofenceGeometry, + MapsGeofenceResultEventData: MapsGeofenceResultEventData, + MediaJobCanceledEventData: MediaJobCanceledEventData, + MediaJobCancelingEventData: MediaJobCancelingEventData, + MediaJobError: MediaJobError, + MediaJobErrorDetail: MediaJobErrorDetail, + MediaJobErroredEventData: MediaJobErroredEventData, + MediaJobFinishedEventData: MediaJobFinishedEventData, + MediaJobOutput: MediaJobOutput, + MediaJobOutputAsset: MediaJobOutputAsset, + MediaJobOutputCanceledEventData: MediaJobOutputCanceledEventData, + MediaJobOutputCancelingEventData: MediaJobOutputCancelingEventData, + MediaJobOutputErroredEventData: MediaJobOutputErroredEventData, + MediaJobOutputFinishedEventData: MediaJobOutputFinishedEventData, + MediaJobOutputProcessingEventData: MediaJobOutputProcessingEventData, + MediaJobOutputProgressEventData: MediaJobOutputProgressEventData, + MediaJobOutputScheduledEventData: MediaJobOutputScheduledEventData, + MediaJobOutputStateChangeEventData: MediaJobOutputStateChangeEventData, + MediaJobProcessingEventData: MediaJobProcessingEventData, + MediaJobScheduledEventData: MediaJobScheduledEventData, + MediaJobStateChangeEventData: MediaJobStateChangeEventData, + MediaLiveEventConnectionRejectedEventData: MediaLiveEventConnectionRejectedEventData, + MediaLiveEventEncoderConnectedEventData: MediaLiveEventEncoderConnectedEventData, + MediaLiveEventEncoderDisconnectedEventData: MediaLiveEventEncoderDisconnectedEventData, + MediaLiveEventIncomingDataChunkDroppedEventData: MediaLiveEventIncomingDataChunkDroppedEventData, + MediaLiveEventIncomingStreamReceivedEventData: MediaLiveEventIncomingStreamReceivedEventData, + MediaLiveEventIncomingStreamsOutOfSyncEventData: MediaLiveEventIncomingStreamsOutOfSyncEventData, + MediaLiveEventIncomingVideoStreamsOutOfSyncEventData: MediaLiveEventIncomingVideoStreamsOutOfSyncEventData, + MediaLiveEventIngestHeartbeatEventData: MediaLiveEventIngestHeartbeatEventData, + MediaLiveEventTrackDiscontinuityDetectedEventData: MediaLiveEventTrackDiscontinuityDetectedEventData, + RedisExportRDBCompletedEventData: RedisExportRDBCompletedEventData, + RedisImportRDBCompletedEventData: RedisImportRDBCompletedEventData, + RedisPatchingCompletedEventData: RedisPatchingCompletedEventData, + RedisScalingCompletedEventData: RedisScalingCompletedEventData, + ResourceActionCancelEventData: ResourceActionCancelEventData, + ResourceActionFailureEventData: ResourceActionFailureEventData, + ResourceActionSuccessEventData: ResourceActionSuccessEventData, + ResourceDeleteCancelEventData: ResourceDeleteCancelEventData, + ResourceDeleteFailureEventData: ResourceDeleteFailureEventData, + ResourceDeleteSuccessEventData: ResourceDeleteSuccessEventData, + ResourceWriteCancelEventData: ResourceWriteCancelEventData, + ResourceWriteFailureEventData: ResourceWriteFailureEventData, + ResourceWriteSuccessEventData: ResourceWriteSuccessEventData, + ServiceBusActiveMessagesAvailableWithNoListenersEventData: ServiceBusActiveMessagesAvailableWithNoListenersEventData, + ServiceBusDeadletterMessagesAvailableWithNoListenersEventData: ServiceBusDeadletterMessagesAvailableWithNoListenersEventData, + SignalRServiceClientConnectionConnectedEventData: SignalRServiceClientConnectionConnectedEventData, + SignalRServiceClientConnectionDisconnectedEventData: SignalRServiceClientConnectionDisconnectedEventData, + StorageBlobCreatedEventData: StorageBlobCreatedEventData, + StorageBlobDeletedEventData: StorageBlobDeletedEventData, + StorageBlobRenamedEventData: StorageBlobRenamedEventData, + StorageDirectoryCreatedEventData: StorageDirectoryCreatedEventData, + StorageDirectoryDeletedEventData: StorageDirectoryDeletedEventData, + StorageDirectoryRenamedEventData: StorageDirectoryRenamedEventData, + StorageLifecyclePolicyActionSummaryDetail: StorageLifecyclePolicyActionSummaryDetail, + StorageLifecyclePolicyCompletedEventData: StorageLifecyclePolicyCompletedEventData, + SubscriptionDeletedEventData: SubscriptionDeletedEventData, + SubscriptionValidationEventData: SubscriptionValidationEventData, + SubscriptionValidationResponse: SubscriptionValidationResponse, + WebAppServicePlanUpdatedEventData: WebAppServicePlanUpdatedEventData, + WebAppServicePlanUpdatedEventDataSku: WebAppServicePlanUpdatedEventDataSku, + WebAppUpdatedEventData: WebAppUpdatedEventData, + WebBackupOperationCompletedEventData: WebBackupOperationCompletedEventData, + WebBackupOperationFailedEventData: WebBackupOperationFailedEventData, + WebBackupOperationStartedEventData: WebBackupOperationStartedEventData, + WebRestoreOperationCompletedEventData: WebRestoreOperationCompletedEventData, + WebRestoreOperationFailedEventData: WebRestoreOperationFailedEventData, + WebRestoreOperationStartedEventData: WebRestoreOperationStartedEventData, + WebSlotSwapCompletedEventData: WebSlotSwapCompletedEventData, + WebSlotSwapFailedEventData: WebSlotSwapFailedEventData, + WebSlotSwapStartedEventData: WebSlotSwapStartedEventData, + WebSlotSwapWithPreviewCancelledEventData: WebSlotSwapWithPreviewCancelledEventData, + WebSlotSwapWithPreviewStartedEventData: WebSlotSwapWithPreviewStartedEventData +}); + +function makeDeserializerFromMapper( + mapper: Mapper, + initialDeserializers?: CustomEventDataDeserializer[] +): CustomEventDataDeserializer { + return async function(o: any): Promise { + if (initialDeserializers) { + for (const deserializer of initialDeserializers) { + o = await deserializer(o); + } + } + + return serializer.deserialize(mapper, o, ""); + }; +} + +// Some system events are published in a format that does not match the schema they publish. In these cases, the "event data" +// field is actually a string with the event data encoded as JSON. For the few system events we know of that are incorrect we +// use this deserializer to convert from the string to an object. This function is written such that it is a no-op when a non +// string value is provided (i.e. when the system events are corrected to publish the data as an actual object, we will not break). +async function jsonParseDeserializer(o: any): Promise { + if (typeof o === "string") { + return JSON.parse(o); + } + + return o; +} + +export const systemDeserializers: Record = { + "Microsoft.AppConfiguration.KeyValueDeleted": makeDeserializerFromMapper( + AppConfigurationKeyValueDeletedEventData + ), + "Microsoft.AppConfiguration.KeyValueModified": makeDeserializerFromMapper( + AppConfigurationKeyValueModifiedEventData + ), + "Microsoft.ContainerRegistry.ChartDeleted": makeDeserializerFromMapper( + ContainerRegistryEventData, + [jsonParseDeserializer] + ), + "Microsoft.ContainerRegistry.ChartPushed": makeDeserializerFromMapper( + ContainerRegistryEventData, + [jsonParseDeserializer] + ), + "Microsoft.ContainerRegistry.ImageDeleted": makeDeserializerFromMapper( + ContainerRegistryEventData, + [jsonParseDeserializer] + ), + "Microsoft.ContainerRegistry.ImagePushed": makeDeserializerFromMapper( + ContainerRegistryEventData, + [jsonParseDeserializer] + ), + "Microsoft.Devices.DeviceCreated": makeDeserializerFromMapper(IotHubDeviceCreatedEventData), + "Microsoft.Devices.DeviceDeleted": makeDeserializerFromMapper(IotHubDeviceDeletedEventData), + "Microsoft.Devices.DeviceConnected": makeDeserializerFromMapper(IotHubDeviceConnectedEventData), + "Microsoft.Devices.DeviceDisconnected": makeDeserializerFromMapper( + IotHubDeviceDisconnectedEventData + ), + "Microsoft.Devices.DeviceTelemetry": makeDeserializerFromMapper(IotHubDeviceTelemetryEventData), + "Microsoft.EventGrid.SubscriptionValidationEvent": makeDeserializerFromMapper( + SubscriptionValidationEventData + ), + "Microsoft.EventGrid.SubscriptionDeletedEvent": makeDeserializerFromMapper( + SubscriptionDeletedEventData + ), + "Microsoft.EventHub.CaptureFileCreated": makeDeserializerFromMapper( + EventHubCaptureFileCreatedEventData + ), + "Microsoft.MachineLearningServices.DatasetDriftDetected": makeDeserializerFromMapper( + MachineLearningServicesDatasetDriftDetectedEventData + ), + "Microsoft.MachineLearningServices.ModelDeployed": makeDeserializerFromMapper( + MachineLearningServicesModelDeployedEventData + ), + "Microsoft.MachineLearningServices.ModelRegistered": makeDeserializerFromMapper( + MachineLearningServicesModelRegisteredEventData + ), + "Microsoft.MachineLearningServices.RunCompleted": makeDeserializerFromMapper( + MachineLearningServicesRunCompletedEventData + ), + "Microsoft.MachineLearningServices.RunStatusChanged": makeDeserializerFromMapper( + MachineLearningServicesRunStatusChangedEventData + ), + "Microsoft.Maps.GeofenceEntered": makeDeserializerFromMapper(MapsGeofenceEnteredEventData), + "Microsoft.Maps.GeofenceExited": makeDeserializerFromMapper(MapsGeofenceExitedEventData), + "Microsoft.Maps.GeofenceResult": makeDeserializerFromMapper(MapsGeofenceResultEventData), + "Microsoft.Media.JobStateChange": makeDeserializerFromMapper(MediaJobStateChangeEventData), + "Microsoft.Media.JobOutputStateChange": makeDeserializerFromMapper( + MediaJobOutputStateChangeEventData + ), + "Microsoft.Media.JobScheduled": makeDeserializerFromMapper(MediaJobScheduledEventData), + "Microsoft.Media.JobProcessing": makeDeserializerFromMapper(MediaJobProcessingEventData), + "Microsoft.Media.JobCanceling": makeDeserializerFromMapper(MediaJobCancelingEventData), + "Microsoft.Media.JobFinished": makeDeserializerFromMapper(MediaJobFinishedEventData), + "Microsoft.Media.JobCanceled": makeDeserializerFromMapper(MediaJobCanceledEventData), + "Microsoft.Media.JobErrored": makeDeserializerFromMapper(MediaJobErroredEventData), + "Microsoft.Media.JobOutputCanceled": makeDeserializerFromMapper(MediaJobOutputCanceledEventData), + "Microsoft.Media.JobOutputCanceling": makeDeserializerFromMapper( + MediaJobOutputCancelingEventData + ), + "Microsoft.Media.JobOutputErrored": makeDeserializerFromMapper(MediaJobOutputErroredEventData), + "Microsoft.Media.JobOutputFinished": makeDeserializerFromMapper(MediaJobOutputFinishedEventData), + "Microsoft.Media.JobOutputProcessing": makeDeserializerFromMapper( + MediaJobOutputProcessingEventData + ), + "Microsoft.Media.JobOutputScheduled": makeDeserializerFromMapper( + MediaJobOutputScheduledEventData + ), + "Microsoft.Media.JobOutputProgress": makeDeserializerFromMapper(MediaJobOutputProgressEventData), + "Microsoft.Media.LiveEventEncoderConnected": makeDeserializerFromMapper( + MediaLiveEventEncoderConnectedEventData + ), + "Microsoft.Media.LiveEventConnectionRejected": makeDeserializerFromMapper( + MediaLiveEventConnectionRejectedEventData + ), + "Microsoft.Media.LiveEventEncoderDisconnected": makeDeserializerFromMapper( + MediaLiveEventEncoderDisconnectedEventData + ), + "Microsoft.Media.LiveEventIncomingStreamReceived": makeDeserializerFromMapper( + MediaLiveEventIncomingStreamReceivedEventData + ), + "Microsoft.Media.LiveEventIncomingStreamsOutOfSync": makeDeserializerFromMapper( + MediaLiveEventIncomingStreamsOutOfSyncEventData + ), + "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync": makeDeserializerFromMapper( + MediaLiveEventIncomingVideoStreamsOutOfSyncEventData + ), + "Microsoft.Media.LiveEventIncomingDataChunkDropped": makeDeserializerFromMapper( + MediaLiveEventIncomingDataChunkDroppedEventData + ), + "Microsoft.Media.LiveEventIngestHeartbeat": makeDeserializerFromMapper( + MediaLiveEventIngestHeartbeatEventData + ), + "Microsoft.Media.LiveEventTrackDiscontinuityDetected": makeDeserializerFromMapper( + MediaLiveEventTrackDiscontinuityDetectedEventData + ), + "Microsoft.Resources.ResourceWriteSuccess": makeDeserializerFromMapper( + ResourceWriteSuccessEventData + ), + "Microsoft.Resources.ResourceWriteFailure": makeDeserializerFromMapper( + ResourceWriteFailureEventData + ), + "Microsoft.Resources.ResourceWriteCancel": makeDeserializerFromMapper( + ResourceWriteCancelEventData + ), + "Microsoft.Resources.ResourceDeleteSuccess": makeDeserializerFromMapper( + ResourceDeleteSuccessEventData + ), + "Microsoft.Resources.ResourceDeleteFailure": makeDeserializerFromMapper( + ResourceDeleteFailureEventData + ), + "Microsoft.Resources.ResourceDeleteCancel": makeDeserializerFromMapper( + ResourceDeleteCancelEventData + ), + "Microsoft.Resources.ResourceActionSuccess": makeDeserializerFromMapper( + ResourceActionSuccessEventData + ), + "Microsoft.Resources.ResourceActionFailure": makeDeserializerFromMapper( + ResourceActionFailureEventData + ), + "Microsoft.Resources.ResourceActionCancel": makeDeserializerFromMapper( + ResourceActionCancelEventData + ), + "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners": makeDeserializerFromMapper( + ServiceBusActiveMessagesAvailableWithNoListenersEventData + ), + "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener": makeDeserializerFromMapper( + ServiceBusDeadletterMessagesAvailableWithNoListenersEventData + ), + "Microsoft.Storage.BlobCreated": makeDeserializerFromMapper(StorageBlobCreatedEventData), + "Microsoft.Storage.BlobDeleted": makeDeserializerFromMapper(StorageBlobDeletedEventData), + "Microsoft.Storage.BlobRenamed": makeDeserializerFromMapper(StorageBlobRenamedEventData), + "Microsoft.Storage.DirectoryCreated": makeDeserializerFromMapper( + StorageDirectoryCreatedEventData + ), + "Microsoft.Storage.DirectoryDeleted": makeDeserializerFromMapper( + StorageDirectoryDeletedEventData + ), + "Microsoft.Storage.DirectoryRenamed": makeDeserializerFromMapper( + StorageDirectoryRenamedEventData + ), + "Microsoft.Storage.LifecyclePolicyCompleted": makeDeserializerFromMapper( + StorageLifecyclePolicyCompletedEventData + ), + "Microsoft.Web.AppUpdated": makeDeserializerFromMapper(WebAppUpdatedEventData), + "Microsoft.Web.BackupOperationStarted": makeDeserializerFromMapper( + WebBackupOperationStartedEventData + ), + "Microsoft.Web.BackupOperationCompleted": makeDeserializerFromMapper( + WebBackupOperationCompletedEventData + ), + "Microsoft.Web.BackupOperationFailed": makeDeserializerFromMapper( + WebBackupOperationFailedEventData + ), + "Microsoft.Web.RestoreOperationStarted": makeDeserializerFromMapper( + WebRestoreOperationStartedEventData + ), + "Microsoft.Web.RestoreOperationCompleted": makeDeserializerFromMapper( + WebRestoreOperationCompletedEventData + ), + "Microsoft.Web.RestoreOperationFailed": makeDeserializerFromMapper( + WebRestoreOperationFailedEventData + ), + "Microsoft.Web.SlotSwapStarted": makeDeserializerFromMapper(WebSlotSwapStartedEventData), + "Microsoft.Web.SlotSwapCompleted": makeDeserializerFromMapper(WebSlotSwapCompletedEventData), + "Microsoft.Web.SlotSwapFailed": makeDeserializerFromMapper(WebSlotSwapFailedEventData), + "Microsoft.Web.SlotSwapWithPreviewStarted": makeDeserializerFromMapper( + WebSlotSwapWithPreviewStartedEventData + ), + "Microsoft.Web.SlotSwapWithPreviewCancelled": makeDeserializerFromMapper( + WebSlotSwapWithPreviewCancelledEventData + ), + "Microsoft.Web.AppServicePlanUpdated": makeDeserializerFromMapper( + WebAppServicePlanUpdatedEventData + ) +}; diff --git a/sdk/eventgrid/eventgrid/src/util.ts b/sdk/eventgrid/eventgrid/src/util.ts new file mode 100644 index 000000000000..0df40763a42d --- /dev/null +++ b/sdk/eventgrid/eventgrid/src/util.ts @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyCredential } from "@azure/core-auth"; + +/** + * Stringifies a Date object in the format expected by the Event Grid service, for use in a Shared Access Signiture. + * + * The service expects this time string to be in the same format as what is returned by the .NET DateTime.ToString + * method, using the "en-US" culture. + * + * This corresponds to the .NET format string: "M/d/yyyy h:mm:ss tt". For example, the date "June 5th, 2020, 12:09:03 PM" + * is represented as the string "6/5/2020 12:09:03 PM" + * + * The service expects a UTC time, so this method returns a string based on the UTC time of the provided Date. + * + * @param d The Date object to convert to a string. + */ +export function dateToServiceTimeString(d: Date): string { + const month = d.getUTCMonth() + 1; // getUTCMonth returns 0-11 not 1-12. + const day = d.getUTCDate(); + const year = d.getUTCFullYear(); + + const hour = d.getUTCHours() === 0 ? 12 : d.getUTCHours() % 12; // getUTCHours returns 0-23, and we want this in 12 hour format. + const minute = d + .getUTCMinutes() + .toString() + .padStart(2, "0"); + const second = d + .getUTCSeconds() + .toString() + .padStart(2, "0"); + const am = d.getUTCHours() >= 13 ? "PM" : "AM"; + + return `${month}/${day}/${year} ${hour}:${minute}:${second} ${am}`; +} + +/** + * Returns `true` if the credential object is like the KeyCredential interface (i.e. it has a + * key property). + * + * @param credential the object to test + */ +export function isKeyCredentialLike(o: any): o is KeyCredential { + return o.key !== undefined; +} + +export function parseAndWrap(jsonStringOrObject: string | object): any[] { + if (typeof jsonStringOrObject === "string") { + const o = JSON.parse(jsonStringOrObject); + if (Array.isArray(o)) { + return o; + } else { + return [o]; + } + } + + if (Array.isArray(jsonStringOrObject)) { + return jsonStringOrObject; + } else { + return [jsonStringOrObject]; + } +} + +const EVENT_GRID_SCHEMA_METADATA_VERSION = "1"; + +export function validateEventGridEvent(o: any): void { + if (typeof o !== "object") { + throw new TypeError("event is not an object"); + } + + validateRequiredStringProperties(o, [ + "eventType", + "eventTime", + "id", + "subject", + "topic", + "dataVersion", + "metadataVersion" + ]); + + validateRequiredAnyProperties(o, ["data"]); + + if (o.metadataVersion !== EVENT_GRID_SCHEMA_METADATA_VERSION) { + throw new TypeError("event is not in the Event Grid schema"); + } +} + +const CLOUD_EVENT_1_0_SPEC_VERSION = "1.0"; + +export function validateCloudEventEvent(o: any): void { + validateRequiredStringProperties(o, ["type", "source", "id", "specversion"]); + validateOptionalStringProperties(o, ["time", "dataschema", "datacontenttype", "subject"]); + + if (typeof o !== "object") { + throw new TypeError("event is not an object"); + } + + if (o.specversion !== CLOUD_EVENT_1_0_SPEC_VERSION) { + throw new Error("event is not in the Cloud Event 1.0 schema"); + } +} + +function validateRequiredStringProperties(o: any, propertyNames: string[]): void { + for (const propertyName of propertyNames) { + if (typeof o[propertyName] === "undefined") { + throw new Error(`event is missing required property '${propertyName}'`); + } + + if (typeof o[propertyName] !== "string") { + throw new TypeError( + `event property '${propertyName} should be a 'string', but is '${typeof o[propertyName]}'` + ); + } + } +} + +function validateRequiredAnyProperties(o: any, propertyNames: string[]): void { + for (const propertyName of propertyNames) { + if (typeof o[propertyName] === "undefined") { + throw new Error(`event is missing required property '${propertyName}'`); + } + } +} + +function validateOptionalStringProperties(o: any, propertyNames: string[]): void { + for (const propertyName of propertyNames) { + if (typeof o[propertyName] !== "undefined" && typeof o[propertyName] !== "string") { + throw new TypeError( + `event property '${propertyName}' should be a 'string' but it is a '${typeof o[ + propertyName + ]}'` + ); + } + } +} diff --git a/sdk/eventgrid/eventgrid/swagger/README.md b/sdk/eventgrid/eventgrid/swagger/README.md new file mode 100644 index 000000000000..e7715dff4dd6 --- /dev/null +++ b/sdk/eventgrid/eventgrid/swagger/README.md @@ -0,0 +1,52 @@ +# Azure Text Analytics TypeScript Protocol Layer + +> see https://aka.ms/autorest + +## Configuration + +```yaml +package-name: "@azure/eventgrid" +title: GeneratedClient +description: EventGrid Client +generate-metadata: false +add-credentials: false +license-header: MICROSOFT_MIT_NO_VERSION +output-folder: ../ +source-code-folder-path: ./src/generated +input-file: +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Storage/stable/2018-01-01/Storage.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.EventHub/stable/2018-01-01/EventHub.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Resources/stable/2018-01-01/Resources.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.EventGrid/stable/2018-01-01/EventGrid.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Devices/stable/2018-01-01/IotHub.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.ContainerRegistry/stable/2018-01-01/ContainerRegistry.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.ServiceBus/stable/2018-01-01/ServiceBus.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Media/stable/2018-01-01/MediaServices.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Maps/stable/2018-01-01/Maps.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.AppConfiguration/stable/2018-01-01/AppConfiguration.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.SignalRService/stable/2018-01-01/SignalRService.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.KeyVault/stable/2018-01-01/KeyVault.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.MachineLearningServices/stable/2018-01-01/MachineLearningServices.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Cache/stable/2018-01-01/RedisCache.json +- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Web/stable/2018-01-01/Web.json +use-extension: + "@autorest/typescript": "6.0.0-dev.20200618.1" +``` + +## Customizations + +### Use the "EventData" suffix on the Azure Resource Manager Event types, instead of just "Data" + +```yaml +directive: + - from: swagger-document + where: $.definitions + transform: > + ["Write", "Delete", "Action"].forEach(action => { + ["Success", "Failure", "Cancel"].forEach(status => { + if ($[`Resource${action}${status}Data`]) { + $[`Resource${action}${status}Data`]["x-ms-client-name"] = `Resource${action}${status}EventData`; + } + }); + }); +``` diff --git a/sdk/eventgrid/eventgrid/test/consumer.spec.ts b/sdk/eventgrid/eventgrid/test/consumer.spec.ts new file mode 100644 index 000000000000..ad21c9785a67 --- /dev/null +++ b/sdk/eventgrid/eventgrid/test/consumer.spec.ts @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { assert, use as chaiUse } from "chai"; +import chaiPromises from "chai-as-promised"; + +import { EventGridConsumer } from "../src"; +import * as testData from "./utils/testData"; + +chaiUse(chaiPromises); + +describe("EventGridConsumer", function() { + const consumer = new EventGridConsumer(); + + describe("#deserializeEventGridEvents", function() { + it("deserializes a single event", async () => { + const events = await consumer.deserializeEventGridEvents( + testData.customTestEvent1.eventGridSchema.encodedEvent + ); + + assert.lengthOf(events, 1); + assert.deepStrictEqual(events[0], testData.customTestEvent1.eventGridSchema.expected); + }); + + it("deserialized a batch with a single event ", async () => { + const events = await consumer.deserializeEventGridEvents( + wrapEncodedEventsInArray([testData.customTestEvent1.eventGridSchema]) + ); + + assert.lengthOf(events, 1); + assert.deepStrictEqual(events[0], testData.customTestEvent1.eventGridSchema.expected); + }); + + it("deserializes an batch of multiple events", async () => { + const events = await consumer.deserializeEventGridEvents( + wrapEncodedEventsInArray([ + testData.customTestEvent1.eventGridSchema, + testData.customTestEvent2.eventGridSchema + ]) + ); + + assert.lengthOf(events, 2); + assert.deepStrictEqual(events[0], testData.customTestEvent1.eventGridSchema.expected); + assert.deepStrictEqual(events[1], testData.customTestEvent2.eventGridSchema.expected); + }); + + it("deserializes system events correctly", async () => { + const events = await consumer.deserializeEventGridEvents( + testData.containerRegistryPushedEvent.eventGridSchema.encodedEvent + ); + + assert.lengthOf(events, 1); + assert.deepStrictEqual( + events[0], + testData.containerRegistryPushedEvent.eventGridSchema.expected + ); + }); + + it("fails when a required property is missing", () => { + const o = { ...testData.customTestEvent1.eventGridSchema.expected }; + for (const property of [ + "eventType", + "eventTime", + "id", + "metadataVersion", + "data", + "dataVersion" + ]) { + delete o[property]; + + assert.isRejected( + consumer.deserializeEventGridEvents(JSON.stringify(o)), + /missing required property/ + ); + } + }); + + it("fails when metadata version is wrong", () => { + const o = { ...testData.customTestEvent1.eventGridSchema.expected }; + o.metadataVersion = "2"; + + assert.isRejected( + consumer.deserializeEventGridEvents(JSON.stringify(o)), + /event is not in the Event Grid schema/ + ); + }); + }); + + describe("#deserializeCloudEvents", function() { + it("deserializes a single event", async () => { + const events = await consumer.deserializeCloudEvents( + testData.customTestEvent1.cloudEventSchema.encodedEvent + ); + + assert.lengthOf(events, 1); + assert.deepStrictEqual(events[0], testData.customTestEvent1.cloudEventSchema.expected); + }); + + it("deserialized a batch with a single event ", async () => { + const events = await consumer.deserializeCloudEvents( + wrapEncodedEventsInArray([testData.customTestEvent1.cloudEventSchema]) + ); + + assert.lengthOf(events, 1); + assert.deepStrictEqual(events[0], testData.customTestEvent1.cloudEventSchema.expected); + }); + + it("deserializes an batch of multiple events", async () => { + const events = await consumer.deserializeCloudEvents( + wrapEncodedEventsInArray([ + testData.customTestEvent1.cloudEventSchema, + testData.customTestEvent2.cloudEventSchema + ]) + ); + + assert.lengthOf(events, 2); + assert.deepStrictEqual(events[0], testData.customTestEvent1.cloudEventSchema.expected); + assert.deepStrictEqual(events[1], testData.customTestEvent2.cloudEventSchema.expected); + }); + + it("deserializes system events correctly", async () => { + const events = await consumer.deserializeCloudEvents( + testData.containerRegistryPushedEvent.cloudEventSchema.encodedEvent + ); + + assert.lengthOf(events, 1); + assert.deepStrictEqual( + events[0], + testData.containerRegistryPushedEvent.cloudEventSchema.expected + ); + }); + + it("fails when a required property is missing", () => { + const o = { ...testData.customTestEvent1.cloudEventSchema.expected }; + for (const property of ["type", "source", "id", "specversion"]) { + delete o[property]; + + assert.isRejected( + consumer.deserializeCloudEvents(JSON.stringify(o)), + /missing required property/ + ); + } + }); + + it("fails when spec version is wrong", () => { + const o = { ...testData.customTestEvent1.cloudEventSchema.expected }; + o.specversion = "2.0"; + + assert.isRejected( + consumer.deserializeCloudEvents(JSON.stringify(o)), + /event is not in the Cloud Event 1.0 schema/ + ); + }); + + it("decodes byte arrays for cloud events as expected", async () => { + const events = await consumer.deserializeCloudEvents({ + type: "Azure.Sdk.TestEvent", + id: "a-unique-id", + source: "/azure/sdk/test", + specversion: "1.0", + data_base64: "AAECAwQFBgcICQ==" /* Base 64 encoding of: 0x01 0x02 ... 0x09 */ + }); + + assert.strictEqual(events.length, 1); + + const data = events[0].data; + + assert.instanceOf(data, Uint8Array); + assert.strictEqual((data as Uint8Array).length, 10); + + for (let i = 0; i < 10; i++) { + assert.strictEqual((data as Uint8Array)[i], i); + } + + assert.isUndefined((data as any)["data_base64"]); + }); + }); +}); + +/** + * wrapEncodedEventsInArray takes the encoded events for a set of test cases and returns a string + * which is the JSON encoding of an array containing all the encoded events. + */ +function wrapEncodedEventsInArray(testCases: testData.TestCase[]): string { + const foo = []; + + for (const testCase of testCases) { + foo.push(JSON.parse(testCase.encodedEvent)); + } + + return JSON.stringify(foo); +} diff --git a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts new file mode 100644 index 000000000000..4960cc10be96 --- /dev/null +++ b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +/* eslint-disable no-invalid-this */ + +import { assert } from "chai"; + +import { Recorder } from "@azure/test-utils-recorder"; + +import { createRecordedClient, testEnv } from "./utils/recordedClient"; + +import { AzureKeyCredential, EventGridPublisherClient } from "../src/index"; + +import { + convertEventGridEventToModelType, + convertCloudEventToModelType +} from "../src/eventGridClient"; + +describe("EventGridPublisherClient", function() { + let recorder: Recorder; + let client: EventGridPublisherClient; + + this.timeout(10000); + + describe("#sendEvents", function() { + beforeEach(function() { + ({ client, recorder } = createRecordedClient( + this, + testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT, + new AzureKeyCredential(testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_API_KEY) + )); + }); + + afterEach(function() { + recorder.stop(); + }); + + it("sends a single event", async () => { + const res = await client.sendEvents([ + { + eventTime: recorder.newDate("singleEventDate"), + id: recorder.getUniqueName("singleEventId"), + eventType: "Azure.Sdk.TestEvent1", + subject: "Single 1", + dataVersion: "1.0", + data: { + hello: "world" + } + } + ]); + + assert.equal(res._response.status, 200); + }); + + it("sends multiple events", async () => { + const res = await client.sendEvents([ + { + eventTime: recorder.newDate("multiEventDate1"), + id: recorder.getUniqueName("multiEventId1"), + eventType: "Azure.Sdk.TestEvent1", + subject: "Multiple 1", + dataVersion: "1.0", + data: { + hello: "world" + } + }, + { + eventTime: recorder.newDate("multiEventDate2"), + id: recorder.getUniqueName("multiEventId2"), + eventType: "Azure.Sdk.TestEvent1", + subject: "Multiple 2", + dataVersion: "1.0", + data: { + hello: "world" + } + } + ]); + + assert.equal(res._response.status, 200); + }); + }); + + describe("#sendCloudEventSchemaEvents", function() { + beforeEach(function() { + ({ client, recorder } = createRecordedClient( + this, + testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT, + new AzureKeyCredential(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY) + )); + }); + + afterEach(function() { + recorder.stop(); + }); + + it("sends a single event", async () => { + const res = await client.sendCloudEvents([ + { + type: "Azure.Sdk.TestEvent1", + id: recorder.getUniqueName("cloudSingleEventId"), + time: recorder.newDate("cloudSingleEventDate"), + source: "/earth/unitedstates/washington/kirkland/finnhill", + data: { + hello: "world" + } + } + ]); + + assert.equal(res._response.status, 200); + }); + + it("sends multiple events", async () => { + const res = await client.sendCloudEvents([ + { + type: "Azure.Sdk.TestEvent1", + id: recorder.getUniqueName("cloudMultiEventId1"), + time: recorder.newDate("cloudMultiEventDate1"), + source: "/earth/unitedstates/washington/kirkland/finnhill", + subject: "Multiple 1", + data: { + hello: "world" + } + }, + { + type: "Azure.Sdk.TestEvent1", + id: recorder.getUniqueName("cloudMultiEventId2"), + time: recorder.newDate("cloudMultiEventDate2"), + source: "/earth/unitedstates/washington/kirkland/finnhill", + subject: "Multiple 2", + data: { + hello: "world" + } + } + ]); + + assert.equal(res._response.status, 200); + }); + }); + + describe("#sendCustomSchemaEvents", function() { + beforeEach(function() { + ({ client, recorder } = createRecordedClient( + this, + testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT, + new AzureKeyCredential(testEnv.EVENT_GRID_CUSTOM_SCHEMA_API_KEY) + )); + }); + + afterEach(function() { + recorder.stop(); + }); + + it("sends a single event", async () => { + const res = await client.sendCustomSchemaEvents([ + { + ver: "1.0", + typ: "Azure.Sdk.TestEvent1", + sub: "Single", + payload: { + hello: "world" + } + } + ]); + + assert.equal(res._response.status, 200); + }); + + it("sends multiple events", async () => { + const res = await client.sendCustomSchemaEvents([ + { + ver: "1.0", + typ: "Azure.Sdk.TestEvent1", + sub: "Multiple 1", + payload: { + hello: "world" + } + }, + { + ver: "1.0", + typ: "Azure.Sdk.TestEvent1", + sub: "Multiple 2", + payload: { + hello: "world" + } + } + ]); + + assert.equal(res._response.status, 200); + }); + }); +}); + +describe("convertEventGridEventToModelType", function() { + it("sets a default ID if one is not provided", () => { + const convertedEvent = convertEventGridEventToModelType({ + dataVersion: "1.0", + eventType: "Azure.Sdk.TestEvent", + subject: "Test Event", + data: { hello: "world " } + }); + + assert.isDefined(convertedEvent.id); + }); + + it("sets a default event time if one is not provided", () => { + const convertedEvent = convertEventGridEventToModelType({ + dataVersion: "1.0", + eventType: "Azure.Sdk.TestEvent", + subject: "Test Event", + data: { hello: "world " } + }); + + assert.isDefined(convertedEvent.eventTime); + }); + + it("does not change set values", () => { + const time = new Date(); + const id = "272871ba-2496-4750-9a90-bedd1ea10191"; + + const convertedEvent = convertEventGridEventToModelType({ + id: id, + eventTime: time, + dataVersion: "1.0", + eventType: "Azure.Sdk.TestEvent", + subject: "Test Event", + data: { hello: "world " } + }); + + assert.strictEqual(convertedEvent.id, id); + assert.strictEqual(convertedEvent.eventTime, time); + }); +}); + +describe("convertCloudEventToModelType", function() { + it("sets a default ID if one is not provided", () => { + const convertedEvent = convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent" + }); + + assert.isDefined(convertedEvent.id); + }); + + it("sets a default event time if one is not provided", () => { + const convertedEvent = convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent" + }); + + assert.isDefined(convertedEvent.time); + }); + + it("does not change set values", () => { + const time = new Date(); + const id = "272871ba-2496-4750-9a90-bedd1ea10191"; + + const convertedEvent = convertCloudEventToModelType({ + id: id, + time: time, + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent" + }); + + assert.strictEqual(convertedEvent.id, id); + assert.strictEqual(convertedEvent.time, time); + }); + + it("promotes extension attributes", () => { + const traceparent = "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"; + const tracestate = + "rojo=00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01,congo=lZWRzIHRoNhcm5hbCBwbGVhc3VyZS4"; + + const convertedEvent = convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent", + extensionAttributes: { + traceparent, + tracestate + } + }); + + // When converted to a model type to send over the wire, the extension attributes are promoted to be + // properties on the envelope itself. + assert.equal(convertedEvent["traceparent"], traceparent); + assert.equal(convertedEvent["tracestate"], tracestate); + }); + + it("base64 encodes binary data", () => { + const binaryData = new Uint8Array(10); + for (let i = 0; i < binaryData.length; i++) { + binaryData[i] = i; + } + + const convertedEvent = convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent", + data: binaryData, + datacontenttype: "application/binary" + }); + + assert.isUndefined(convertedEvent.data); + assert.strictEqual(convertedEvent.dataBase64, binaryData); + }); + + it("fails if data content type is missing for binary data", () => { + const binaryData = new Uint8Array(10); + for (let i = 0; i < binaryData.length; i++) { + binaryData[i] = i; + } + + assert.throws(() => { + convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent", + data: binaryData + }); + }, /data content type/); + }); + + it("fails if extenion attributes are invalid", () => { + const binaryData = new Uint8Array(10); + for (let i = 0; i < binaryData.length; i++) { + binaryData[i] = i; + } + + assert.throws(() => { + convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent", + extensionAttributes: { + source: "this-is-not-allowed" + } + }); + }, /invalid extension attribute name: source/); + + assert.throws(() => { + convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent", + extensionAttributes: { + MiXedCasE: "this-is-not-allowed" + } + }); + }, /invalid extension attribute name: MiXedCasE/); + + assert.throws(() => { + convertCloudEventToModelType({ + source: "/azure/sdk/tests", + type: "Azure.Sdk.TestEvent", + extensionAttributes: { + data_base64: "this-is-not-allowed" + } + }); + }, /invalid extension attribute name: data_base64/); + }); +}); diff --git a/sdk/eventgrid/eventgrid/test/generateSharedAccessSignature.spec.ts b/sdk/eventgrid/eventgrid/test/generateSharedAccessSignature.spec.ts new file mode 100644 index 000000000000..85821849fb6a --- /dev/null +++ b/sdk/eventgrid/eventgrid/test/generateSharedAccessSignature.spec.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { assert } from "chai"; +import { AzureKeyCredential, generateSharedAccessSignature } from "../src/index"; + +describe("generateSharedAccessSignature", function() { + it("generates the correct signiture", async () => { + // This is not a real key, it's the base64 encoding of "this is not a real EventGrid key", which happens to be the same + // number of bytes as an actual EventGrid Access Key. + const key = "dGhpcyBpcyBub3QgYSByZWFsIEV2ZW50R3JpZCBrZXk="; + const topicUrl = "https://eg-topic.westus-2.eventgrid.azure.net/api/events"; + + const sig = await generateSharedAccessSignature( + topicUrl, + new AzureKeyCredential(key), + new Date(Date.UTC(2020, 0, 1, 0, 0, 0)) + ); + + assert.equal( + sig, + "r=https%3A%2F%2Feg-topic.westus-2.eventgrid.azure.net%2Fapi%2Fevents%3FapiVersion%3D2018-01-01&e=1%2F1%2F2020%2012%3A00%3A00%20AM&s=ZzvNAYRyvJwDrOJKYxbNAPNCoSqgOJVLFi4IMXOrW2Q%3D" + ); + }); +}); diff --git a/sdk/eventgrid/eventgrid/test/util.spec.ts b/sdk/eventgrid/eventgrid/test/util.spec.ts new file mode 100644 index 000000000000..fe0605149c86 --- /dev/null +++ b/sdk/eventgrid/eventgrid/test/util.spec.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { assert } from "chai"; + +import { dateToServiceTimeString } from "../src/util"; + +describe("util", function() { + describe("dateToServiceTimeString", () => { + it("converts dates correctly", () => { + const simpleMorningDate = new Date(Date.UTC(2020, 0, 2, 3, 4, 5)); + assert.equal(dateToServiceTimeString(simpleMorningDate), "1/2/2020 3:04:05 AM"); + + const simpleAfternoonDate = new Date(Date.UTC(2020, 0, 2, 13, 10, 21)); + assert.equal(dateToServiceTimeString(simpleAfternoonDate), "1/2/2020 1:10:21 PM"); + + const slightlyAfterMidnight = new Date(Date.UTC(2020, 0, 2, 0, 10, 21)); + assert.equal(dateToServiceTimeString(slightlyAfterMidnight), "1/2/2020 12:10:21 AM"); + }); + }); +}); diff --git a/sdk/eventgrid/eventgrid/test/utils/recordedClient.ts b/sdk/eventgrid/eventgrid/test/utils/recordedClient.ts new file mode 100644 index 000000000000..648f93134e7a --- /dev/null +++ b/sdk/eventgrid/eventgrid/test/utils/recordedClient.ts @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Context } from "mocha"; +import * as dotenv from "dotenv"; + +import { env, Recorder, record, RecorderEnvironmentSetup } from "@azure/test-utils-recorder"; +import { isNode } from "@azure/core-http"; + +import { EventGridPublisherClient } from "../../src/index"; +import { KeyCredential } from "@azure/core-auth"; + +if (isNode) { + dotenv.config(); +} + +export interface RecordedClient { + client: EventGridPublisherClient; + recorder: Recorder; +} + +const replaceableVariables: { [k: string]: string } = { + EVENT_GRID_EVENT_GRID_SCHEMA_API_KEY: "api_key", + EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT: "https://endpoint/api/events", + EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY: "api_key", + EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT: "https://endpoint/api/events", + EVENT_GRID_CUSTOM_SCHEMA_API_KEY: "api_key", + EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT: "https://endpoint/api/events" +}; + +export const testEnv = new Proxy(replaceableVariables, { + get: (target, key: string) => { + return env[key] || target[key]; + } +}); + +export const environmentSetup: RecorderEnvironmentSetup = { + replaceableVariables, + customizationsOnRecordings: [ + (recording: string): string => + recording.replace(/"aeg-sas-key"\s?:\s?"[^"]*"/g, `"aeg-sas-key":"aeg-sas-key"`), + (recording: string): string => + recording.replace(/"aeg-sas-token"\s?:\s?"[^"]*"/g, `"aeg-sas-token":"aeg-sas-token"`), + // If we put EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT (or similar) in replaceableVariables above, + // it will not capture the endpoint string used with nock, which will be expanded to + // https://:443/ and therefore will not match, so we have to do + // this instead. + (recording: string): string => { + const replaced = recording.replace("endpoint:443", "endpoint"); + return replaced; + } + ], + queryParametersToSkip: [] +}; + +export function createRecordedClient( + context: Context, + endpoint: string, + credential: KeyCredential +): RecordedClient { + const recorder = record(context, environmentSetup); + + return { + client: new EventGridPublisherClient(endpoint, credential), + recorder + }; +} diff --git a/sdk/eventgrid/eventgrid/test/utils/testData.ts b/sdk/eventgrid/eventgrid/test/utils/testData.ts new file mode 100644 index 000000000000..be1727120376 --- /dev/null +++ b/sdk/eventgrid/eventgrid/test/utils/testData.ts @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export class TestCase { + public expected: any; + public encodedEvent: string; + + constructor(expected: any, encodedEvent?: string) { + this.expected = expected; + this.encodedEvent = encodedEvent ?? JSON.stringify(expected); + } +} + +export interface TestEventInfo { + /** + * A test case of an event in the Event Grid Schema + */ + eventGridSchema: TestCase; + /** + * A test case of an event in the Cloud Event Schema. + */ + cloudEventSchema: TestCase; +} + +export const customTestEvent1: TestEventInfo = { + eventGridSchema: new TestCase({ + id: "5bc888aa-c2f4-11ea-b3de-0242ac130004", + subject: "", + data: { + hello: "world" + }, + eventType: "Azure.Sdk.TestEvent1", + dataVersion: "1.0", + metadataVersion: "1", + eventTime: new Date("2020-07-10T21:27:12.925Z"), + topic: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.EventGrid/topics/matell-eg-topic" + }), + cloudEventSchema: new TestCase({ + id: "5bc888aa-c2f4-11ea-b3de-0242ac130004", + source: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.EventGrid/topics/matell-eg-topic", + specversion: "1.0", + type: "Azure.Sdk.TestEvent1", + subject: "", + time: new Date("2020-07-10T21:27:12.925Z"), + data: { + hello: "world" + } + }) +}; + +export const customTestEvent2: TestEventInfo = { + eventGridSchema: new TestCase({ + id: "ddf773ae-c2f4-11ea-b3de-0242ac130004", + subject: "", + data: { + goodbye: "everyone" + }, + eventType: "Azure.Sdk.TestEvent2", + dataVersion: "1.0", + metadataVersion: "1", + eventTime: new Date("2020-07-10T21:27:12.925Z"), + topic: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.EventGrid/topics/matell-eg-topic" + }), + cloudEventSchema: new TestCase({ + id: "ddf773ae-c2f4-11ea-b3de-0242ac130004", + source: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.EventGrid/topics/matell-eg-topic", + specversion: "1.0", + type: "Azure.Sdk.TestEvent2", + subject: "", + time: new Date("2020-07-10T21:27:12.925Z"), + data: { + goodbye: "everyone" + } + }) +}; + +// As of 2020-07-10, the Container Registry service is delivering the `data` object as string instead of a JSON object. This disagrees with +// the documented shape of the event. Our parsers have a special case to deal with this, for these events. +export const containerRegistryPushedEvent: TestEventInfo = { + eventGridSchema: new TestCase( + { + id: "b734f818-f923-472b-aec8-50995013fd7c", + topic: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.ContainerRegistry/registries/matellcr", + subject: "ubuntu:18.04", + eventType: "Microsoft.ContainerRegistry.ImagePushed", + data: { + id: "b734f818-f923-472b-aec8-50995013fd7c", + timestamp: new Date("2020-07-09T00:29:38.143428094Z"), + action: "push", + target: { + mediaType: "application/vnd.docker.distribution.manifest.v2+json", + size: 1152, + digest: "sha256:3013b0d761d4bad6ff16dd2805887a2f2c3fc140d6206086698b5c3e44e0f7fe", + length: 1152, + repository: "ubuntu", + tag: "18.04" + }, + request: { + id: "6d472f8e-8366-408a-a248-fb76348c91a0", + host: "matellcr.azurecr.io", + method: "PUT", + useragent: + "docker/19.03.8 go/go1.12.17 git-commit/afacb8b kernel/4.19.104-microsoft-standard os/linux arch/amd64 UpstreamClient(Docker-Client/19.03.8 \\(windows\\))" + } + }, + dataVersion: "1.0", + metadataVersion: "1", + eventTime: new Date("2020-07-09T00:29:38.3640826Z") + }, + JSON.stringify({ + id: "b734f818-f923-472b-aec8-50995013fd7c", + topic: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.ContainerRegistry/registries/matellcr", + subject: "ubuntu:18.04", + eventType: "Microsoft.ContainerRegistry.ImagePushed", + data: + '{"id":"b734f818-f923-472b-aec8-50995013fd7c","timestamp":"2020-07-09T00:29:38.143428094Z","action":"push","target":{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","size":1152,"digest":"sha256:3013b0d761d4bad6ff16dd2805887a2f2c3fc140d6206086698b5c3e44e0f7fe","length":1152,"repository":"ubuntu","tag":"18.04"},"request":{"id":"6d472f8e-8366-408a-a248-fb76348c91a0","host":"matellcr.azurecr.io","method":"PUT","useragent":"docker/19.03.8 go/go1.12.17 git-commit/afacb8b kernel/4.19.104-microsoft-standard os/linux arch/amd64 UpstreamClient(Docker-Client/19.03.8 \\\\(windows\\\\))"}}', + dataVersion: "1.0", + metadataVersion: "1", + eventTime: "2020-07-09T00:29:38.3640826Z" + }) + ), + cloudEventSchema: new TestCase( + { + id: "2092c215-d22b-4116-8e56-42dfa856d711", + source: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.ContainerRegistry/registries/matellcr", + specversion: "1.0", + type: "Microsoft.ContainerRegistry.ImagePushed", + dataschema: "#1.0", + subject: "alpine:latest", + time: new Date("2020-07-10T20:30:31.3653996Z"), + data: { + id: "2092c215-d22b-4116-8e56-42dfa856d711", + timestamp: new Date("2020-07-10T20:30:30.956083501Z"), + action: "push", + target: { + mediaType: "application/vnd.docker.distribution.manifest.v2+json", + size: 528, + digest: "sha256:a15790640a6690aa1730c38cf0a440e2aa44aaca9b0e8931a9f2b0d7cc90fd65", + length: 528, + repository: "alpine", + tag: "latest" + }, + request: { + id: "1dd0b459-1fc7-43aa-a1a1-c820e996699f", + host: "matellcr.azurecr.io", + method: "PUT", + useragent: + "docker/19.03.8 go/go1.12.17 git-commit/afacb8b kernel/4.19.104-microsoft-standard os/linux arch/amd64 UpstreamClient(Docker-Client/19.03.8 \\(linux\\))" + } + } + }, + JSON.stringify({ + id: "2092c215-d22b-4116-8e56-42dfa856d711", + source: + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/matell-rg/providers/Microsoft.ContainerRegistry/registries/matellcr", + specversion: "1.0", + type: "Microsoft.ContainerRegistry.ImagePushed", + dataschema: "#1.0", + subject: "alpine:latest", + time: "2020-07-10T20:30:31.3653996Z", + data: + '{"id":"2092c215-d22b-4116-8e56-42dfa856d711","timestamp":"2020-07-10T20:30:30.956083501Z","action":"push","target":{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","size":528,"digest":"sha256:a15790640a6690aa1730c38cf0a440e2aa44aaca9b0e8931a9f2b0d7cc90fd65","length":528,"repository":"alpine","tag":"latest"},"request":{"id":"1dd0b459-1fc7-43aa-a1a1-c820e996699f","host":"matellcr.azurecr.io","method":"PUT","useragent":"docker/19.03.8 go/go1.12.17 git-commit/afacb8b kernel/4.19.104-microsoft-standard os/linux arch/amd64 UpstreamClient(Docker-Client/19.03.8 \\\\(linux\\\\))"}}' + }) + ) +}; diff --git a/sdk/eventgrid/eventgrid/tests.yml b/sdk/eventgrid/eventgrid/tests.yml new file mode 100644 index 000000000000..8b419fc54cb0 --- /dev/null +++ b/sdk/eventgrid/eventgrid/tests.yml @@ -0,0 +1,19 @@ +trigger: none +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + - repository: azure-sdk-tools + type: github + name: Azure/azure-sdk-tools + endpoint: azure +jobs: + - template: ../../../eng/pipelines/templates/jobs/archetype-sdk-integration.yml + parameters: + PackageName: "@azure/eventgrid" + ResourceServiceDirectory: eventgrid + EnvVars: + AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) + AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) diff --git a/sdk/eventgrid/eventgrid/tsconfig.json b/sdk/eventgrid/eventgrid/tsconfig.json index 422b584abd5e..9784ff1f1ed3 100644 --- a/sdk/eventgrid/eventgrid/tsconfig.json +++ b/sdk/eventgrid/eventgrid/tsconfig.json @@ -1,19 +1,17 @@ { + "extends": "../../../tsconfig.package", "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es5", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], - "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "declarationDir": "./types" }, - "include": ["./src/**/*.ts"], - "exclude": ["node_modules"] + "exclude": [ + "node_modules", + "types", + "temp", + "browser", + "dist", + "dist-samples", + "dist-esm", + "./samples/**/*.ts" + ] }