@azure/eventgrid 5.11.1-alpha.20250403.1 → 5.11.1-alpha.20250407.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -143,37 +143,36 @@ Event Grid supports multiple schemas for encoding events. When a Custom Topic or
|
|
143
143
|
If your topic is configured to use the Event Grid Schema, set "EventGrid" as the schema type:
|
144
144
|
|
145
145
|
```ts snippet:ReadmeSampleCreateClient_EventGrid
|
146
|
-
import { EventGridPublisherClient
|
146
|
+
import { EventGridPublisherClient } from "@azure/eventgrid";
|
147
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
147
148
|
|
148
149
|
const client = new EventGridPublisherClient(
|
149
150
|
"<endpoint>",
|
150
151
|
"EventGrid",
|
151
|
-
new
|
152
|
+
new DefaultAzureCredential(),
|
152
153
|
);
|
153
154
|
```
|
154
155
|
|
155
156
|
If your topic is configured to use the Cloud Event Schema, set "CloudEvent" as the schema type:
|
156
157
|
|
157
158
|
```ts snippet:ReadmeSampleCreateClient_CloudEvent
|
158
|
-
import { EventGridPublisherClient
|
159
|
+
import { EventGridPublisherClient } from "@azure/eventgrid";
|
160
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
159
161
|
|
160
162
|
const client = new EventGridPublisherClient(
|
161
163
|
"<endpoint>",
|
162
164
|
"CloudEvent",
|
163
|
-
new
|
165
|
+
new DefaultAzureCredential(),
|
164
166
|
);
|
165
167
|
```
|
166
168
|
|
167
169
|
If your topic is configured to use a Custom Event Schema, set "Custom" as the schema type:
|
168
170
|
|
169
171
|
```ts snippet:ReadmeSampleCreateClient_Custom
|
170
|
-
import { EventGridPublisherClient
|
172
|
+
import { EventGridPublisherClient } from "@azure/eventgrid";
|
173
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
171
174
|
|
172
|
-
const client = new EventGridPublisherClient(
|
173
|
-
"<endpoint>",
|
174
|
-
"Custom",
|
175
|
-
new AzureKeyCredential("<API Key>"),
|
176
|
-
);
|
175
|
+
const client = new EventGridPublisherClient("<endpoint>", "Custom", new DefaultAzureCredential());
|
177
176
|
```
|
178
177
|
|
179
178
|
Constructing the client with a different schema than what the topic is configured to expect will result in an error from the service and your events will not be published.
|
@@ -210,12 +209,13 @@ This library has been tested and validated on [Kubernetes using Azure Arc][event
|
|
210
209
|
### Publish a Custom Event to an Event Grid Topic using the Event Grid Schema
|
211
210
|
|
212
211
|
```ts snippet:ReadmeSample_PublishCustomEvent
|
213
|
-
import { EventGridPublisherClient
|
212
|
+
import { EventGridPublisherClient } from "@azure/eventgrid";
|
213
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
214
214
|
|
215
215
|
const client = new EventGridPublisherClient(
|
216
216
|
"<endpoint>",
|
217
217
|
"EventGrid",
|
218
|
-
new
|
218
|
+
new DefaultAzureCredential(),
|
219
219
|
);
|
220
220
|
|
221
221
|
await client.send([
|
@@ -235,12 +235,13 @@ await client.send([
|
|
235
235
|
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:
|
236
236
|
|
237
237
|
```ts snippet:ReadmeSample_PublishCustomEventToDomain
|
238
|
-
import { EventGridPublisherClient
|
238
|
+
import { EventGridPublisherClient } from "@azure/eventgrid";
|
239
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
239
240
|
|
240
241
|
const client = new EventGridPublisherClient(
|
241
242
|
"<endpoint>",
|
242
243
|
"EventGrid",
|
243
|
-
new
|
244
|
+
new DefaultAzureCredential(),
|
244
245
|
);
|
245
246
|
|
246
247
|
await client.send([
|
package/package.json
CHANGED