Contact Us 1-800-596-4880

Troubleshooting with the Admin API

Anypoint Flex Gateway includes one administration interface:

  • Flex Gateway Admin API

The Flex Gateway Admin API enables you to query for information related to a gateway’s API instances, services, and configurations. The related CLI includes the following command:

  • flexctl dump

As an example, the following inline configuration snippet defines a single API instance named jsonplaceholder-api in the default namespace (it remains default because namespace is not explicitly defined.) Additionally, the snippet defines one included policy: http-basic-authentication-flex.

Configuration Example

apiVersion: gateway.mulesoft.com/v1alpha1
kind: ApiInstance
metadata:
  name: jsonplaceholder-api
spec:
  address: http://0.0.0.0:8080
  services:
    jsonplaceholder:
      address: https://jsonplaceholder.typicode.com:443/
      routes:
        - rules:
            - path: /api(/users/.*)
            - path: /api(/comments/.*)
  policies:
    - policyRef:
        name: http-basic-authentication-flex
      config:
        username: chris
        password: admin

API Instances

To see a JSON representation of your API instance, execute the flexctl dump command. The CLI creates a file called api-instances.json.

When running in a Docker container, execute this command in the container itself.

cat api-instances.json

The API returns the following:

[
   {
      "address":"http://0.0.0.0:8080",
      "kind":"ApiInstance",
      "name":"jsonplaceholder-api",
      "namespace":"default",
      "policies":[
         {
            "config":{
               "password":"admin",
               "username":"chris"
            },
            "extension":{
               "kind":"Extension",
               "name":"http-basic-authentication-flex",
               "namespace":"default"
            },
            "kind":"Policy",
            "name":"jsonplaceholder-api-http-basic-authentication-flex-1",
            "namespace":"default"
         },
         {
            "config":{
               "destinationRef":{
                  "kind":"Service",
                  "name":"jsonplaceholder-api-jsonplaceholder",
                  "namespace":"default"
               }
            }
            "extension":{
               "kind":"Extension",
               "name":"route",
               "namespace":"default"
            },
            "kind":"Policy",
            "name":"jsonplaceholder-api-jsonplaceholder-route-1",
            "namespace":"default",
            "order":50,
            "rules":[
               {
                  "path":"/api(/users/.*)"
               },
               {
                  "path":"/api(/comments/.*)"
               }
            ]
         },
         {
            "extension":{
               "kind":"Extension",
               "name":"envoy.filters.http.router",
               "namespace":"default"
            },
            "kind":"Policy",
            "name":"envoy.filters.http.router",
            "namespace":"default",
            "order":2147483647
         }
      ]
   }
]

Services

To see a JSON representation of defined services, execute the flexctl dump command. The CLI creates a file called services.json.

When running in a Docker container, execute this command in the container itself.

cat services.json

The API returns the following:

[
   {
      "address":"https://jsonplaceholder.typicode.com:443/",
      "kind":"Service",
      "name":"jsonplaceholder-api-jsonplaceholder",
      "namespace":"default"
   }
]

Config Dump

To see a JSON representation of the complete configuration definition, execute the flexctl dump command. The CLI creates a file called configuration.json.

When running in a Docker container, execute this command in the container itself.

cat configuration.json

The API returns something like the following:

{
  "internalMetrics": {
    "enabled": false
  },
  "logging": {},
  "platformConnection": {
    "anypoint": {
      "url": "https://anypoint.mulesoft.com"
    },
    "environment": {
      "cluster_id": "4aa281e9-1a1d-4c56-8669-2d887b2e1938",
      "env_id": "ad067f80-69ee-4abb-9d05-bec98ece1e20",
      "org_id": "1caa0b9b-4f4d-43c4-a1b6-f925a8c77baa"
    },
    "logging": {
      "certificate": {
        "cert": "demo-local.pem",
        "key": "demo-local.key"
      },
      "url": "https://logging.ingestion.us-east-1.msap.io/ingestion/api/v1/logging"
    },
    "metering": {
      "certificate": {
        "cert": "demo-local.pem",
        "key": "demo-local.key"
      },
      "url": "https://metering.ingestion.us-east-1.msap.io/ingestion/api/v1/metering"
    },
    "mode": "offline",
    "monitoring": {
      "certificate": {
        "cert": "demo-local.pem",
        "key": "demo-local.key"
      },
      "url": "https://monitoring.ingestion.us-east-1.msap.io/ingestion/api/v1/monitoring"
    },
    "runtimeEvents": {
      "certificate": {
        "cert": "demo-local.pem",
        "key": "demo-local.key"
      },
      "url": "https://anypoint.mulesoft.com/apiruntime/v1/events"
    }
  },
  "resourceLimits": {
    "apiInstances": 100,
    "policies": 400
  },
  "sharedStorage": {},
  "version": "1.1.0"
}