Aggiornare una sottoscrizione di eventi.
Aggiorna in modo asincrono una sottoscrizione di eventi esistente.
PATCH https://management.azure.com/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}?api-version=2022-06-15
Parametri dell'URI
Nome |
In |
Necessario |
Tipo |
Descrizione |
eventSubscriptionName
|
path |
True
|
string
|
Nome della sottoscrizione di eventi da aggiornare.
|
scope
|
path |
True
|
string
|
Ambito della sottoscrizione di eventi esistente. L'ambito può essere una sottoscrizione o un gruppo di risorse o una risorsa di primo livello appartenente a uno spazio dei nomi del provider di risorse o un argomento EventGrid. Ad esempio, usare '/subscriptions/{subscriptionId}/' per una sottoscrizione, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' per un gruppo di risorse, e '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' per una risorsa e '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' per un argomento eventGrid.
|
api-version
|
query |
True
|
string
|
Versione dell'API da usare con la richiesta client.
|
Corpo della richiesta
Nome |
Tipo |
Descrizione |
deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Destinazione dei messaggi non recapitabili della sottoscrizione dell'evento. Qualsiasi evento che non può essere recapitato alla destinazione dei messaggi non recapitabili viene inviato alla destinazione dei messaggi non recapitabili.
Usa l'identità di Griglia di eventi di Azure per acquisire i token di autenticazione usati durante il recapito o l'invio di messaggi non recapitabili.
|
deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
Destinazione dei messaggi non recapitabili della sottoscrizione dell'evento. Qualsiasi evento che non può essere recapitato alla destinazione dei messaggi non recapitabili viene inviato alla destinazione dei messaggi non recapitabili.
Usa la configurazione dell'identità gestita nella risorsa padre (argomento/dominio) per acquisire i token di autenticazione usati durante il recapito o l'invio di messaggi non recapitabili.
|
deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
Informazioni sulla destinazione in cui devono essere recapitati gli eventi per la sottoscrizione di eventi.
Usa la configurazione dell'identità gestita nella risorsa padre (argomento/dominio) per acquisire i token di autenticazione usati durante il recapito o l'invio di messaggi non recapitabili.
|
destination
|
EventSubscriptionDestination:
|
Informazioni sulla destinazione in cui devono essere recapitati gli eventi per la sottoscrizione di eventi.
Usa l'identità di Griglia di eventi di Azure per acquisire i token di autenticazione usati durante il recapito o l'invio di messaggi non recapitabili.
|
eventDeliverySchema
|
EventDeliverySchema
|
Schema di recapito degli eventi per la sottoscrizione di eventi.
|
expirationTimeUtc
|
string
|
Informazioni sull'ora di scadenza per la sottoscrizione di eventi.
|
filter
|
EventSubscriptionFilter
|
Informazioni sul filtro per la sottoscrizione di eventi.
|
labels
|
string[]
|
Elenco di etichette definite dall'utente.
|
retryPolicy
|
RetryPolicy
|
Criteri di ripetizione dei tentativi per gli eventi. Può essere usato per configurare il numero massimo di tentativi di recapito e il tempo di esecuzione per gli eventi.
|
Risposte
Nome |
Tipo |
Descrizione |
201 Created
|
EventSubscription
|
Richiesta di aggiornamento EventSubscription accettata.
|
Other Status Codes
|
|
Risposte di errore:
|
Esempio
EventSubscriptions_UpdateForCustomTopic
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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
Esempio di richiesta
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://video2.skills-academy.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this 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
Risposta di esempio
{
"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"
}
Definizioni
AzureFunctionEventSubscriptionDestination
Informazioni sulla destinazione della funzione di Azure per una sottoscrizione di eventi.
Nome |
Tipo |
Valore predefinito |
Descrizione |
endpointType
|
string:
AzureFunction
|
|
Tipo dell'endpoint per la destinazione della sottoscrizione dell'evento.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
|
Dettagli dell'attributo di recapito.
|
properties.maxEventsPerBatch
|
integer
|
1
|
Numero massimo di eventi per batch.
|
properties.preferredBatchSizeInKilobytes
|
integer
|
64
|
Dimensioni batch preferite in Kilobyte.
|
properties.resourceId
|
string
|
|
ID risorsa di Azure che rappresenta l'endpoint della destinazione della funzione di Azure di una sottoscrizione dell'evento.
|
BoolEqualsAdvancedFilter
Filtro avanzato BoolEquals.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
BoolEquals
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
value
|
boolean
|
Valore del filtro booleano.
|
createdByType
Tipo di identità che ha creato la risorsa.
Nome |
Tipo |
Descrizione |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
DeadLetterWithResourceIdentity
Informazioni sulla destinazione deadletter con l'identità delle risorse.
Nome |
Tipo |
Descrizione |
deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Informazioni sulla destinazione in cui gli eventi devono essere recapitati per la sottoscrizione dell'evento.
Usa la configurazione dell'identità gestita nella risorsa padre (ad esempio, argomento o dominio) per acquisire i token di autenticazione usati durante il recapito/la lettera non recapitata.
|
identity
|
EventSubscriptionIdentity
|
Identità da usare quando gli eventi di lettera non recapitabili.
|
DeliveryWithResourceIdentity
Informazioni sul recapito per una sottoscrizione di eventi con identità della risorsa.
Nome |
Tipo |
Descrizione |
destination
|
EventSubscriptionDestination:
|
Informazioni sulla destinazione in cui gli eventi devono essere recapitati per la sottoscrizione dell'evento.
Usa l'identità di Griglia di eventi di Azure per acquisire i token di autenticazione usati durante il recapito o la lettera non recapitata.
|
identity
|
EventSubscriptionIdentity
|
Identità da usare per la distribuzione di eventi.
|
DynamicDeliveryAttributeMapping
Dettagli del mapping degli attributi per il recapito dinamico.
Nome |
Tipo |
Descrizione |
name
|
string
|
Nome dell'attributo o dell'intestazione di recapito.
|
properties.sourceField
|
string
|
Percorso JSON nell'evento che contiene il valore dell'attributo.
|
type
|
string:
Dynamic
|
Tipo dell'attributo di recapito o del nome dell'intestazione.
|
EventDeliverySchema
Schema di recapito degli eventi per la sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
CloudEventSchemaV1_0
|
string
|
|
CustomInputSchema
|
string
|
|
EventGridSchema
|
string
|
|
EventHubEventSubscriptionDestination
Informazioni sulla destinazione dell'hub eventi per una sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
endpointType
|
string:
EventHub
|
Tipo dell'endpoint per la destinazione della sottoscrizione dell'evento.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Dettagli dell'attributo di recapito.
|
properties.resourceId
|
string
|
ID risorsa di Azure che rappresenta l'endpoint di una destinazione hub eventi di una sottoscrizione dell'evento.
|
EventSubscription
Sottoscrizione di eventi
Nome |
Tipo |
Valore predefinito |
Descrizione |
id
|
string
|
|
Identificatore completo della risorsa.
|
name
|
string
|
|
Nome della risorsa.
|
properties.deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
|
Destinazione lettera non recapitata della sottoscrizione dell'evento. Qualsiasi evento che non può essere recapitato alla destinazione della lettera morta viene inviato alla destinazione della lettera morta.
Usa l'identità di Griglia di eventi di Azure per acquisire i token di autenticazione usati durante il recapito o la lettera non recapitata.
|
properties.deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
|
Destinazione lettera non recapitata della sottoscrizione dell'evento. Qualsiasi evento che non può essere recapitato alla destinazione della lettera morta viene inviato alla destinazione della lettera morta.
Usa la configurazione dell'identità gestita nella risorsa padre (ad esempio, argomento o dominio) per acquisire i token di autenticazione usati durante il recapito/la lettera non recapitata.
|
properties.deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
|
Informazioni sulla destinazione in cui gli eventi devono essere recapitati per la sottoscrizione dell'evento.
Usa la configurazione dell'identità gestita nella risorsa padre (ad esempio, argomento o dominio) per acquisire i token di autenticazione usati durante il recapito/la lettera non recapitata.
|
properties.destination
|
EventSubscriptionDestination:
|
|
Informazioni sulla destinazione in cui gli eventi devono essere recapitati per la sottoscrizione dell'evento.
Usa l'identità di Griglia di eventi di Azure per acquisire i token di autenticazione usati durante il recapito o la lettera non recapitata.
|
properties.eventDeliverySchema
|
EventDeliverySchema
|
EventGridSchema
|
Schema di recapito eventi per la sottoscrizione dell'evento.
|
properties.expirationTimeUtc
|
string
|
|
Data di scadenza della sottoscrizione dell'evento.
|
properties.filter
|
EventSubscriptionFilter
|
|
Informazioni sul filtro per la sottoscrizione dell'evento.
|
properties.labels
|
string[]
|
|
Elenco delle etichette definite dall'utente.
|
properties.provisioningState
|
EventSubscriptionProvisioningState
|
|
Stato di provisioning della sottoscrizione dell'evento.
|
properties.retryPolicy
|
RetryPolicy
|
|
Criteri di ripetizione dei tentativi per gli eventi. Questa operazione può essere usata per configurare il numero massimo di tentativi di recapito e il tempo per l'esecuzione degli eventi.
|
properties.topic
|
string
|
|
Nome dell'argomento della sottoscrizione dell'evento.
|
systemData
|
systemData
|
|
Metadati di sistema relativi alla risorsa Sottoscrizione eventi.
|
type
|
string
|
|
Tipo di risorsa.
|
EventSubscriptionFilter
Filtrare per la sottoscrizione dell'evento.
Nome |
Tipo |
Valore predefinito |
Descrizione |
advancedFilters
|
AdvancedFilter[]:
|
|
Matrice di filtri avanzati usati per filtrare le sottoscrizioni degli eventi.
|
enableAdvancedFilteringOnArrays
|
boolean
|
|
Consente di valutare i filtri avanzati in base a una matrice di valori anziché prevedere un valore singolare.
|
includedEventTypes
|
string[]
|
|
Elenco di tipi di eventi applicabili che devono essere parte della sottoscrizione dell'evento. Se si desidera sottoscrivere tutti i tipi di evento predefiniti, impostare i valori IncludedEventTypes su Null.
|
isSubjectCaseSensitive
|
boolean
|
False
|
Specifica se le proprietà SubjectBeginsWith e SubjectEndsWith del filtro devono essere confrontate in modo distinzione tra maiuscole e minuscole.
|
subjectBeginsWith
|
string
|
|
Stringa facoltativa per filtrare gli eventi per una sottoscrizione di eventi in base al prefisso del percorso della risorsa.
Il formato di questo dipende dal server di pubblicazione degli eventi.
I caratteri jolly non sono supportati in questo percorso.
|
subjectEndsWith
|
string
|
|
Stringa facoltativa per filtrare gli eventi per una sottoscrizione di eventi in base a un suffisso del percorso della risorsa.
I caratteri jolly non sono supportati in questo percorso.
|
EventSubscriptionIdentity
Informazioni sull'identità con la sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
type
|
EventSubscriptionIdentityType
|
Tipo di identità gestita usata. Il tipo "SystemAssigned, UserAssigned" include sia un'identità creata in modo implicito che un set di identità assegnate dall'utente. Il tipo "Nessuno" rimuoverà qualsiasi identità.
|
userAssignedIdentity
|
string
|
Identità utente associata alla risorsa.
|
EventSubscriptionIdentityType
Tipo di identità gestita usata. Il tipo "SystemAssigned, UserAssigned" include sia un'identità creata in modo implicito che un set di identità assegnate dall'utente. Il tipo "Nessuno" rimuoverà qualsiasi identità.
Nome |
Tipo |
Descrizione |
SystemAssigned
|
string
|
|
UserAssigned
|
string
|
|
EventSubscriptionProvisioningState
Stato di provisioning della sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
AwaitingManualAction
|
string
|
|
Canceled
|
string
|
|
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
EventSubscriptionUpdateParameters
Proprietà dell'aggiornamento della sottoscrizione eventi.
Nome |
Tipo |
Descrizione |
deadLetterDestination
|
DeadLetterDestination:
StorageBlobDeadLetterDestination
|
Destinazione lettera non recapitata della sottoscrizione dell'evento. Qualsiasi evento che non può essere recapitato alla destinazione della lettera morta viene inviato alla destinazione della lettera morta.
Usa l'identità di Griglia di eventi di Azure per acquisire i token di autenticazione usati durante il recapito o la lettera non recapitata.
|
deadLetterWithResourceIdentity
|
DeadLetterWithResourceIdentity
|
Destinazione lettera non recapitata della sottoscrizione dell'evento. Qualsiasi evento che non può essere recapitato alla destinazione della lettera morta viene inviato alla destinazione della lettera morta.
Usa la configurazione dell'identità gestita nella risorsa padre (argomento/dominio) per acquisire i token di autenticazione usati durante il recapito/la lettera non recapitata.
|
deliveryWithResourceIdentity
|
DeliveryWithResourceIdentity
|
Informazioni sulla destinazione in cui gli eventi devono essere recapitati per la sottoscrizione dell'evento.
Usa la configurazione dell'identità gestita nella risorsa padre (argomento/dominio) per acquisire i token di autenticazione usati durante il recapito/la lettera non recapitata.
|
destination
|
EventSubscriptionDestination:
|
Informazioni sulla destinazione in cui gli eventi devono essere recapitati per la sottoscrizione dell'evento.
Usa l'identità di Griglia di eventi di Azure per acquisire i token di autenticazione usati durante il recapito o la lettera non recapitata.
|
eventDeliverySchema
|
EventDeliverySchema
|
Schema di recapito eventi per la sottoscrizione dell'evento.
|
expirationTimeUtc
|
string
|
Informazioni sull'ora di scadenza per la sottoscrizione dell'evento.
|
filter
|
EventSubscriptionFilter
|
Informazioni sul filtro per la sottoscrizione dell'evento.
|
labels
|
string[]
|
Elenco delle etichette definite dall'utente.
|
retryPolicy
|
RetryPolicy
|
Criteri di ripetizione dei tentativi per gli eventi. Questa operazione può essere usata per configurare il numero massimo di tentativi di recapito e il tempo per l'esecuzione degli eventi.
|
HybridConnectionEventSubscriptionDestination
Informazioni sulla destinazione HybridConnection per una sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
endpointType
|
string:
HybridConnection
|
Tipo dell'endpoint per la destinazione della sottoscrizione dell'evento.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Dettagli dell'attributo di recapito.
|
properties.resourceId
|
string
|
ID risorsa di Azure di una connessione ibrida che rappresenta la destinazione di una sottoscrizione dell'evento.
|
IsNotNullAdvancedFilter
Filtro avanzato IsNotNull.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
IsNotNull
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
IsNullOrUndefinedAdvancedFilter
Filtro avanzato IsNullOrUndefined.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
IsNullOrUndefined
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
NumberGreaterThanAdvancedFilter
Filtro avanzato NumberGreaterThan.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberGreaterThan
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
value
|
number
|
Il valore del filtro.
|
NumberGreaterThanOrEqualsAdvancedFilter
Filtro avanzato NumberGreaterThanOrEquals.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberGreaterThanOrEquals
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
value
|
number
|
Il valore del filtro.
|
NumberInAdvancedFilter
NumberIn Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberIn
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
number[]
|
Set di valori di filtro.
|
NumberInRangeAdvancedFilter
NumberInRange Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberInRange
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
number[]
|
Set di valori di filtro.
|
NumberLessThanAdvancedFilter
Filtro avanzato NumberLessThan.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberLessThan
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
value
|
number
|
Il valore del filtro.
|
NumberLessThanOrEqualsAdvancedFilter
Filtro avanzato NumberLessThanOrEquals.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberLessThanOrEquals
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
value
|
number
|
Il valore del filtro.
|
NumberNotInAdvancedFilter
Filtro avanzato NumberNotIn.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberNotIn
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
number[]
|
Set di valori di filtro.
|
NumberNotInRangeAdvancedFilter
Filtro avanzato NumberNotInRange.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
NumberNotInRange
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
number[]
|
Set di valori di filtro.
|
RetryPolicy
Informazioni sui criteri di ripetizione dei tentativi per una sottoscrizione di eventi.
Nome |
Tipo |
Valore predefinito |
Descrizione |
eventTimeToLiveInMinutes
|
integer
|
1440
|
Time To Live (in minuti) per gli eventi.
|
maxDeliveryAttempts
|
integer
|
30
|
Numero massimo di tentativi di recapito per gli eventi.
|
ServiceBusQueueEventSubscriptionDestination
Informazioni sulla destinazione del bus di servizio per una sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
endpointType
|
string:
ServiceBusQueue
|
Tipo dell'endpoint per la destinazione della sottoscrizione dell'evento.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Dettagli dell'attributo di recapito.
|
properties.resourceId
|
string
|
ID risorsa di Azure che rappresenta l'endpoint della destinazione del bus di servizio di una sottoscrizione dell'evento.
|
ServiceBusTopicEventSubscriptionDestination
Informazioni sulla destinazione dell'argomento del bus di servizio per una sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
endpointType
|
string:
ServiceBusTopic
|
Tipo dell'endpoint per la destinazione della sottoscrizione dell'evento.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
Dettagli dell'attributo di recapito.
|
properties.resourceId
|
string
|
ID risorsa di Azure che rappresenta l'endpoint della destinazione argomento del bus di servizio di una sottoscrizione dell'evento.
|
StaticDeliveryAttributeMapping
Dettagli del mapping degli attributi di recapito statici.
Nome |
Tipo |
Valore predefinito |
Descrizione |
name
|
string
|
|
Nome dell'attributo o dell'intestazione di recapito.
|
properties.isSecret
|
boolean
|
False
|
Flag booleano che indica se l'attributo contiene informazioni riservate.
|
properties.value
|
string
|
|
Valore dell'attributo di recapito.
|
type
|
string:
Static
|
|
Tipo dell'attributo di recapito o del nome dell'intestazione.
|
StorageBlobDeadLetterDestination
Informazioni sulla destinazione dei messaggi non recapitabili basati sul BLOB di archiviazione.
Nome |
Tipo |
Descrizione |
endpointType
|
string:
StorageBlob
|
Tipo di endpoint per la destinazione dei messaggi non recapitabili
|
properties.blobContainerName
|
string
|
Nome del contenitore BLOB di archiviazione che rappresenta la destinazione degli eventi non recapitabili
|
properties.resourceId
|
string
|
ID risorsa di Azure dell'account di archiviazione che rappresenta la destinazione degli eventi non recapitabili
|
StorageQueueEventSubscriptionDestination
Informazioni sulla destinazione della coda di archiviazione per una sottoscrizione di eventi.
Nome |
Tipo |
Descrizione |
endpointType
|
string:
StorageQueue
|
Tipo dell'endpoint per la destinazione della sottoscrizione dell'evento.
|
properties.queueMessageTimeToLiveInSeconds
|
integer
|
Tempo del messaggio della coda di archiviazione in secondi.
|
properties.queueName
|
string
|
Nome della coda di archiviazione in un account di archiviazione che rappresenta la destinazione di una sottoscrizione dell'evento.
|
properties.resourceId
|
string
|
ID risorsa di Azure dell'account di archiviazione che contiene la coda che rappresenta la destinazione di una sottoscrizione dell'evento.
|
StringBeginsWithAdvancedFilter
StringBeginsWith Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringBeginsWith
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
StringContainsAdvancedFilter
String Contiene un filtro avanzato.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringContains
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
StringEndsWithAdvancedFilter
StringEndsWith Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringEndsWith
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
StringInAdvancedFilter
StringIn Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringIn
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
StringNotBeginsWithAdvancedFilter
StringNotBeginsWith Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringNotBeginsWith
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
StringNotContainsAdvancedFilter
StringNotContains Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringNotContains
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
StringNotEndsWithAdvancedFilter
StringNotEndsWith Advanced Filter.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringNotEndsWith
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
StringNotInAdvancedFilter
Filtro avanzato StringNotIn.
Nome |
Tipo |
Descrizione |
key
|
string
|
Campo/proprietà nell'evento in base al quale si desidera filtrare.
|
operatorType
|
string:
StringNotIn
|
Tipo di operatore usato per filtrare, ad esempio NumberIn, StringContains, BoolEquals e altri.
|
values
|
string[]
|
Set di valori di filtro.
|
systemData
Metadati relativi alla creazione e all'ultima modifica della risorsa.
Nome |
Tipo |
Descrizione |
createdAt
|
string
|
Timestamp della creazione di risorse (UTC).
|
createdBy
|
string
|
Identità che ha creato la risorsa.
|
createdByType
|
createdByType
|
Tipo di identità che ha creato la risorsa.
|
lastModifiedAt
|
string
|
Timestamp dell'ultima modifica della risorsa (UTC)
|
lastModifiedBy
|
string
|
Identità che ha modificato l'ultima volta la risorsa.
|
lastModifiedByType
|
createdByType
|
Tipo di identità che ha modificato l'ultima volta la risorsa.
|
WebHookEventSubscriptionDestination
Informazioni sulla destinazione webhook per una sottoscrizione di eventi.
Nome |
Tipo |
Valore predefinito |
Descrizione |
endpointType
|
string:
WebHook
|
|
Tipo dell'endpoint per la destinazione della sottoscrizione dell'evento.
|
properties.azureActiveDirectoryApplicationIdOrUri
|
string
|
|
ID applicazione di Azure Active Directory o URI per ottenere il token di accesso che verrà incluso come token di connessione nelle richieste di recapito.
|
properties.azureActiveDirectoryTenantId
|
string
|
|
ID tenant di Azure Active Directory per ottenere il token di accesso che verrà incluso come token di connessione nelle richieste di recapito.
|
properties.deliveryAttributeMappings
|
DeliveryAttributeMapping[]:
|
|
Dettagli dell'attributo di recapito.
|
properties.endpointBaseUrl
|
string
|
|
URL di base che rappresenta l'endpoint della destinazione di una sottoscrizione dell'evento.
|
properties.endpointUrl
|
string
|
|
URL che rappresenta l'endpoint della destinazione di una sottoscrizione dell'evento.
|
properties.maxEventsPerBatch
|
integer
|
1
|
Numero massimo di eventi per batch.
|
properties.preferredBatchSizeInKilobytes
|
integer
|
64
|
Dimensioni batch preferite in Kilobyte.
|