-
compile plugin
-
load into gateway
-
use the below YAML:
apiVersion: tyk.tyk.io/v1alpha1
// TerminateRequest checks for a specific query parameter and terminates the request if present. | |
func TerminateRequest(rw http.ResponseWriter, r *http.Request) { | |
// Check for the query parameter | |
if value := r.URL.Query().Get("terminate"); value == "true" { | |
// Prepare the data to send in response | |
responseData := map[string]string{ | |
"message": "Request terminated by custom Tyk plugin.", | |
} | |
jsonData, err := json.Marshal(responseData) | |
if err != nil { |
var auth0OAuthClientCredMiddleware = new TykJS.TykMiddleware.NewMiddleware({}); | |
// "Cache" | |
zendeskAccessToken = { | |
token: "", | |
expiry: 0, | |
} | |
salesforceAccessToken = { | |
token: "", |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Spoon-Knife</title> | |
<LINK href="styles.css" rel="stylesheet" type="text/css"> | |
</head> | |
<body> |
compile plugin
load into gateway
use the below YAML:
apiVersion: tyk.tyk.io/v1alpha1
from locust import HttpLocust, TaskSet, task | |
def index(l): | |
l.client.get("/") | |
def stats(l): | |
l.client.get("/stats/requests") | |
class UserTasks(TaskSet): | |
# one can specify tasks like this |
sudo yum -y install docker git; \
sudo service docker start; \
sudo usermod -a -G docker ec2-user; \
sudo chkconfig docker on; \
sudo curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh -o /usr/local/bin/docker-compose; \
sudo chmod +x /usr/local/bin/docker-compose; \
sudo reboot;
Here is a quick and dirty cmd that I threw together.
UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker
now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/
sudo amazon-linux-extras install docker
sudo service docker start
swagger: '2.0' | |
info: | |
title: httpbin.org | |
description: API Management facade for a very handy and free online HTTP tool. | |
version: '1.0' | |
host: adverse-leash-gw.aws-use1.cloud-ara.tyk.io/httpbin | |
schemes: | |
- http | |
- https | |
paths: |
TOKEN=1bfa65c26a66487157941e23c0ed5a6e # User API Key / Token | |
ORG=622ba349eaf9c2000181a507 # Dashboard Org ID | |
CNAME=tyk-portal.localhost:3000 # Portal CNAME you wish to set | |
DASH_URL=http://localhost:3000 # This can be an IP, a hostname, etc, but Port is necessary if non-standard | |
# Create Portal. | |
curl -X POST $DASH_URL/api/portal/configuration \ | |
--header "Authorization: $TOKEN" \ | |
--data "{}" |