keboola/

azure-event-grid-client

Azure Event Grid客户端

v0.9.0 2023-02-17 13:42 UTC

This package is auto-updated.

Last update: 2024-09-17 17:00:45 UTC


README

PHP客户端,用于Azure Event Grid

支持以下功能

安装

composer require keboola/azure-event-grid-php-client

使用

创建客户端实例并加密数据

$client = new Client(
    new GuzzleClientFactory($logger),
    'connection-events.northeurope-1.eventgrid.azure.net'
);

开发

使用以下命令运行测试

docker-compose run --rm testsXX

其中XX是PHP版本(56 - 74),例如。

docker-compose run --rm tests70

资源设置

export EVENT_GRID_RG=testing-azure-event-grid-php-client
export EVENT_GRID_TOPIC_NAME=testing-event-grid-php-client-topic

创建资源组

az group create --name $EVENT_GRID_RG --location "northeurope"

部署事件网格

az group deployment create --resource-group $EVENT_GRID_RG --template-file arm-template.json --parameters topicName=$EVENT_GRID_TOPIC_NAME

可选地设置参数 topicName 以覆盖默认主题名称

获取端点URL

az resource show -g $EVENT_GRID_RG --resource-type "Microsoft.EventGrid/topics" -n $EVENT_GRID_TOPIC_NAME

返回 properties.endpoint,将其设置为 TEST_TOPIC_ENDPOINT

获取端点访问密钥

az eventgrid topic key list -g $EVENT_GRID_RG -n $EVENT_GRID_TOPIC_NAME

返回 key1 和 key2,将其中一个设置为 TEST_TOPIC_KEY