Skapa eller uppdatera en händelseprenumeration.
Asynkront skapar en ny händelseprenumeration eller uppdaterar en befintlig händelseprenumeration baserat på det angivna omfånget.
PUT https://management.azure.com/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}?api-version=2022-06-15
URI-parametrar
Name |
I |
Obligatorisk |
Typ |
Description |
eventSubscriptionName
|
path |
True
|
string
|
Namn på händelseprenumerationen. Namn på händelseprenumerationer måste vara mellan 3 och 64 tecken långa och ska endast använda alfanumeriska bokstäver.
|
scope
|
path |
True
|
string
|
Identifieraren för den resurs som händelseprenumerationen måste skapas eller uppdateras till. Omfånget kan vara en prenumeration, en resursgrupp eller en resurs på den översta nivån som tillhör ett namnområde för resursprovidern eller ett EventGrid-ämne. Använd till exempel '/subscriptions/{subscriptionId}/' för en prenumeration, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' för en resursgrupp. och "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" för en resurs och "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}" för ett EventGrid-ämne.
|
api-version
|
query |
True
|
string
|
Version av API:et som ska användas med klientbegäran.
|
Begärandetext
Name |
Typ |
Description |
properties.deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Målet för händelseprenumerationen. Alla händelser som inte kan levereras till målet skickas till målet med obeställbara meddelanden.
Använder Azure Event Grid identitet för att hämta de autentiseringstoken som används vid leverans/obeställbara meddelanden.
|
properties.deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
Målet för händelseprenumerationen. Alla händelser som inte kan levereras till målet skickas till målet med obeställbara meddelanden.
Använder konfigurationen av den hanterade identiteten på den överordnade resursen (dvs. ämne eller domän) för att hämta de autentiseringstoken som används under leverans/obeställbara meddelanden.
|
properties.deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
Information om målet där händelser måste levereras för händelseprenumerationen.
Använder konfigurationen för hanterad identitet på den överordnade resursen (dvs. ämne eller domän) för att hämta de autentiseringstoken som används under leverans/obeställbara bokstäver.
|
properties.destination
|
EventSubscriptionDestination:
|
Information om målet där händelser måste levereras för händelseprenumerationen.
Använder Azure Event Grid identitet för att hämta de autentiseringstoken som används under leverans/obeställbara bokstäver.
|
properties.eventDeliverySchema
|
EventDeliverySchema
|
Händelseleveransschemat för händelseprenumerationen.
|
properties.expirationTimeUtc
|
string
|
Förfallotid för händelseprenumerationen.
|
properties.filter
|
EventSubscriptionFilter
|
Information om filtret för händelseprenumerationen.
|
properties.labels
|
string[]
|
Lista över användardefinierade etiketter.
|
properties.retryPolicy
|
RetryPolicy
|
Återförsöksprincipen för händelser. Detta kan användas för att konfigurera maximalt antal leveransförsök och tid att leva för händelser.
|
Svar
Name |
Typ |
Description |
201 Created
|
EventSubscription
|
EventSubscription CreateOrUpdate-begäran accepterad.
|
Other Status Codes
|
|
Felsvar: ***
400 Felaktig begäran.
500 Internt serverfel.
|
Exempel
EventSubscriptions_CreateOrUpdateForCustomTopic
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventHubEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopic(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new EventHubEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false)),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopic() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
Destination: &armeventgrid.EventHubEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub),
Properties: &armeventgrid.EventHubEventSubscriptionDestinationProperties{
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopic() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
destination: {
endpointType: "EventHub",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new EventHubEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic1"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "AzureFunction",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.AzureFunctionEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopicAzureFunctionDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new AzureFunctionEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false))
.withDeadLetterDestination(
new StorageBlobDeadLetterDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withBlobContainerName("contosocontainer")),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"blobContainerName": "contosocontainer",
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"destination": {
"endpointType": "AzureFunction",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicAzureFunctionDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{
EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob),
Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{
BlobContainerName: to.Ptr("contosocontainer"),
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
},
},
Destination: &armeventgrid.AzureFunctionEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeAzureFunction),
Properties: &armeventgrid.AzureFunctionEventSubscriptionDestinationProperties{
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopicAzureFunctionDestination() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
deadLetterDestination: {
blobContainerName: "contosocontainer",
endpointType: "StorageBlob",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
destination: {
endpointType: "AzureFunction",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new AzureFunctionEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
DeadLetterDestination = new StorageBlobDeadLetterDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
BlobContainerName = "contosocontainer",
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"
},
"endpointType": "AzureFunction"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"provisioningState": "Creating",
"labels": null,
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventHubEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopicEventHubDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new EventHubEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false))
.withDeadLetterDestination(
new StorageBlobDeadLetterDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withBlobContainerName("contosocontainer")),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"blobContainerName": "contosocontainer",
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicEventHubDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{
EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob),
Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{
BlobContainerName: to.Ptr("contosocontainer"),
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
},
},
Destination: &armeventgrid.EventHubEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub),
Properties: &armeventgrid.EventHubEventSubscriptionDestinationProperties{
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopicEventHubDestination() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
deadLetterDestination: {
blobContainerName: "contosocontainer",
endpointType: "StorageBlob",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
destination: {
endpointType: "EventHub",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new EventHubEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
DeadLetterDestination = new StorageBlobDeadLetterDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
BlobContainerName = "contosocontainer",
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
},
"endpointType": "EventHub"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"provisioningState": "Creating",
"labels": null,
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "HybridConnection",
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.HybridConnectionEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopicHybridConnectionDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new HybridConnectionEventSubscriptionDestination()
.withResourceId(
"/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false))
.withDeadLetterDestination(
new StorageBlobDeadLetterDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withBlobContainerName("contosocontainer")),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"blobContainerName": "contosocontainer",
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"destination": {
"endpointType": "HybridConnection",
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicHybridConnectionDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{
EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob),
Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{
BlobContainerName: to.Ptr("contosocontainer"),
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
},
},
Destination: &armeventgrid.HybridConnectionEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeHybridConnection),
Properties: &armeventgrid.HybridConnectionEventSubscriptionDestinationProperties{
ResourceID: to.Ptr("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopicHybridConnectionDestination() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
deadLetterDestination: {
blobContainerName: "contosocontainer",
endpointType: "StorageBlob",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
destination: {
endpointType: "HybridConnection",
resourceId:
"/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new HybridConnectionEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
DeadLetterDestination = new StorageBlobDeadLetterDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
BlobContainerName = "contosocontainer",
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"
},
"endpointType": "HybridConnection"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"provisioningState": "Creating",
"labels": null,
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "ServiceBusQueue",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.ServiceBusQueueEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusQueueDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new ServiceBusQueueEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false))
.withDeadLetterDestination(
new StorageBlobDeadLetterDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withBlobContainerName("contosocontainer")),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"blobContainerName": "contosocontainer",
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"destination": {
"endpointType": "ServiceBusQueue",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusQueueDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{
EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob),
Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{
BlobContainerName: to.Ptr("contosocontainer"),
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
},
},
Destination: &armeventgrid.ServiceBusQueueEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusQueue),
Properties: &armeventgrid.ServiceBusQueueEventSubscriptionDestinationProperties{
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusQueueDestination() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
deadLetterDestination: {
blobContainerName: "contosocontainer",
endpointType: "StorageBlob",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
destination: {
endpointType: "ServiceBusQueue",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new ServiceBusQueueEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
DeadLetterDestination = new StorageBlobDeadLetterDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
BlobContainerName = "contosocontainer",
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"
},
"endpointType": "ServiceBusQueue"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"provisioningState": "Creating",
"labels": null,
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "ServiceBusTopic",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.ServiceBusTopicEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusTopicDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new ServiceBusTopicEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false))
.withDeadLetterDestination(
new StorageBlobDeadLetterDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withBlobContainerName("contosocontainer")),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"blobContainerName": "contosocontainer",
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"destination": {
"endpointType": "ServiceBusTopic",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusTopicDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{
EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob),
Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{
BlobContainerName: to.Ptr("contosocontainer"),
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
},
},
Destination: &armeventgrid.ServiceBusTopicEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusTopic),
Properties: &armeventgrid.ServiceBusTopicEventSubscriptionDestinationProperties{
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusTopicDestination() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
deadLetterDestination: {
blobContainerName: "contosocontainer",
endpointType: "StorageBlob",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
destination: {
endpointType: "ServiceBusTopic",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new ServiceBusTopicEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
DeadLetterDestination = new StorageBlobDeadLetterDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
BlobContainerName = "contosocontainer",
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"
},
"endpointType": "ServiceBusTopic"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"provisioningState": "Creating",
"labels": null,
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "StorageQueue",
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"queueName": "queue1"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
import com.azure.resourcemanager.eventgrid.models.StorageQueueEventSubscriptionDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopicStorageQueueDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new StorageQueueEventSubscriptionDestination()
.withResourceId(
"/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withQueueName("queue1"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false))
.withDeadLetterDestination(
new StorageBlobDeadLetterDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withBlobContainerName("contosocontainer")),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"blobContainerName": "contosocontainer",
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"destination": {
"endpointType": "StorageQueue",
"properties": {
"queueName": "queue1",
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicStorageQueueDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{
EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob),
Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{
BlobContainerName: to.Ptr("contosocontainer"),
ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
},
},
Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue),
Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{
QueueName: to.Ptr("queue1"),
ResourceID: to.Ptr("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopicStorageQueueDestination() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
deadLetterDestination: {
blobContainerName: "contosocontainer",
endpointType: "StorageBlob",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
destination: {
endpointType: "StorageQueue",
queueName: "queue1",
resourceId:
"/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new StorageQueueEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
QueueName = "queue1",
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
DeadLetterDestination = new StorageBlobDeadLetterDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
BlobContainerName = "contosocontainer",
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"queueName": "queue1"
},
"endpointType": "StorageQueue"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"provisioningState": "Creating",
"labels": null,
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"blobContainerName": "contosocontainer"
}
}
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForCustomTopicWebhookDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionInner()
.withDestination(
new WebhookEventSubscriptionDestination()
.withEndpointUrl(
"https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false)),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_info={
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE"
},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicWebhookDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json
*/
async function eventSubscriptionsCreateOrUpdateForCustomTopicWebhookDestination() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionInfo = {
destination: {
endpointType: "WebHook",
endpointUrl:
"https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription1";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic1"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForResource
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://requestb.in/15ksip71"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResource.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForResource.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForResource(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1",
"examplesubscription10",
new EventSubscriptionInner()
.withDestination(
new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false)),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_resource.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1",
event_subscription_name="examplesubscription10",
event_subscription_info={
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {"endpointUrl": "https://requestb.in/15ksip71"},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResource.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResource.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForResource() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription10", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://requestb.in/15ksip71"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResource.json
*/
async function eventSubscriptionsCreateOrUpdateForResource() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope =
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1";
const eventSubscriptionName = "examplesubscription10";
const eventSubscriptionInfo = {
destination: {
endpointType: "WebHook",
endpointUrl: "https://requestb.in/15ksip71",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResource.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription10";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://requestb.in/15ksip71"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10",
"name": "examplesubscription10",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForResourceGroup
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://requestb.in/15ksip71"
}
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForResourceGroup.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForResourceGroup(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg",
"examplesubscription2",
new EventSubscriptionInner()
.withDestination(
new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("ExamplePrefix")
.withSubjectEndsWith("ExampleSuffix")
.withIsSubjectCaseSensitive(false)),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_resource_group.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg",
event_subscription_name="examplesubscription2",
event_subscription_info={
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {"endpointUrl": "https://requestb.in/15ksip71"},
},
"filter": {
"isSubjectCaseSensitive": False,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix",
},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForResourceGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://requestb.in/15ksip71"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
SubjectBeginsWith: to.Ptr("ExamplePrefix"),
SubjectEndsWith: to.Ptr("ExampleSuffix"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json
*/
async function eventSubscriptionsCreateOrUpdateForResourceGroup() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg";
const eventSubscriptionName = "examplesubscription2";
const eventSubscriptionInfo = {
destination: {
endpointType: "WebHook",
endpointUrl: "https://requestb.in/15ksip71",
},
filter: {
isSubjectCaseSensitive: false,
subjectBeginsWith: "ExamplePrefix",
subjectEndsWith: "ExampleSuffix",
},
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription2";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://requestb.in/15ksip71"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "ExamplePrefix",
SubjectEndsWith = "ExampleSuffix",
IsSubjectCaseSensitive = false,
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "ExamplePrefix",
"subjectEndsWith": "ExampleSuffix"
},
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2",
"name": "examplesubscription2",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_CreateOrUpdateForSubscription
Exempelbegäran
PUT https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3?api-version=2022-06-15
{
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://requestb.in/15ksip71"
}
},
"filter": {
"isSubjectCaseSensitive": false
}
}
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.fluent.models.EventSubscriptionInner;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
/** Samples for EventSubscriptions CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForSubscription.json
*/
/**
* Sample code: EventSubscriptions_CreateOrUpdateForSubscription.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsCreateOrUpdateForSubscription(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.createOrUpdate(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4",
"examplesubscription3",
new EventSubscriptionInner()
.withDestination(
new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71"))
.withFilter(new EventSubscriptionFilter().withIsSubjectCaseSensitive(false)),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python event_subscriptions_create_or_update_for_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.event_subscriptions.begin_create_or_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4",
event_subscription_name="examplesubscription3",
event_subscription_info={
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {"endpointUrl": "https://requestb.in/15ksip71"},
},
"filter": {"isSubjectCaseSensitive": False},
}
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForSubscription.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armeventgrid_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForSubscription.json
func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armeventgrid.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "examplesubscription3", armeventgrid.EventSubscription{
Properties: &armeventgrid.EventSubscriptionProperties{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://requestb.in/15ksip71"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(false),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { EventGridManagementClient } = require("@azure/arm-eventgrid");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
*
* @summary Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForSubscription.json
*/
async function eventSubscriptionsCreateOrUpdateForSubscription() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4";
const eventSubscriptionName = "examplesubscription3";
const eventSubscriptionInfo = {
destination: {
endpointType: "WebHook",
endpointUrl: "https://requestb.in/15ksip71",
},
filter: { isSubjectCaseSensitive: false },
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginCreateOrUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionInfo
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.EventGrid;
using Azure.ResourceManager.EventGrid.Models;
// Generated from example definition: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForSubscription.json
// this example is just showing the usage of "EventSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ArmResource created on azure
// for more information of creating ArmResource, please refer to the document of ArmResource
// get the collection of this EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4";
ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope));
EventSubscriptionCollection collection = client.GetEventSubscriptions(scopeId);
// invoke the operation
string eventSubscriptionName = "examplesubscription3";
EventGridSubscriptionData data = new EventGridSubscriptionData()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://requestb.in/15ksip71"),
},
Filter = new EventSubscriptionFilter()
{
IsSubjectCaseSensitive = false,
},
};
ArmOperation<EventSubscriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data);
EventSubscriptionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventGridSubscriptionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": false,
"subjectBeginsWith": "",
"subjectEndsWith": ""
},
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3",
"name": "examplesubscription3",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
Definitioner
AzureFunctionEventSubscriptionDestination
Information om azure-funktionsmålet för en händelseprenumeration.
Name |
Typ |
Standardvärde |
Description |
endpointType
|
string:
AzureFunction
|
|
Typ av slutpunkt för händelseprenumerationsmålet.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
|
Information om leveransattribut.
|
properties.maxEventsPerBatch
|
integer
|
1
|
Maximalt antal händelser per batch.
|
properties.preferredBatchSizeInKilobytes
|
integer
|
64
|
Önskad batchstorlek i Kilobyte.
|
properties.resourceId
|
string
|
|
Det Azure-resurs-ID som representerar slutpunkten för Azure Function-målet för en händelseprenumeration.
|
BoolEqualsAdvancedFilter
BoolEquals Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
BoolEquals
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
value
|
boolean
|
Det booleska filtervärdet.
|
createdByType
Den typ av identitet som skapade resursen.
Name |
Typ |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
DeadLetterWithResourceIdentity
Information om deadletter-målet med resursidentitet.
Name |
Typ |
Description |
deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Information om målet där händelser måste levereras för händelseprenumerationen.
Använder konfigurationen av den hanterade identiteten på den överordnade resursen (dvs. ämne eller domän) för att hämta de autentiseringstoken som används under leverans/obeställbara meddelanden.
|
identity
|
EventSubscriptionIdentity
|
Identiteten som ska användas vid händelser med obeställbara bokstäver.
|
DeliveryWithResourceIdentity
Information om leveransen för en händelseprenumeration med resursidentitet.
Name |
Typ |
Description |
destination
|
EventSubscriptionDestination:
|
Information om målet där händelser måste levereras för händelseprenumerationen.
Använder Azure Event Grid identitet för att hämta de autentiseringstoken som används vid leverans/obeställbara meddelanden.
|
identity
|
EventSubscriptionIdentity
|
Identiteten som ska användas vid leverans av händelser.
|
DynamicDeliveryAttributeMapping
Information om mappning av dynamiska leveransattribut.
Name |
Typ |
Description |
name
|
string
|
Namnet på leveransattributet eller huvudet.
|
properties.sourceField
|
string
|
JSON-sökväg i händelsen som innehåller attributvärde.
|
type
|
string:
Dynamic
|
Typ av leveransattribut eller rubriknamn.
|
EventDeliverySchema
Händelseleveransschemat för händelseprenumerationen.
Name |
Typ |
Description |
CloudEventSchemaV1_0
|
string
|
|
CustomInputSchema
|
string
|
|
EventGridSchema
|
string
|
|
EventHubEventSubscriptionDestination
Information om händelsehubbens mål för en händelseprenumeration.
Name |
Typ |
Description |
endpointType
|
string:
EventHub
|
Typ av slutpunkt för händelseprenumerationsmålet.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Information om leveransattribut.
|
properties.resourceId
|
string
|
Det Azure-resurs-ID som representerar slutpunkten för en händelsehubbmål för en händelseprenumeration.
|
EventSubscription
Händelseprenumeration
Name |
Typ |
Standardvärde |
Description |
id
|
string
|
|
Fullständigt kvalificerad identifierare för resursen.
|
name
|
string
|
|
Namn på resursen.
|
properties.deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
|
Målet för händelseprenumerationen. Alla händelser som inte kan levereras till målet skickas till målet med obeställbara meddelanden.
Använder Azure Event Grid identitet för att hämta de autentiseringstoken som används vid leverans/obeställbara meddelanden.
|
properties.deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
|
Målet för händelseprenumerationen. Alla händelser som inte kan levereras till målet skickas till målet med obeställbara meddelanden.
Använder konfigurationen av den hanterade identiteten på den överordnade resursen (dvs. ämne eller domän) för att hämta de autentiseringstoken som används under leverans/obeställbara meddelanden.
|
properties.deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
|
Information om målet där händelser måste levereras för händelseprenumerationen.
Använder konfigurationen av den hanterade identiteten på den överordnade resursen (dvs. ämne eller domän) för att hämta de autentiseringstoken som används under leverans/obeställbara meddelanden.
|
properties.destination
|
EventSubscriptionDestination:
|
|
Information om målet där händelser måste levereras för händelseprenumerationen.
Använder Azure Event Grid identitet för att hämta de autentiseringstoken som används vid leverans/obeställbara meddelanden.
|
properties.eventDeliverySchema
|
EventDeliverySchema
|
EventGridSchema
|
Händelseprenumerationens schema för händelseleverans.
|
properties.expirationTimeUtc
|
string
|
|
Förfallotid för händelseprenumerationen.
|
properties.filter
|
EventSubscriptionFilter
|
|
Information om filtret för händelseprenumerationen.
|
properties.labels
|
string[]
|
|
Lista över användardefinierade etiketter.
|
properties.provisioningState
|
EventSubscriptionProvisioningState
|
|
Etableringstillstånd för händelseprenumerationen.
|
properties.retryPolicy
|
RetryPolicy
|
|
Återförsöksprincipen för händelser. Detta kan användas för att konfigurera maximalt antal leveransförsök och time to live för händelser.
|
properties.topic
|
string
|
|
Namn på ämnet för händelseprenumerationen.
|
systemData
|
systemData
|
|
Systemmetadata som relaterar till händelseprenumerationsresursen.
|
type
|
string
|
|
Typ av resurs.
|
EventSubscriptionFilter
Filtrera efter händelseprenumerationen.
Name |
Typ |
Standardvärde |
Description |
advancedFilters
|
AdvancedFilter[]:
|
|
En matris med avancerade filter som används för att filtrera händelseprenumerationer.
|
enableAdvancedFilteringOnArrays
|
boolean
|
|
Gör att avancerade filter kan utvärderas mot en matris med värden i stället för att förvänta sig ett singularvärde.
|
includedEventTypes
|
string[]
|
|
En lista över tillämpliga händelsetyper som måste ingå i händelseprenumerationen. Om du vill prenumerera på alla standardhändelsetyper anger du IncludedEventTypes till null.
|
isSubjectCaseSensitive
|
boolean
|
False
|
Anger om egenskaperna SubjectBeginsWith och SubjectEndsWith för filtret ska jämföras på ett skiftlägeskänsligt sätt.
|
subjectBeginsWith
|
string
|
|
En valfri sträng för att filtrera händelser för en händelseprenumeration baserat på ett resurssökvägsprefix.
Formatet för detta beror på utgivaren av händelserna.
Jokertecken stöds inte i den här sökvägen.
|
subjectEndsWith
|
string
|
|
En valfri sträng för att filtrera händelser för en händelseprenumeration baserat på ett resurssökvägssuffix.
Jokertecken stöds inte i den här sökvägen.
|
EventSubscriptionIdentity
Identitetsinformationen med händelseprenumerationen.
Name |
Typ |
Description |
type
|
EventSubscriptionIdentityType
|
Den typ av hanterad identitet som används. Typen "SystemAssigned, UserAssigned" innehåller både en implicit skapad identitet och en uppsättning användartilldelade identiteter. Typen "Ingen" tar bort alla identiteter.
|
userAssignedIdentity
|
string
|
Användaridentiteten som är associerad med resursen.
|
EventSubscriptionIdentityType
Den typ av hanterad identitet som används. Typen "SystemAssigned, UserAssigned" innehåller både en implicit skapad identitet och en uppsättning användartilldelade identiteter. Typen "Ingen" tar bort alla identiteter.
Name |
Typ |
Description |
SystemAssigned
|
string
|
|
UserAssigned
|
string
|
|
EventSubscriptionProvisioningState
Etableringstillstånd för händelseprenumerationen.
Name |
Typ |
Description |
AwaitingManualAction
|
string
|
|
Canceled
|
string
|
|
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
HybridConnectionEventSubscriptionDestination
Information om HybridConnection-målet för en händelseprenumeration.
Name |
Typ |
Description |
endpointType
|
string:
HybridConnection
|
Typ av slutpunkt för händelseprenumerationsmålet.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Information om leveransattribut.
|
properties.resourceId
|
string
|
Azure-resurs-ID för en hybridanslutning som är målet för en händelseprenumeration.
|
IsNotNullAdvancedFilter
IsNotNull Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
IsNotNull
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
IsNullOrUndefinedAdvancedFilter
IsNullOrUndefined Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
IsNullOrUndefined
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
NumberGreaterThanAdvancedFilter
NumberGreaterThan Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberGreaterThan
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
value
|
number
|
Filtervärdet.
|
NumberGreaterThanOrEqualsAdvancedFilter
NumberGreaterThanOrEquals Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberGreaterThanOrEquals
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
value
|
number
|
Filtervärdet.
|
NumberInAdvancedFilter
NumberIn Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberIn
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
number[]
|
Uppsättningen filtervärden.
|
NumberInRangeAdvancedFilter
NumberInRange Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberInRange
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
number[]
|
Uppsättningen filtervärden.
|
NumberLessThanAdvancedFilter
NumberLessThan Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberLessThan
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
value
|
number
|
Filtervärdet.
|
NumberLessThanOrEqualsAdvancedFilter
NumberLessThanOrEquals Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberLessThanOrEquals
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
value
|
number
|
Filtervärdet.
|
NumberNotInAdvancedFilter
NumberNotIn Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberNotIn
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
number[]
|
Uppsättningen filtervärden.
|
NumberNotInRangeAdvancedFilter
NumberNotInRange Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
NumberNotInRange
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
number[]
|
Uppsättningen filtervärden.
|
RetryPolicy
Information om återförsöksprincipen för en händelseprenumeration.
Name |
Typ |
Standardvärde |
Description |
eventTimeToLiveInMinutes
|
integer
|
1440
|
Time To Live (i minuter) för händelser.
|
maxDeliveryAttempts
|
integer
|
30
|
Maximalt antal återförsök av leverans för händelser.
|
ServiceBusQueueEventSubscriptionDestination
Information om Service Bus-målet för en händelseprenumeration.
Name |
Typ |
Description |
endpointType
|
string:
ServiceBusQueue
|
Typ av slutpunkt för händelseprenumerationsmålet.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Information om leveransattribut.
|
properties.resourceId
|
string
|
Det Azure-resurs-ID som representerar slutpunkten för Service Bus-målet för en händelseprenumeration.
|
ServiceBusTopicEventSubscriptionDestination
Information om service bus-ämnesmålet för en händelseprenumeration.
Name |
Typ |
Description |
endpointType
|
string:
ServiceBusTopic
|
Typ av slutpunkt för händelseprenumerationsmålet.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Information om leveransattribut.
|
properties.resourceId
|
string
|
Det Azure-resurs-ID som representerar slutpunkten för Service Bus-ämnesmålet för en händelseprenumeration.
|
StaticDeliveryAttributeMapping
Information om mappning av statiska leveransattribut.
Name |
Typ |
Standardvärde |
Description |
name
|
string
|
|
Namnet på leveransattributet eller huvudet.
|
properties.isSecret
|
boolean
|
False
|
Boolesk flagga för att se om attributet innehåller känslig information .
|
properties.value
|
string
|
|
Värdet för leveransattributet.
|
type
|
string:
Static
|
|
Typ av leveransattribut eller rubriknamn.
|
StorageBlobDeadLetterDestination
Information om lagringsblobbaserade mål för obeställbara meddelanden.
Name |
Typ |
Description |
endpointType
|
string:
StorageBlob
|
Typ av slutpunkt för mål för obeställbara meddelanden
|
properties.blobContainerName
|
string
|
Namnet på lagringsblobcontainern som är målet för deadletter-händelserna
|
properties.resourceId
|
string
|
Azure-resurs-ID för lagringskontot som är målet för deadletter-händelserna
|
StorageQueueEventSubscriptionDestination
Information om lagringskömålet för en händelseprenumeration.
Name |
Typ |
Description |
endpointType
|
string:
StorageQueue
|
Typ av slutpunkt för händelseprenumerationsmålet.
|
properties.queueMessageTimeToLiveInSeconds
|
integer
|
Lagringskömeddelandets time to live i sekunder.
|
properties.queueName
|
string
|
Namnet på lagringskö under ett lagringskonto som är målet för en händelseprenumeration.
|
properties.resourceId
|
string
|
Azure-resurs-ID för lagringskontot som innehåller kön som är målet för en händelseprenumeration.
|
StringBeginsWithAdvancedFilter
StringBeginsWith Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringBeginsWith
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
StringContainsAdvancedFilter
StringContains Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringContains
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
StringEndsWithAdvancedFilter
StringEndsWith Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringEndsWith
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
StringInAdvancedFilter
StringIn Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringIn
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
StringNotBeginsWithAdvancedFilter
StringNotBeginsWith Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringNotBeginsWith
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
StringNotContainsAdvancedFilter
StringNotContains Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringNotContains
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
StringNotEndsWithAdvancedFilter
StringNotEndsWith Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringNotEndsWith
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
StringNotInAdvancedFilter
StringNotIn Avancerat filter.
Name |
Typ |
Description |
key
|
string
|
Fältet/egenskapen i händelsen baserat på vilken du vill filtrera.
|
operatorType
|
string:
StringNotIn
|
Operatortypen som används för filtrering, t.ex. NumberIn, StringContains, BoolEquals och andra.
|
values
|
string[]
|
Uppsättningen filtervärden.
|
systemData
Metadata som rör skapande och senaste ändring av resursen.
Name |
Typ |
Description |
createdAt
|
string
|
Tidsstämpeln för resursskapande (UTC).
|
createdBy
|
string
|
Identiteten som skapade resursen.
|
createdByType
|
createdByType
|
Den typ av identitet som skapade resursen.
|
lastModifiedAt
|
string
|
Tidsstämpeln för resursens senaste ändring (UTC)
|
lastModifiedBy
|
string
|
Identiteten som senast ändrade resursen.
|
lastModifiedByType
|
createdByType
|
Den typ av identitet som senast ändrade resursen.
|
WebHookEventSubscriptionDestination
Information om webhookens mål för en händelseprenumeration.
Name |
Typ |
Standardvärde |
Description |
endpointType
|
string:
WebHook
|
|
Typ av slutpunkt för händelseprenumerationsmålet.
|
properties.azureActiveDirectoryApplicationIdOrUri
|
string
|
|
Azure Active Directory-program-ID eller URI för att hämta den åtkomsttoken som ska inkluderas som ägartoken i leveransbegäranden.
|
properties.azureActiveDirectoryTenantId
|
string
|
|
Klient-ID:t för Azure Active Directory för att hämta den åtkomsttoken som ska inkluderas som ägartoken i leveransbegäranden.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
|
Information om leveransattribut.
|
properties.endpointBaseUrl
|
string
|
|
Den bas-URL som representerar slutpunkten för målet för en händelseprenumeration.
|
properties.endpointUrl
|
string
|
|
Den URL som representerar slutpunkten för målet för en händelseprenumeration.
|
properties.maxEventsPerBatch
|
integer
|
1
|
Maximalt antal händelser per batch.
|
properties.preferredBatchSizeInKilobytes
|
integer
|
64
|
Önskad batchstorlek i Kilobyte.
|