Skip to content
Victor Buciuc edited this page Feb 2, 2021 · 2 revisions

Step by step api spec to subscribable catalog item via the cli

First create an environment

group: management
apiVersion: v1alpha1
kind: Environment
name: vibu
title: vibu
metadata:
spec:
  description: Teams environment

Then an APIService.

kind: APIService
name: petstore
metadata:
  scope:
    kind: Environment
    name: vibu
    spec: {}

The APIService revision will have the api specification in spec.definition.value (base64 encoded).

kind: APIServiceRevision
name: petstore
metadata:
  scope:
    kind: Environment
    name: vibu
spec:
  apiService: petstore
  definition:
    type: "oas2"
    value: eyJzd2FnZ2VyIjoiMi4wIiwiaW5mbyI6eyJkZXNjcmlwdGlvbiI6IlRoaXMgaXMgYSBzYW1wbGUgc2VydmVyIFBldHN0b3JlIHNlcnZlci4gIFlvdSBjYW4gZmluZCBvdXQgbW9yZSBhYm91dCBTd2FnZ2VyIGF0IFtodHRwOi8vc3dhZ2dlci5pb10oaHR0cDovL3N3YWdnZXIuaW8pIG9yIG9uIFtpcmMuZnJlZW5vZGUubmV0LCAjc3dhZ2dlcl0oaHR0cDovL3N3YWdnZXIuaW8vaXJjLykuICBGb3IgdGhpcyBzYW1wbGUsIHlvdSBjYW4gdXNlIHRoZSBhcGkga2V5IGBzcGVjaWFsLWtleWAgdG8gdGVzdCB0aGUgYXV0aG9yaXphdGlvbiBmaWx0ZXJzLiIsInZlcnNpb24iOiIxLjAuNSIsInRpdGxlIjoiU3dhZ2dlciBQZXRzdG9yZSIsInRlcm1zT2ZTZXJ2aWNlIjoiaHR0cDovL3N3YWdnZXIuaW8vdGVybXMvIiwiY29udGFjdCI6eyJlbWFpbCI6ImFwaXRlYW1Ac3dhZ2dlci5pbyJ9LCJsaWNlbnNlIjp7Im5hbWUiOiJBcGFjaGUgMi4wIiwidXJsIjoiaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wLmh0bWwifX0sImhvc3QiOiJwZXRzdG9yZS5zd2FnZ2VyLmlvIiwiYmFzZVBhdGgiOiIvdjIiL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IjoiYm9vbGVhbiJ9fSwieG1sIjp7Im5hbWUiOiJPcmRlciJ9fSwiVXNlciI6eyJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJpZCI6eyJ0eXBlIjoiaW50ZWdlciIsImZvcm1hdCI6ImludDY0In0sInVzZXJuYW1lIjp7InR5cGUiOiJzdHJpbmcifSwiZmlyc3ROYW1lIjp7InR5cGUiOiJzdHJpbmcifSwibGFzdE5hbWUiOnsidHlwZSI6InN0cmluZyJ9LCJlbWFpbCI6eyJ0eXBlIjoic3RyaW5nIn0sInBhc3N3b3JkIjp7InR5cGUiOiJzdHJpbmcifSwicGhvbmUiOnsidHlwZSI6InN0cmluZyJ9LCJ1c2VyU3RhdHVzIjp7InR5cGUiOiJpbnRlZ2VyIiwiZm9ybWF0IjoiaW50MzIiLCJkZXNjcmlwdGlvbiI6IlVzZXIgU3RhdHVzIn19LCJ4bWwiOnsibmFtZSI6IlVzZXIifX19LCJleHRlcm5hbERvY3MiOnsiZGVzY3JpcHRpb24iOiJGaW5kIG91dCBtb3JlIGFib3V0IFN3YWdnZXIiLCJ1cmwiOiJodHRwOi8vc3dhZ2dlci5pbyJ9fQ==

An APIServiceInstance will hold the endpoints where an APIServiceRevision is exposed.

kind: APIServiceInstance
name: petstore
metadata:
  scope:
    kind: Environment
    name: vibu
spec:
  apiServiceRevision: petstore
  endpoint:
    - host: "petstore.com"
      port: 443
      protocol: https
      routing:
        basePath: "/v1"
amplify central apply -f /tmp/env.yaml
amplify central apply -f /tmp/apisvc.yaml
amplify central apply -f /tmp/apiservicerev.yaml
amplify central apply -f /tmp/apiserviceins.yaml 

A SubscriptionDefinition specifies what params are needed from a consumer to subscribe.

A ConsumerInstance publishes an APIServiceInstance as a catalog item. It can optionally link a SubscriptionDefinition to enable subscribing on the catalog item.

apiVersion: v1alpha1
kind: ConsumerSubscriptionDefinition
name: subsdef
metadata:
  scope:
    kind: Environment
    name: vibu
spec:
  schema:
    properties:
      - key: profile
        value: 
          type: object
          properties:
            param1:
              type: string
---
apiVersion: v1alpha1
kind: ConsumerInstance
name: consumerinst1
title: consumerinst1 title
metadata:
  scope:
    kind: Environment
    name: vibu
tags:
- cli
- consumerinst
spec:
  name: Consumer Instance Name
  apiServiceInstance: petstore
  description: My petstore
  visibility: RESTRICTED
  version: "1.0"
  state: PUBLISHED
  status: statusValue
  tags:
  - instance
  - cli
  documentation: Petstore api
  subscription:
    enabled: true
    subscriptionDefinition: subsdef
    autoSubscribe: false

Once the ConsumerInstance is created you should see a CatalogItem in Catalog and be able to subscribe.

amplify central apply -f /tmp/consinst.yaml

Step by step api exposing with api-key auth and acl plugin

First create a service to represent your backend

POST http://localhost:8001/services
Content-Type: application/json

{
"name": "httpbin",
"url": "http://httpbin.org"
}

Create a route to expose the service via kong.

POST http://localhost:8001/services/httpbin/routes
Content-Type: application/json

{
"name": "httpbin",
"paths": ["/httpbin"],
"hosts": ["localhost"]
}

At this point the service should be available

GET http://localhost:8000/httpbin/get

Add the key-auth auth plugin to the route.

POST http://localhost:8001/routes/httpbin/plugins
Content-Type: application/json

{
"name": "key-auth"
}

At this point you should get a 401

GET http://localhost:8000/httpbin/get

To access the api you'd need to create a consumer.

POST http://localhost:8001/consumers
Content-Type: application/json

{
"username": "vbuciuc"
}

And then create a credential for the consumer:

POST http://localhost:8001/consumers/vbuciuc/key-auth
Content-Type: application/json

{}

At this point you should be able to access the api again by putting the api-key as an url parameter.

GET http://localhost:8000/httpbin/get?apikey=YThJ3CHDTkHgmETG49u5J9uwQmiek8oM

Continuing with ACL, first add the plugin on the route.

POST http://localhost:8001/routes/httpbin/plugins
Content-Type: application/json

{
"name": "acl",
"config": {"allow": ["httpbin.subscribers"]}
}

After this you'll get an Unauthorized response even if you pass the right apikey.

GET http://localhost:8000/httpbin/get?apikey=YThJ3CHDTkHgmETG49u5J9uwQmiek8oM

Add the consumer to the right acl group

POST http://localhost:8001/consumers/vbuciuc/acls
Content-Type: application/x-www-form-urlencoded

group=httpbin.subscribers
GET http://localhost:8000/httpbin/get?apikey=YThJ3CHDTkHgmETG49u5J9uwQmiek8oM

Any api with the key-auth plugin will be accessible unless it also has the acl plugin

New service for petstore.

POST :aurl/services
Content-Type: application/json

{
 "name": "petstore",
 "url": "http://petstore.swagger.io/v2"
}

New route to expose it:

POST http://localhost:8001/services/petstore/routes
Content-Type: application/json

{
"name": "petstore",
"paths": ["/petstore"],
"hosts": ["localhost"]
}

Add an key-auth plugin:

POST :aurl/routes/petstore/plugins
Content-Type: application/json

{
"name": "key-auth"
}

It should be accesible by the previously created consumer since it already has an api-key

GET http://localhost:8000/petstore/store/inventory?apikey=YThJ3CHDTkHgmETG49u5J9uwQmiek8oM

But add the acl:

POST http://localhost:8001/routes/petstore/plugins
Content-Type: application/json

{
"name": "acl",
"config": {"allow": ["petstore.subscribers"]}
}

And you won't be able to access it anymore:

GET http://localhost:8000/petstore/store/inventory?apikey=YThJ3CHDTkHgmETG49u5J9uwQmiek8oM