Aktualizujte odběr událostí.
Asynchronně aktualizuje existující odběr událostí.
PATCH https://management.azure.com/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}?api-version=2022-06-15
Parametry identifikátoru URI
Name |
V |
Vyžadováno |
Typ |
Description |
eventSubscriptionName
|
path |
True
|
string
|
Název odběru události, který se má aktualizovat.
|
scope
|
path |
True
|
string
|
Rozsah existujícího odběru událostí. Oborem může být předplatné, skupina prostředků, prostředek nejvyšší úrovně, který patří do oboru názvů poskytovatele prostředků, nebo téma EventGrid. Například pro předplatné použijte /subscriptions/{id_předplatného}/, /subscriptions/{id_předplatného}/resourceGroups/{název_skupiny_prostředků} pro skupinu prostředků. a /subscriptions/{id_předplatného}/resourceGroups/{název_skupiny_prostředků}/providers/{resourceProviderNamespace}/{resourceType}/{název_prostředku} pro prostředek a /subscriptions/{id_předplatného}/resourceGroups/{název_skupiny_prostředků}/providers/Microsoft.EventGrid/topics/{topicName} pro téma EventGrid.
|
api-version
|
query |
True
|
string
|
Verze rozhraní API, která se má použít s požadavkem klienta.
|
Text požadavku
Name |
Typ |
Description |
deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Cíl nedoručených dopisů odběru události. Každá událost, kterou nelze doručit do cíle, se odešle do cíle nedoručených dopisů.
Používá identitu Azure Event Grid k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
Cíl nedoručených dopisů odběru události. Každá událost, kterou nelze doručit do cíle, se odešle do cíle nedoručených dopisů.
Použije nastavení spravované identity v nadřazeném prostředku (téma nebo doména) k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Použije nastavení spravované identity v nadřazeném prostředku (téma nebo doména) k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
destination
|
EventSubscriptionDestination:
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Používá identitu Azure Event Grid k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
eventDeliverySchema
|
EventDeliverySchema
|
Schéma doručování událostí pro odběr události.
|
expirationTimeUtc
|
string
|
Informace o době vypršení platnosti odběru události.
|
filter
|
EventSubscriptionFilter
|
Informace o filtru odběru událostí.
|
labels
|
string[]
|
Seznam popisků definovaných uživatelem
|
retryPolicy
|
RetryPolicy
|
Zásady opakování pro události. To se dá použít ke konfiguraci maximálního počtu pokusů o doručení a doby trvání událostí.
|
Odpovědi
Name |
Typ |
Description |
201 Created
|
EventSubscription
|
Žádost o aktualizaci EventSubscription byla přijata.
|
Other Status Codes
|
|
Chybové odpovědi: ***
|
Příklady
EventSubscriptions_UpdateForCustomTopic
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://requestb.in/15ksip71"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopic(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.withDestination(
new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic.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_UpdateForCustomTopic.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopic() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://requestb.in/15ksip71"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic.json
*/
async function eventSubscriptionsUpdateForCustomTopic() {
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/exampletopic2";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionUpdateParameters = {
destination: {
endpointType: "WebHook",
endpointUrl: "https://requestb.in/15ksip71",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://requestb.in/15ksip71"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
],
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination
Ukázkový požadavek
PATCH 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
{
"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.models.AzureFunctionEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopicAzureFunctionDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"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_UpdateForCustomTopic_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_UpdateForCustomTopic_AzureFunctionDestination.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicAzureFunctionDestination() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json
*/
async function eventSubscriptionsUpdateForCustomTopicAzureFunctionDestination() {
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 eventSubscriptionUpdateParameters = {
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.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic_AzureFunctionDestination.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
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 eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"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_UpdateForCustomTopic_EventHubDestination
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventHubEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic_EventHubDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopicEventHubDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.withDestination(
new EventHubEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
},
},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_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_UpdateForCustomTopic_EventHubDestination.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicEventHubDestination() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
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(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json
*/
async function eventSubscriptionsUpdateForCustomTopicEventHubDestination() {
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/exampletopic2";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionUpdateParameters = {
destination: {
endpointType: "EventHub",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic_EventHubDestination.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
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 = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
},
"endpointType": "EventHub"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
],
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"destination": {
"endpointType": "HybridConnection",
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.HybridConnectionEventSubscriptionDestination;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopicHybridConnectionDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.withDestination(
new HybridConnectionEventSubscriptionDestination()
.withResourceId(
"/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"destination": {
"endpointType": "HybridConnection",
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"
},
},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_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_UpdateForCustomTopic_HybridConnectionDestination.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicHybridConnectionDestination() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
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(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json
*/
async function eventSubscriptionsUpdateForCustomTopicHybridConnectionDestination() {
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/exampletopic2";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionUpdateParameters = {
destination: {
endpointType: "HybridConnection",
resourceId:
"/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic_HybridConnectionDestination.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
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 = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"
},
"endpointType": "HybridConnection"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
],
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination
Ukázkový požadavek
PATCH 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
{
"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.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.ServiceBusQueueEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopicServiceBusQueueDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"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_UpdateForCustomTopic_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_UpdateForCustomTopic_ServiceBusQueueDestination.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicServiceBusQueueDestination() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json
*/
async function eventSubscriptionsUpdateForCustomTopicServiceBusQueueDestination() {
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 eventSubscriptionUpdateParameters = {
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.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic_ServiceBusQueueDestination.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
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 eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"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_UpdateForCustomTopic_ServiceBusTopicDestination
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"destination": {
"endpointType": "ServiceBusTopic",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.ServiceBusTopicEventSubscriptionDestination;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopicServiceBusTopicDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.withDestination(
new ServiceBusTopicEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"destination": {
"endpointType": "ServiceBusTopic",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"
},
},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_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_UpdateForCustomTopic_ServiceBusTopicDestination.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicServiceBusTopicDestination() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
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(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json
*/
async function eventSubscriptionsUpdateForCustomTopicServiceBusTopicDestination() {
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/exampletopic2";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionUpdateParameters = {
destination: {
endpointType: "ServiceBusTopic",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic_ServiceBusTopicDestination.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
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 = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"
},
"endpointType": "ServiceBusTopic"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
],
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination
Ukázkový požadavek
PATCH 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
{
"destination": {
"endpointType": "StorageQueue",
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"queueName": "queue1",
"queueMessageTimeToLiveInSeconds": 300
}
},
"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.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.StorageBlobDeadLetterDestination;
import com.azure.resourcemanager.eventgrid.models.StorageQueueEventSubscriptionDestination;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopicStorageQueueDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.withDestination(
new StorageQueueEventSubscriptionDestination()
.withResourceId(
"/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg")
.withQueueName("queue1")
.withQueueMessageTimeToLiveInSeconds(300L))
.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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"blobContainerName": "contosocontainer",
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
},
"destination": {
"endpointType": "StorageQueue",
"properties": {
"queueMessageTimeToLiveInSeconds": 300,
"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_UpdateForCustomTopic_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_UpdateForCustomTopic_StorageQueueDestination.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicStorageQueueDestination() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
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{
QueueMessageTimeToLiveInSeconds: to.Ptr[int64](300),
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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json
*/
async function eventSubscriptionsUpdateForCustomTopicStorageQueueDestination() {
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 eventSubscriptionUpdateParameters = {
deadLetterDestination: {
blobContainerName: "contosocontainer",
endpointType: "StorageBlob",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
},
destination: {
endpointType: "StorageQueue",
queueMessageTimeToLiveInSeconds: 300,
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.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic_StorageQueueDestination.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
Destination = new StorageQueueEventSubscriptionDestination()
{
ResourceId = new ResourceIdentifier("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"),
QueueName = "queue1",
QueueMessageTimeToLiveInSeconds = 300,
},
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 eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"resourceId": "/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg",
"queueName": "queue1",
"queueMessageTimeToLiveInSeconds": 300
},
"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_UpdateForCustomTopic_WebhookDestination
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://requestb.in/15ksip71"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json
*/
/**
* Sample code: EventSubscriptions_UpdateForCustomTopic_WebhookDestination.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForCustomTopicWebhookDestination(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.withDestination(
new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_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_UpdateForCustomTopic_WebhookDestination.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicWebhookDestination() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://requestb.in/15ksip71"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json
*/
async function eventSubscriptionsUpdateForCustomTopicWebhookDestination() {
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/exampletopic2";
const eventSubscriptionName = "examplesubscription1";
const eventSubscriptionUpdateParameters = {
destination: {
endpointType: "WebHook",
endpointUrl: "https://requestb.in/15ksip71",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForCustomTopic_WebhookDestination.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://requestb.in/15ksip71"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
],
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_UpdateForResource
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1?api-version=2022-06-15
{
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://requestb.in/15ksip71"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResource.json
*/
/**
* Sample code: EventSubscriptions_UpdateForResource.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForResource(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1",
"examplesubscription1",
new EventSubscriptionUpdateParameters()
.withDestination(
new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1",
event_subscription_name="examplesubscription1",
event_subscription_update_parameters={
"destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResource.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_UpdateForResource.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForResource() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://requestb.in/15ksip71"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResource.json
*/
async function eventSubscriptionsUpdateForResource() {
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 = "examplesubscription1";
const eventSubscriptionUpdateParameters = {
destination: {
endpointType: "WebHook",
endpointUrl: "https://requestb.in/15ksip71",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForResource.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1";
string eventSubscriptionName = "examplesubscription1";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://requestb.in/15ksip71"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [],
"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/examplesubscription1",
"name": "examplesubscription1",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
EventSubscriptions_UpdateForResourceGroup
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2?api-version=2022-06-15
{
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventHubEventSubscriptionDestination;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResourceGroup.json
*/
/**
* Sample code: EventSubscriptions_UpdateForResourceGroup.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForResourceGroup(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg",
"examplesubscription2",
new EventSubscriptionUpdateParameters()
.withDestination(
new EventHubEventSubscriptionDestination()
.withResourceId(
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg",
event_subscription_name="examplesubscription2",
event_subscription_update_parameters={
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"
},
},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResourceGroup.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_UpdateForResourceGroup.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForResourceGroup() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscriptionUpdateParameters{
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(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResourceGroup.json
*/
async function eventSubscriptionsUpdateForResourceGroup() {
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 eventSubscriptionUpdateParameters = {
destination: {
endpointType: "EventHub",
resourceId:
"/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForResourceGroup.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg";
string eventSubscriptionName = "examplesubscription2";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
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 = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [],
"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_UpdateForSubscription
Ukázkový požadavek
PATCH https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3?api-version=2022-06-15
{
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "https://requestb.in/15ksip71"
}
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [
"label1",
"label2"
]
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionFilter;
import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters;
import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
import java.util.Arrays;
/** Samples for EventSubscriptions Update. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForSubscription.json
*/
/**
* Sample code: EventSubscriptions_UpdateForSubscription.
*
* @param manager Entry point to EventGridManager.
*/
public static void eventSubscriptionsUpdateForSubscription(
com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.eventSubscriptions()
.update(
"subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4",
"examplesubscription3",
new EventSubscriptionUpdateParameters()
.withDestination(
new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71"))
.withFilter(
new EventSubscriptionFilter()
.withSubjectBeginsWith("existingPrefix")
.withSubjectEndsWith("newSuffix")
.withIsSubjectCaseSensitive(true))
.withLabels(Arrays.asList("label1", "label2")),
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_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_update(
scope="subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4",
event_subscription_name="examplesubscription3",
event_subscription_update_parameters={
"destination": {"endpointType": "WebHook", "properties": {"endpointUrl": "https://requestb.in/15ksip71"}},
"filter": {
"isSubjectCaseSensitive": True,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix",
},
"labels": ["label1", "label2"],
},
).result()
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForSubscription.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_UpdateForSubscription.json
func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForSubscription() {
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().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "examplesubscription3", armeventgrid.EventSubscriptionUpdateParameters{
Destination: &armeventgrid.WebHookEventSubscriptionDestination{
EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook),
Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{
EndpointURL: to.Ptr("https://requestb.in/15ksip71"),
},
},
Filter: &armeventgrid.EventSubscriptionFilter{
IsSubjectCaseSensitive: to.Ptr(true),
SubjectBeginsWith: to.Ptr("existingPrefix"),
SubjectEndsWith: to.Ptr("newSuffix"),
},
Labels: []*string{
to.Ptr("label1"),
to.Ptr("label2")},
}, 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 updates an existing event subscription.
*
* @summary Asynchronously updates an existing event subscription.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForSubscription.json
*/
async function eventSubscriptionsUpdateForSubscription() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4";
const eventSubscriptionName = "examplesubscription3";
const eventSubscriptionUpdateParameters = {
destination: {
endpointType: "WebHook",
endpointUrl: "https://requestb.in/15ksip71",
},
filter: {
isSubjectCaseSensitive: true,
subjectBeginsWith: "existingPrefix",
subjectEndsWith: "newSuffix",
},
labels: ["label1", "label2"],
};
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const result = await client.eventSubscriptions.beginUpdateAndWait(
scope,
eventSubscriptionName,
eventSubscriptionUpdateParameters
);
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_UpdateForSubscription.json
// this example is just showing the usage of "EventSubscriptions_Update" 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://learn.microsoft.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 EventSubscriptionResource created on azure
// for more information of creating EventSubscriptionResource, please refer to the document of EventSubscriptionResource
string scope = "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4";
string eventSubscriptionName = "examplesubscription3";
ResourceIdentifier eventSubscriptionResourceId = EventSubscriptionResource.CreateResourceIdentifier(scope, eventSubscriptionName);
EventSubscriptionResource eventSubscription = client.GetEventSubscriptionResource(eventSubscriptionResourceId);
// invoke the operation
EventGridSubscriptionPatch patch = new EventGridSubscriptionPatch()
{
Destination = new WebHookEventSubscriptionDestination()
{
Endpoint = new Uri("https://requestb.in/15ksip71"),
},
Filter = new EventSubscriptionFilter()
{
SubjectBeginsWith = "existingPrefix",
SubjectEndsWith = "newSuffix",
IsSubjectCaseSensitive = true,
},
Labels =
{
"label1","label2"
},
};
ArmOperation<EventSubscriptionResource> lro = await eventSubscription.UpdateAsync(WaitUntil.Completed, patch);
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
Ukázková odpověď
{
"properties": {
"destination": {
"properties": {
"endpointBaseUrl": "https://requestb.in/15ksip71"
},
"endpointType": "WebHook"
},
"filter": {
"isSubjectCaseSensitive": true,
"subjectBeginsWith": "existingPrefix",
"subjectEndsWith": "newSuffix"
},
"labels": [],
"provisioningState": "Succeeded",
"topic": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4"
},
"id": "/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3",
"name": "examplesubscription3",
"type": "Microsoft.EventGrid/eventSubscriptions"
}
Definice
AzureFunctionEventSubscriptionDestination
Informace o cíli funkce Azure pro odběr událostí.
Name |
Typ |
Default value |
Description |
endpointType
|
string:
AzureFunction
|
|
Typ koncového bodu pro cíl odběru událostí.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
|
Podrobnosti o atributu doručení
|
properties.maxEventsPerBatch
|
integer
|
1
|
Maximální počet událostí na dávku
|
properties.preferredBatchSizeInKilobytes
|
integer
|
64
|
Upřednostňovaná velikost dávky v kilobajtech
|
properties.resourceId
|
string
|
|
ID prostředku Azure, které představuje koncový bod cíle funkce Azure Pro odběr událostí.
|
BoolEqualsAdvancedFilter
Rozšířený filtr BoolEquals.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
BoolEquals
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
value
|
boolean
|
Logická hodnota filtru.
|
createdByType
Typ identity, která prostředek vytvořila.
Name |
Typ |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
DeadLetterWithResourceIdentity
Informace o cíli mrtvého bodu s identitou prostředku.
Name |
Typ |
Description |
deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Používá nastavení spravované identity v nadřazeném prostředku (konkrétně tématu nebo doméně) k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
identity
|
EventSubscriptionIdentity
|
Identita, která se má použít při nedoručených událostech.
|
DeliveryWithResourceIdentity
Informace o doručení odběru událostí s identitou prostředku
Name |
Typ |
Description |
destination
|
EventSubscriptionDestination:
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Používá identitu Azure Event Grid k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
identity
|
EventSubscriptionIdentity
|
Identita, která se má použít při doručování událostí.
|
DynamicDeliveryAttributeMapping
Podrobnosti mapování atributů dynamického doručení
Name |
Typ |
Description |
name
|
string
|
Název atributu doručení nebo hlavičky.
|
properties.sourceField
|
string
|
Cesta JSON v události, která obsahuje hodnotu atributu.
|
type
|
string:
Dynamic
|
Typ atributu doručení nebo názvu hlavičky.
|
EventDeliverySchema
Schéma doručování událostí pro odběr události.
Name |
Typ |
Description |
CloudEventSchemaV1_0
|
string
|
|
CustomInputSchema
|
string
|
|
EventGridSchema
|
string
|
|
EventHubEventSubscriptionDestination
Informace o cíli centra událostí pro odběr událostí
Name |
Typ |
Description |
endpointType
|
string:
EventHub
|
Typ koncového bodu pro cíl odběru událostí.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Podrobnosti o atributu doručení
|
properties.resourceId
|
string
|
ID prostředku Azure, které představuje koncový bod cíle centra událostí odběru událostí.
|
EventSubscription
Odběr událostí
Name |
Typ |
Default value |
Description |
id
|
string
|
|
Plně kvalifikovaný identifikátor prostředku.
|
name
|
string
|
|
Název prostředku.
|
properties.deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
|
Cíl nedoručených dopisů odběru události. Každá událost, kterou nelze doručit do cíle, se odešle do cíle nedoručených dopisů.
Používá identitu Azure Event Grid k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
properties.deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
|
Cíl nedoručených dopisů odběru události. Každá událost, kterou nelze doručit do cíle, se odešle do cíle nedoručených dopisů.
Používá nastavení spravované identity v nadřazeném prostředku (konkrétně tématu nebo doméně) k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
properties.deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Používá nastavení spravované identity v nadřazeném prostředku (konkrétně tématu nebo doméně) k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
properties.destination
|
EventSubscriptionDestination:
|
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Používá identitu Azure Event Grid k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
properties.eventDeliverySchema
|
EventDeliverySchema
|
EventGridSchema
|
Schéma doručování událostí pro odběr události.
|
properties.expirationTimeUtc
|
string
|
|
Čas vypršení platnosti odběru události.
|
properties.filter
|
EventSubscriptionFilter
|
|
Informace o filtru odběru událostí.
|
properties.labels
|
string[]
|
|
Seznam popisků definovaných uživatelem
|
properties.provisioningState
|
EventSubscriptionProvisioningState
|
|
Stav zřizování odběru událostí.
|
properties.retryPolicy
|
RetryPolicy
|
|
Zásady opakování pro události. To se dá použít ke konfiguraci maximálního počtu pokusů o doručení a doby trvání událostí.
|
properties.topic
|
string
|
|
Název tématu odběru události.
|
systemData
|
systemData
|
|
Systémová metadata související s prostředkem odběru události.
|
type
|
string
|
|
Typ prostředku.
|
EventSubscriptionFilter
Vyfiltrujte odběr události.
Name |
Typ |
Default value |
Description |
advancedFilters
|
AdvancedFilter[]:
|
|
Pole rozšířených filtrů, které se používají k filtrování odběrů událostí.
|
enableAdvancedFilteringOnArrays
|
boolean
|
|
Umožňuje, aby rozšířené filtry byly vyhodnoceny oproti poli hodnot místo toho, aby se očekávala hodnota v jednotném čísle.
|
includedEventTypes
|
string[]
|
|
Seznam použitelných typů událostí, které musí být součástí odběru událostí. Pokud se chcete přihlásit k odběru všech výchozích typů událostí, nastavte IncludedEventTypes na hodnotu null.
|
isSubjectCaseSensitive
|
boolean
|
False
|
Určuje, jestli mají být vlastnosti filtru SubjectBeginsWith a SubjectEndsWith porovnány způsobem rozlišující malá a velká písmena.
|
subjectBeginsWith
|
string
|
|
Volitelný řetězec pro filtrování událostí odběru událostí na základě předpony cesty k prostředku.
Formát závisí na vydavateli událostí.
Tato cesta nepodporuje zástupné znaky.
|
subjectEndsWith
|
string
|
|
Volitelný řetězec pro filtrování událostí odběru událostí na základě přípony cesty k prostředku.
Tato cesta nepodporuje zástupné znaky.
|
EventSubscriptionIdentity
Informace o identitě s odběrem události.
Name |
Typ |
Description |
type
|
EventSubscriptionIdentityType
|
Typ použité spravované identity. Typ SystemAssigned, UserAssigned zahrnuje implicitně vytvořenou identitu i sadu identit přiřazených uživatelem. Typ None odebere jakoukoli identitu.
|
userAssignedIdentity
|
string
|
Identita uživatele přidružená k prostředku.
|
EventSubscriptionIdentityType
Typ použité spravované identity. Typ SystemAssigned, UserAssigned zahrnuje implicitně vytvořenou identitu i sadu identit přiřazených uživatelem. Typ None odebere jakoukoli identitu.
Name |
Typ |
Description |
SystemAssigned
|
string
|
|
UserAssigned
|
string
|
|
EventSubscriptionProvisioningState
Stav zřizování odběru událostí.
Name |
Typ |
Description |
AwaitingManualAction
|
string
|
|
Canceled
|
string
|
|
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
EventSubscriptionUpdateParameters
Vlastnosti aktualizace odběru událostí.
Name |
Typ |
Description |
deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Cíl nedoručených dopisů odběru události. Každá událost, kterou nelze doručit do cíle, se odešle do cíle nedoručených dopisů.
Používá identitu Azure Event Grid k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
Cíl nedoručených dopisů odběru události. Každá událost, kterou nelze doručit do cíle, se odešle do cíle nedoručených dopisů.
Použije nastavení spravované identity v nadřazeném prostředku (téma nebo doména) k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Použije nastavení spravované identity v nadřazeném prostředku (téma nebo doména) k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
destination
|
EventSubscriptionDestination:
|
Informace o cíli, kam se mají doručovat události pro odběr událostí.
Používá identitu Azure Event Grid k získání ověřovacích tokenů, které se používají při doručování nebo nedoručených dopisech.
|
eventDeliverySchema
|
EventDeliverySchema
|
Schéma doručování událostí pro odběr události.
|
expirationTimeUtc
|
string
|
Informace o době vypršení platnosti odběru události.
|
filter
|
EventSubscriptionFilter
|
Informace o filtru odběru událostí.
|
labels
|
string[]
|
Seznam popisků definovaných uživatelem
|
retryPolicy
|
RetryPolicy
|
Zásady opakování pro události. To se dá použít ke konfiguraci maximálního počtu pokusů o doručení a doby trvání událostí.
|
HybridConnectionEventSubscriptionDestination
Informace o cíli HybridConnection pro odběr událostí.
Name |
Typ |
Description |
endpointType
|
string:
HybridConnection
|
Typ koncového bodu pro cíl odběru událostí.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Podrobnosti o atributu doručení
|
properties.resourceId
|
string
|
ID prostředku Azure hybridního připojení, které je cílem odběru událostí.
|
IsNotNullAdvancedFilter
Rozšířený filtr IsNotNull
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
IsNotNull
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
IsNullOrUndefinedAdvancedFilter
IsNullOrUndefined Rozšířený filtr.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
IsNullOrUndefined
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
NumberGreaterThanAdvancedFilter
Rozšířený filtr NumberGreaterThan.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberGreaterThan
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
value
|
number
|
Hodnota filtru.
|
NumberGreaterThanOrEqualsAdvancedFilter
Rozšířený filtr NumberGreaterThanOrEquals
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberGreaterThanOrEquals
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
value
|
number
|
Hodnota filtru.
|
NumberInAdvancedFilter
NumberV rozšířeném filtru.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberIn
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
number[]
|
Sada hodnot filtru.
|
NumberInRangeAdvancedFilter
Rozšířený filtr NumberInRange
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberInRange
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
number[]
|
Sada hodnot filtru.
|
NumberLessThanAdvancedFilter
NumberLessThan Rozšířený filtr.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberLessThan
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
value
|
number
|
Hodnota filtru.
|
NumberLessThanOrEqualsAdvancedFilter
Rozšířený filtr NumberLessThanOrEquals.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberLessThanOrEquals
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
value
|
number
|
Hodnota filtru.
|
NumberNotInAdvancedFilter
Rozšířený filtr NumberNotIn.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberNotIn
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
number[]
|
Sada hodnot filtru.
|
NumberNotInRangeAdvancedFilter
Rozšířený filtr NumberNotInRange.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
NumberNotInRange
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
number[]
|
Sada hodnot filtru.
|
RetryPolicy
Informace o zásadách opakování pro odběr událostí
Name |
Typ |
Default value |
Description |
eventTimeToLiveInMinutes
|
integer
|
1440
|
Funkce TTL (v minutách) pro události
|
maxDeliveryAttempts
|
integer
|
30
|
Maximální počet opakovaných pokusů o doručení událostí
|
ServiceBusQueueEventSubscriptionDestination
Informace o cíli služby Service Bus pro odběr událostí.
Name |
Typ |
Description |
endpointType
|
string:
ServiceBusQueue
|
Typ koncového bodu pro cíl odběru událostí.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Podrobnosti o atributu doručení
|
properties.resourceId
|
string
|
ID prostředku Azure, které představuje koncový bod cíle služby Service Bus odběru událostí.
|
ServiceBusTopicEventSubscriptionDestination
Informace o cíli tématu služby Service Bus pro odběr událostí.
Name |
Typ |
Description |
endpointType
|
string:
ServiceBusTopic
|
Typ koncového bodu pro cíl odběru událostí.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Podrobnosti o atributu doručení
|
properties.resourceId
|
string
|
ID prostředku Azure, které představuje koncový bod cíle tématu služby Service Bus odběru událostí.
|
StaticDeliveryAttributeMapping
Podrobnosti mapování statického atributu doručení
Name |
Typ |
Default value |
Description |
name
|
string
|
|
Název atributu doručení nebo hlavičky.
|
properties.isSecret
|
boolean
|
False
|
Logický příznak určující, jestli atribut obsahuje citlivé informace .
|
properties.value
|
string
|
|
Hodnota atributu delivery
|
type
|
string:
Static
|
|
Typ atributu doručení nebo názvu hlavičky.
|
StorageBlobDeadLetterDestination
Informace o cíli nedoručených dopisů založených na objektech blob úložiště
Name |
Typ |
Description |
endpointType
|
string:
StorageBlob
|
Typ koncového bodu pro cíl nedoručených dopisů
|
properties.blobContainerName
|
string
|
Název kontejneru objektů blob služby Storage, který je cílem událostí deadletter
|
properties.resourceId
|
string
|
ID prostředku Azure účtu úložiště, který je cílem událostí deadletter
|
StorageQueueEventSubscriptionDestination
Informace o cíli fronty úložiště pro odběr událostí.
Name |
Typ |
Description |
endpointType
|
string:
StorageQueue
|
Typ koncového bodu pro cíl odběru událostí.
|
properties.queueMessageTimeToLiveInSeconds
|
integer
|
Doba života zprávy fronty úložiště v sekundách
|
properties.queueName
|
string
|
Název fronty úložiště v rámci účtu úložiště, který je cílem odběru událostí.
|
properties.resourceId
|
string
|
ID prostředku Azure účtu úložiště, který obsahuje frontu, která je cílem odběru událostí.
|
StringBeginsWithAdvancedFilter
StringBeginsWith Rozšířený filtr.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringBeginsWith
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
StringContainsAdvancedFilter
StringContains Advanced Filter.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringContains
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
StringEndsWithAdvancedFilter
StringEndsWith Rozšířený filtr.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringEndsWith
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
StringInAdvancedFilter
StringV rozšířeném filtru.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringIn
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
StringNotBeginsWithAdvancedFilter
StringNotBeginsWith Rozšířený filtr.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringNotBeginsWith
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
StringNotContainsAdvancedFilter
StringNotContains Advanced Filter.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringNotContains
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
StringNotEndsWithAdvancedFilter
StringNotEndsWith Rozšířený filtr.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringNotEndsWith
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
StringNotInAdvancedFilter
Rozšířený filtr StringNotIn.
Name |
Typ |
Description |
key
|
string
|
Pole nebo vlastnost v události, podle které chcete filtrovat.
|
operatorType
|
string:
StringNotIn
|
Typ operátoru použitého pro filtrování, např. NumberIn, StringContains, BoolEquals a další.
|
values
|
string[]
|
Sada hodnot filtru.
|
systemData
Metadata týkající se vytvoření a poslední změny prostředku.
Name |
Typ |
Description |
createdAt
|
string
|
Časové razítko vytvoření prostředku (UTC)
|
createdBy
|
string
|
Identita, která vytvořila prostředek.
|
createdByType
|
createdByType
|
Typ identity, která prostředek vytvořila.
|
lastModifiedAt
|
string
|
Časové razítko poslední změny prostředku (UTC)
|
lastModifiedBy
|
string
|
Identita, která naposledy změnila prostředek.
|
lastModifiedByType
|
createdByType
|
Typ identity, která naposledy změnila prostředek.
|
WebHookEventSubscriptionDestination
Informace o cíli webhooku pro odběr událostí
Name |
Typ |
Default value |
Description |
endpointType
|
string:
WebHook
|
|
Typ koncového bodu pro cíl odběru událostí.
|
properties.azureActiveDirectoryApplicationIdOrUri
|
string
|
|
ID nebo identifikátor URI aplikace Azure Active Directory pro získání přístupového tokenu, který se zahrne jako nosný token do žádostí o doručení.
|
properties.azureActiveDirectoryTenantId
|
string
|
|
ID tenanta Azure Active Directory pro získání přístupového tokenu, který bude zahrnutý jako nosný token v žádostech o doručení.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
|
Podrobnosti o atributu doručení
|
properties.endpointBaseUrl
|
string
|
|
Základní adresa URL, která představuje koncový bod cíle odběru událostí.
|
properties.endpointUrl
|
string
|
|
Adresa URL, která představuje koncový bod cíle odběru událostí.
|
properties.maxEventsPerBatch
|
integer
|
1
|
Maximální počet událostí na dávku
|
properties.preferredBatchSizeInKilobytes
|
integer
|
64
|
Upřednostňovaná velikost dávky v kilobajtech
|