GET https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/ExampleStorageAccount/providers/Microsoft.EventGrid/eventTypes?api-version=2022-06-15
import com.azure.core.util.Context;
/** Samples for Topics ListEventTypes. */
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_ListEventTypes.json
*/
/**
* Sample code: Topics_ListEventTypes.
*
* @param manager Entry point to EventGridManager.
*/
public static void topicsListEventTypes(com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager
.topics()
.listEventTypes("examplerg", "Microsoft.Storage", "storageAccounts", "ExampleStorageAccount", 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 topics_list_event_types.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="5b4b650e-28b9-4790-b3ab-ddbd88d727c4",
)
response = client.topics.list_event_types(
resource_group_name="examplerg",
provider_namespace="Microsoft.Storage",
resource_type_name="storageAccounts",
resource_name="ExampleStorageAccount",
)
for item in response:
print(item)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_ListEventTypes.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/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/Topics_ListEventTypes.json
func ExampleTopicsClient_NewListEventTypesPager() {
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)
}
pager := clientFactory.NewTopicsClient().NewListEventTypesPager("examplerg", "Microsoft.Storage", "storageAccounts", "ExampleStorageAccount", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.EventTypesListResult = armeventgrid.EventTypesListResult{
// Value: []*armeventgrid.EventType{
// {
// Name: to.Ptr("Microsoft.Storage.BlobCreated"),
// Type: to.Ptr("Microsoft.EventGrid/topicTypes/eventTypes"),
// ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts/eventTypes/Microsoft.Storage.BlobCreated"),
// Properties: &armeventgrid.EventTypeProperties{
// Description: to.Ptr("Raised when a blob is created."),
// DisplayName: to.Ptr("Blob Created"),
// SchemaURL: to.Ptr("tbd"),
// },
// },
// {
// Name: to.Ptr("Microsoft.Storage.BlobDeleted"),
// Type: to.Ptr("Microsoft.EventGrid/topicTypes/eventTypes"),
// ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts/eventTypes/Microsoft.Storage.BlobDeleted"),
// Properties: &armeventgrid.EventTypeProperties{
// Description: to.Ptr("Raised when a blob is deleted."),
// DisplayName: to.Ptr("Blob Deleted"),
// SchemaURL: to.Ptr("tbd"),
// },
// }},
// }
}
}
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 List event types for a topic.
*
* @summary List event types for a topic.
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_ListEventTypes.json
*/
async function topicsListEventTypes() {
const subscriptionId =
process.env["EVENTGRID_SUBSCRIPTION_ID"] || "5b4b650e-28b9-4790-b3ab-ddbd88d727c4";
const resourceGroupName = process.env["EVENTGRID_RESOURCE_GROUP"] || "examplerg";
const providerNamespace = "Microsoft.Storage";
const resourceTypeName = "storageAccounts";
const resourceName = "ExampleStorageAccount";
const credential = new DefaultAzureCredential();
const client = new EventGridManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.topics.listEventTypes(
resourceGroupName,
providerNamespace,
resourceTypeName,
resourceName
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue