How to: Create Policy by OpenAPI file

The policy can be created by defining an OpenAPI file as “open-api-files” attribute in the policy declaration, under the “policy” section. “open-api-files” attribute can have one of the following values:

  • Embedding the OpenAPI file directly within the policy JSON file

    "open-api-files":
            [
                {
                    "contents": "{\"openapi\":\"3.0.0\",\"info\":{\"title\":\"Simple API\",\"description\":\"Simple example.\",\"version\":\"0.1.9\"},\"servers\":[{\"url\":\"
    http://api.example.com/v1\"},{\"url\":\"http://staging-api.example.com\"}],\"paths\":{\"/machines\":{\"get\":{\"summary\":\"Returns
    a list of machines.\",\"description\":\"Returns a list of machines.\",\"responses\":{\"200\":{\"description\":\"A JSON array of machine names\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}}}}}}}}"
                }
            ],
    
  • Providing a link to the OpenAPI file hosted on an HTTP server

    Note: HTTPS is currently not supported.

      "open-api-files":
            [
                {
                    "link": "
    http://rackerlabs.github.io/wadl2swagger/openstack/swagger/identity.yaml"
                }
            ],
    
  • Specifying a filename that references an OpenAPI file already uploaded to the Central Manager

    "open-api-files": [
      {
        "filename": "openapi.yaml"
      }
    ],