Skip to content

Instantly share code, notes, and snippets.

View tomkerkhove's full-sized avatar
🤓
Writing bugs faster than his own shadow.

Tom Kerkhove tomkerkhove

🤓
Writing bugs faster than his own shadow.
View GitHub Profile
[Route("api/v1/health")]
public class HealthController : Controller
{
private readonly HealthCheckService _healthCheckService;
public HealthController(HealthCheckService healthCheckService)
{
_healthCheckService = healthCheckService;
}
/// <summary>
{
"openapi": "3.0.1",
"info": {
"title": "Echo API",
"version": "1.0"
},
"servers": [
{
"url": "http://echoapi.cloudapp.net/api"
},
syntax = "proto3";
service TestService {
rpc Unary(Foo) returns (Foo);
rpc ClientStreaming(stream Foo) returns (Foo);
rpc ServerStreaming(Foo) returns (stream Foo);
rpc Duplex(stream Foo) returns (stream Foo);
}
message Foo {
{
"openapi": "3.0.1",
"info": {
"title": "Performance Testing API",
"version": "1.0"
},
"servers": [
{
"url": "http://apim-sandbox-cloud-native.azure-api.net/echo"
},
@tomkerkhove
tomkerkhove / advanced-frament.policy.xml
Last active August 9, 2023 12:09
Throttling by product, but applied on operation-level
<!--
IMPORTANT:
- Policy fragment are included as-is whenever they are referenced.
- If using variables. Ensure they are setup before use.
- Copy and paste your code here or simply start coding
-->
<fragment>
<rate-limit-by-key calls="@(int.Parse((string)context.Variables["amountOfCalls"]))" renewal-period="@(int.Parse((string)context.Variables["renewalPeriod"]))" counter-key="@(context.Subscription.Id)" remaining-calls-variable-name="remainingCallsPerSubscription" />
</fragment>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE order [
<!ENTITY myExternalEntity SYSTEM "expressions.json">
]>
<order>&myExternalEntity;</order>
{
"openapi": "3.0.1",
"info": {
"title": "Echo API",
"version": "1.0"
},
"servers": [
{
"url": "http://apim-sandbox-cloud-native.azure-api.net/echo"
},
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {scaled-object-name}
spec:
scaleTargetRef:
name: foo
minReplicaCount: 1 # Optional. Default: 0
maxReplicaCount: 100 # Optional. Default: 100
triggers:
@tomkerkhove
tomkerkhove / test.cs
Last active August 23, 2022 04:58
Writing integration tests for Azure Event Grid - Test
[Fact]
public async Task Publish_ValidParameters_Succeeds()
{
// Arrange
var topicEndpoint = "<topic-endpoint>";
var endpointKey = "<endpoint-key>";
const string eventSubject = "integration-test";
const string eventType = "integration-test-event";
const string licensePlate = "1-TOM-337";
var eventId = Guid.NewGuid().ToString();