This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8" ?> | |
| <configuration> | |
| <appSettings> | |
| <add key="EH_FQDN" value="{eventhubs-namespace-name}.servicebus.windows.net:9093"/> | |
| <add key="EH_CONNECTION_STRING" value="Endpoint=sb://{eventhubs-namespace-name}.servicebus.windows.net/;SharedAccessKeyName=xxxx;SharedAccessKey=xxxx"/> | |
| <add key="EH_NAME" value="{event-hub-name}"/> | |
| <add key="CA_CERT_LOCATION" value=".\cacert.pem"/> | |
| <add key="SCHEMA_GROUP" value="{schema-group-name}"/> | |
| <add key="SCHEMA_REGISTRY_URL" value="{eventshubs-namespace-name}.servicebus.windows.net"/> | |
| <add key="SCHEMA_REGISTRY_TENANT_ID" value="{tenant id}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.Extensions.Logging; | |
| using CloudNative.CloudEvents; | |
| using SongRequests.Models; | |
| using Newtonsoft.Json; | |
| namespace SongRequests.Controllers | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express') | |
| const bodyParser = require('body-parser') | |
| const app = express() | |
| app.use(bodyParser.json({ type: 'application/*+json' })); | |
| const port = 3000 | |
| app.get('/dapr/subscribe', (req, res) => { | |
| res.json([ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <inbound> | |
| <base /> | |
| <!-- Get the WebHook-Request-Origin --> | |
| <set-variable value="@(context.Request.Headers.GetValueOrDefault("WebHook-Request-Origin"))" | |
| name="webhookRequestOrigin" /> | |
| <!-- | |
| Return the response with the allowed origin | |
| and allowed rate to confirm the subscription. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class TestFuncApi | |
| { | |
| [FunctionName("TestFuncApi")] | |
| public static async Task<IActionResult> Run( | |
| [HttpTrigger(AuthorizationLevel.Anonymous, "post", "options", Route = null)] HttpRequest req, | |
| ILogger log) | |
| { | |
| if (req.Method == "OPTIONS") | |
| { | |
| // Retrieve the request origin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [HttpOptions] | |
| public async Task<IActionResult> Options() | |
| { | |
| using (var reader = new StreamReader(Request.Body, Encoding.UTF8)) | |
| { | |
| // Retrieve the validation header fields | |
| var webhookRequestOrigin = HttpContext.Request.Headers["WebHook-Request-Origin"].FirstOrDefault(); | |
| var webhookRequestCallback = HttpContext.Request.Headers["WebHook-Request-Callback"]; | |
| var webhookRequestRate = HttpContext.Request.Headers["WebHook-Request-Rate"]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "specversion" : "1.0", | |
| "id" : "b85d631a-101e-005a-02f2-cee7aa06f148", | |
| "type" : "zohan.music.request", | |
| "source" : "https://zohan.dev/music/", | |
| "subject" : "zohan/music/requests/4322", | |
| "time" : "2020-09-14T10:00:00Z", | |
| "data" : { | |
| "artist": "Gerardo", | |
| "song": "Rico Suave" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rgname={your-resource-group-name} | |
| servicebus_uri={namespace-name}.servicebus.windows.net/{queue-name} | |
| shared_access_key_name={your-shared-access-key-name} | |
| shared_access_key={your-shared-access-key} | |
| EXPIRY=${EXPIRY:=$((60 * 60 * 24))} | |
| ENCODED_URI=$(echo -n $servicebus_uri | jq -s -R -r @uri) | |
| TTL=$(($(date +%s) + $EXPIRY)) | |
| UTF8_SIGNATURE=$(printf "%s\n%s" $ENCODED_URI $TTL | iconv -t utf8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <policies> | |
| <inbound> | |
| <base /> | |
| <!-- Retrieve the secret from Key Vault using a managed identity --> | |
| <send-request mode="new" response-variable-name="secretResponse" timeout="20" ignore-error="false"> | |
| <set-url>{{vaultBaseUrl}}/secrets/{{secret-name}}/?api-version=7.0</set-url> | |
| <set-method>GET</set-method> | |
| <authentication-managed-identity resource="https://vault.azure.net" /> | |
| </send-request> |