Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt EG to arm template #19262

Merged
merged 7 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
1) DOMAIN_ACCESS_KEY - The access key of your eventgrid account.
2) DOMAIN_TOPIC_HOSTNAME - The topic hostname. Typically it exists in the format
"https://<YOUR-TOPIC-NAME>.<REGION-NAME>.eventgrid.azure.net/api/events".
3) DOMAIN_NAME - the name of the topic
"""
import sys
import os
Expand All @@ -27,7 +26,6 @@

domain_key = os.environ["DOMAIN_ACCESS_KEY"]
domain_endpoint = os.environ["DOMAIN_TOPIC_HOSTNAME"]
domain_name = os.environ["DOMAIN_NAME"]


# authenticate client
Expand All @@ -46,7 +44,7 @@ def publish_event():
sample_members = sample(services, k=randint(1, 4)) # select random subset of team members
event = CloudEvent(
type="Azure.Sdk.Demo",
source=domain_name,
source='/azsdk/members',
rakshith91 marked this conversation as resolved.
Show resolved Hide resolved
data={"team": sample_members}
)
event_list.append(event)
Expand Down
127 changes: 127 additions & 0 deletions sdk/eventgrid/test-resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"baseName": {
"type": "String"
}
},
"variables": {
"apiVersion": "2020-04-01-preview",
"eventGridTopicName": "[concat(parameters('baseName'), 'topic')]",
"eventGridDomainName": "[concat(parameters('baseName'), 'domain')]",
"cloudeventTopicName": "[concat(parameters('baseName'), 'cloudevent-topic')]",
"customeventTopicName": "[concat(parameters('baseName'), 'customevent-topic')]",
"cloudeventDomainName": "[concat(parameters('baseName'), 'cloudevent-domain')]"
},
"resources": [
{
"type": "Microsoft.EventGrid/topics",
"apiVersion": "[variables('apiVersion')]",
"name": "[variables('eventGridTopicName')]",
"location": "[resourceGroup().location]"
},
{
"name": "[variables('eventGridDomainName')]",
"type": "Microsoft.EventGrid/domains",
"apiVersion": "[variables('apiVersion')]",
"location": "[resourceGroup().location]",
"properties": {}
},
{
"type": "Microsoft.EventGrid/topics",
"apiVersion": "[variables('apiVersion')]",
"name": "[variables('cloudeventTopicName')]",
"location": "[resourceGroup().location]",
"properties": {
"inputSchema": "CloudEventSchemaV1_0"
}
},
{
"name": "[variables('cloudeventDomainName')]",
"type": "Microsoft.EventGrid/domains",
"apiVersion": "[variables('apiVersion')]",
"location": "[resourceGroup().location]",
"properties": {
"inputSchema": "CloudEventSchemaV1_0"
}
},
{
"type": "Microsoft.EventGrid/topics",
"apiVersion": "[variables('apiVersion')]",
"name": "[variables('customeventTopicName')]",
"location": "[resourceGroup().location]",
"properties": {
"inputSchema": "CustomEventSchema",
"inputSchemaMapping": {
"inputSchemaMappingType": "Json",
"properties": {
"dataVersion": {
"defaultValue": "default",
"sourceField": "TestVersion"
},
"eventTime": {
"sourceField": "TestEventTime"
},
"eventType": {
"defaultValue": "default",
"sourceField": "TestEventType"
},
"id": {
"sourceField": "TestID"
},
"subject": {
"defaultValue": "default",
"sourceField": "TestSubject"
},
"topic": {
"sourceField": "TestTopic"
}
}
}
}
}
],
"outputs": {
"EG_TOPIC_HOSTNAME": {
"type": "string",
"value": "[reference(variables('eventGridTopicName')).endpoint]"
},
"EG_ACCESS_KEY": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.EventGrid/topics', variables('eventGridTopicName')), variables('apiVersion')).key1]"
},
"EG_DOMAIN_TOPIC_HOSTNAME": {
"type": "string",
"value": "[reference(variables('eventGridDomainName')).endpoint]"
},
"EG_DOMAIN_ACCESS_KEY": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.EventGrid/domains', variables('eventGridDomainName')), variables('apiVersion')).key1]"
},
"CLOUD_TOPIC_HOSTNAME": {
"type": "string",
"value": "[reference(variables('cloudeventTopicName')).endpoint]"
},
"CLOUD_ACCESS_KEY": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.EventGrid/topics', variables('cloudeventTopicName')), variables('apiVersion')).key1]"
},
"DOMAIN_TOPIC_HOSTNAME": {
"type": "string",
"value": "[reference(variables('cloudeventDomainName')).endpoint]"
},
"DOMAIN_ACCESS_KEY": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.EventGrid/domains', variables('cloudeventDomainName')), variables('apiVersion')).key1]"
},
"CUSTOM_SCHEMA_TOPIC_HOSTNAME": {
"type": "string",
"value": "[reference(variables('customeventTopicName')).endpoint]"
},
"CUSTOM_SCHEMA_ACCESS_KEY": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.EventGrid/topics', variables('customeventTopicName')), variables('apiVersion')).key1]"
}
}
}
12 changes: 1 addition & 11 deletions sdk/eventgrid/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ stages:
- template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
ServiceDirectory: eventgrid
DeployArmTemplate: true
BuildTargetingString: azure-eventgrid*
MatrixReplace:
- TestSamples=.*/true
Expand All @@ -13,16 +14,5 @@ stages:
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
EG_ACCESS_KEY: $(python-sdk-test-eg-access-key)
EG_TOPIC_HOSTNAME: $(python-sdk-test-eg-topic-hostname)
CLOUD_ACCESS_KEY: $(python-sdk-test-eg-cloud-access-key)
CLOUD_TOPIC_HOSTNAME: $(python-sdk-test-eg-cloud-topic-hostname)
DOMAIN_ACCESS_KEY: $(python-sdk-test-eg-domain-access-key)
DOMAIN_TOPIC_HOSTNAME: $(python-sdk-test-eg-domain-topic-hostname)
EG_DOMAIN_ACCESS_KEY: $(python-sdk-test-domain-access-key-eg)
EG_DOMAIN_TOPIC_HOSTNAME: $(python-sdk-test-domain-topic-hostname-eg)
EVENTGRID_SAS: $(python-sdk-test-eg-sas)
DOMAIN_NAME: $(python-sdk-test-eg-domain-name)
STORAGE_QUEUE_NAME: $(python-storage-queue-name)
CUSTOM_SCHEMA_ACCESS_KEY: $(python-sdk-test-eg-custom-schema-access-key)
CUSTOM_SCHEMA_TOPIC_HOSTNAME: $(python-sdk-test-custom-schema-topic-hostname)