{
  "basePath": "/api/v1",
  "definitions": {
    "handler.App": {
      "properties": {
        "access_ports": {
          "description": "Application port to be exposed with ingress in format <protocol:port>.\nNecessary only when manifest is generated automatically. Otherwise, all\nthe ports has to be set up manually in YAML manifest.",
          "example": "tcp:80",
          "type": "string"
        },
        "allow_serverless": {
          "type": "boolean"
        },
        "created_at": {
          "description": "Timestamp, format RFC3339.",
          "type": "string"
        },
        "defaultFlavor": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Flavor"
            }
          ],
          "description": "Default resource config to be used."
        },
        "deployment": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.DeploymentType"
            }
          ],
          "example": "kubernetes"
        },
        "global_id": {
          "description": "Combination of key fields (local-<key.name><key.version><key.organisation>).",
          "type": "string"
        },
        "image_path": {
          "description": "Docker registry URL (e.g. docker.io/library/nginx:latest)",
          "type": "string"
        },
        "image_type": {
          "$ref": "#/definitions/handler.ImageType"
        },
        "key": {
          "$ref": "#/definitions/handler.AppKey"
        },
        "serverless_config": {
          "$ref": "#/definitions/handler.ServerlessConfig"
        },
        "updated_at": {
          "description": "Timestamp, format RFC3339.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "handler.AppInst": {
      "properties": {
        "app_key": {
          "$ref": "#/definitions/handler.AppKey"
        },
        "cloudlet_loc": {
          "$ref": "#/definitions/handler.CloudletLoc"
        },
        "created_at": {
          "type": "string"
        },
        "flavor": {
          "$ref": "#/definitions/handler.Flavor"
        },
        "ingress_url": {
          "type": "string"
        },
        "key": {
          "$ref": "#/definitions/handler.AppInstKey"
        },
        "state": {
          "$ref": "#/definitions/handler.AppInstState"
        },
        "unique_id": {
          "description": "Combination of key fields (<key.organisation>-<key.name>-<cloudletKey.name>-<cloudletKey.organisation>).",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "handler.AppInstKey": {
      "properties": {
        "cloudlet_key": {
          "$ref": "#/definitions/handler.CloudletKey"
        },
        "name": {
          "type": "string"
        },
        "organization": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "handler.AppInstState": {
      "enum": [
        "Ready"
      ],
      "type": "string",
      "x-enum-varnames": [
        "AppInstStateReady"
      ]
    },
    "handler.AppKey": {
      "description": "is a unique identifier.",
      "properties": {
        "name": {
          "type": "string"
        },
        "organization": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "handler.CloudletKey": {
      "properties": {
        "name": {
          "type": "string"
        },
        "organization": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "handler.CloudletLoc": {
      "properties": {
        "latitude": {
          "type": "number"
        },
        "longitude": {
          "type": "number"
        }
      },
      "type": "object"
    },
    "handler.DeploymentType": {
      "enum": [
        "kubernetes"
      ],
      "type": "string",
      "x-enum-varnames": [
        "DeploymentTypeKubernetes"
      ]
    },
    "handler.Flavor": {
      "description": "is a default configuration is applied to app if no configuration\nis provided (e.g. in serverless config). Configuration can be checked at /auth/ctrl/CreateApp",
      "properties": {
        "name": {
          "$ref": "#/definitions/handler.FlavorName"
        }
      },
      "type": "object"
    },
    "handler.FlavorName": {
      "enum": [
        "EU.small",
        "EU.medium",
        "EU.big",
        "EU.large"
      ],
      "type": "string",
      "x-enum-varnames": [
        "DefaultFlavorNameEUSmall",
        "DefaultFlavorNameEUMedium",
        "DefaultFlavorNameEUBig",
        "DefaultFlavorNameEULarge"
      ]
    },
    "handler.ImageType": {
      "enum": [
        "docker"
      ],
      "type": "string",
      "x-enum-varnames": [
        "ImageTypeDocker"
      ]
    },
    "handler.Region": {
      "enum": [
        "EU"
      ],
      "type": "string",
      "x-enum-varnames": [
        "RegionEU"
      ]
    },
    "handler.RequestCreateApp": {
      "description": "necessary App details to create an entity.",
      "properties": {
        "app": {
          "properties": {
            "access_ports": {
              "description": "Application port to be exposed with ingress in format <protocol:port>.\nNecessary only when manifest is generated automatically. Otherwise,\nall the ports has to be set up manually in YAML manifest.",
              "example": "tcp:80",
              "type": "string"
            },
            "allow_serverless": {
              "type": "boolean"
            },
            "defaultFlavor": {
              "allOf": [
                {
                  "$ref": "#/definitions/handler.Flavor"
                }
              ],
              "description": "Default resource config to be used."
            },
            "deployment": {
              "allOf": [
                {
                  "$ref": "#/definitions/handler.DeploymentType"
                }
              ],
              "example": "kubernetes"
            },
            "deployment_generator": {
              "description": "Technical field. Required for providing custom manifest",
              "type": "string"
            },
            "deployment_manifest": {
              "description": "Kubernetes manifest. ACCEPTS ONLY DEPLOYMENTS AND SERVICES.",
              "type": "string"
            },
            "image_path": {
              "description": "Docker registry URL (e.g. docker.io/library/nginx:latest)",
              "type": "string"
            },
            "image_type": {
              "$ref": "#/definitions/handler.ImageType"
            },
            "key": {
              "$ref": "#/definitions/handler.AppKey"
            },
            "serverless_config": {
              "$ref": "#/definitions/handler.ServerlessConfig"
            }
          },
          "type": "object"
        },
        "region": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Region"
            }
          ],
          "description": "Region to create instance at.",
          "example": "EU"
        }
      },
      "type": "object",
      "example": {
        "appWithoutManifest": {
          "region": "EU",
          "app": {
            "key": {
              "organization": "DeveloperOrg",
              "name": "test-app-without-manifest",
              "version": "1.0"
            },
            "access_ports": "tcp:80",
            "serverless_config": {},
            "deployment": "kubernetes",
            "image_type": "Docker",
            "image_path": "docker.io/library/nginx:latest",
            "allow_serverless": true,
            "defaultFlavor": {
              "name": "EU.small"
            }
          }
        },
        "appWitManifest": {
          "region": "EU",
          "app": {
            "key": {
              "organization": "DeveloperOrg",
              "name": "test-app-without-manifest",
              "version": "1.0"
            },
            "serverless_config": {},
            "deployment": "kubernetes",
            "image_type": "Docker",
            "image_path": "docker.io/library/nginx:latest",
            "allow_serverless": true,
            "defaultFlavor": {
              "name": "EU.small"
            },
            "deployment_manifest": "apiVersion: v1\nkind: Service\nmetadata:\n  name: example-app-tcp\n  labels:\n    run: example-app\nspec:\n  type: LoadBalancer\n  ports:\n  - name: tcp8080\n    protocol: TCP\n    port: 80\n    targetPort: 80\n  selector:\n    run: example-app\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: example-app-deployment\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: example-app\n  template:\n    metadata:\n      labels:\n        run: example-app\n        mexDeployGen: kubernetes-basic\n    spec:\n      volumes:\n      imagePullSecrets:\n      - name: mtr.devops.telekom.de\n      containers:\n      - name: example-app\n        image: docker.io/library/nginx:latest\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 80\n          protocol: TCP\n",
            "deployment_generator": "kubernetes-basic"
          }
        }
      }
    },
    "handler.RequestCreateAppInst": {
      "properties": {
        "appinst": {
          "properties": {
            "app_key": {
              "$ref": "#/definitions/handler.AppKey"
            },
            "key": {
              "$ref": "#/definitions/handler.AppInstKey"
            }
          },
          "type": "object"
        },
        "region": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Region"
            }
          ],
          "description": "Region to create instance at.",
          "example": "EU"
        }
      },
      "type": "object"
    },
    "handler.RequestCreateAppInstMessage": {
      "properties": {
        "message": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "handler.RequestDeleteApp": {
      "properties": {
        "key": {
          "$ref": "#/definitions/handler.AppKey"
        },
        "region": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Region"
            }
          ],
          "example": "EU"
        }
      },
      "type": "object"
    },
    "handler.RequestDeleteAppInst": {
      "properties": {
        "key": {
          "$ref": "#/definitions/handler.AppInstKey"
        }
      },
      "type": "object"
    },
    "handler.RequestShowApp": {
      "properties": {
        "access_ports": {
          "description": "Application port to be exposed with ingress. Necessary only when\nmanifest is generated automatically. Otherwise, all the ports has to be\nset up manually in YAML manifest",
          "example": "tcp:80",
          "type": "string"
        },
        "defaultFlavor": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Flavor"
            }
          ],
          "description": "Default resource config to be used."
        },
        "deployment": {
          "$ref": "#/definitions/handler.DeploymentType"
        },
        "image_path": {
          "description": "Docker registry URL (e.g. docker.io/library/nginx:latest)",
          "type": "string"
        },
        "image_type": {
          "$ref": "#/definitions/handler.ImageType"
        },
        "key": {
          "$ref": "#/definitions/handler.AppKey"
        },
        "region": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Region"
            }
          ],
          "example": "EU"
        }
      },
      "type": "object"
    },
    "handler.RequestShowAppInst": {
      "properties": {
        "app_key": {
          "$ref": "#/definitions/handler.AppKey"
        },
        "key": {
          "$ref": "#/definitions/handler.AppInstKey"
        },
        "region": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Region"
            }
          ],
          "description": "Region to create instance at.",
          "example": "EU"
        },
        "state": {
          "$ref": "#/definitions/handler.AppInstState"
        }
      },
      "type": "object"
    },
    "handler.RequestUpdateApp": {
      "properties": {
        "access_ports": {
          "description": "Can be updated only if manifest is generated by EdgeXR.",
          "example": "tcp:80",
          "type": "string"
        },
        "defaultFlavor": {
          "$ref": "#/definitions/handler.Flavor"
        },
        "image_path": {
          "description": "Docker registry URL (e.g. docker.io/library/nginx:latest)",
          "type": "string"
        },
        "key": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.AppKey"
            }
          ],
          "description": "Immutable."
        },
        "region": {
          "allOf": [
            {
              "$ref": "#/definitions/handler.Region"
            }
          ],
          "description": "Immutable.",
          "example": "EU"
        }
      },
      "type": "object"
    },
    "handler.RequestUpdateAppInst": {
      "properties": {
        "flavor": {
          "$ref": "#/definitions/handler.Flavor"
        },
        "key": {
          "$ref": "#/definitions/handler.AppInstKey"
        }
      },
      "type": "object"
    },
    "handler.ServerlessConfig": {
      "description": "is a default configuration is applied to app if no configuration\nis provided (e.g. in serverless config). Configuration can be checked at /auth/ctrl/CreateApp",
      "properties": {
        "min_replicas": {
          "description": "number of replicas (at least 1).",
          "type": "integer"
        },
        "ram": {
          "description": "RAM in MB.",
          "type": "integer"
        },
        "vcpus": {
          "description": "Virtual CPUs.",
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "externalDocs": {
    "description": "OpenAPI",
    "url": "https://swagger.io/resources/open-api/"
  },
  "info": {
    "contact": {},
    "description": "# Introduction\n The Master Controller (MC) serves as the central\ngateway for orchestrating edge applications and provides several services to both\napplication developers and operators. For application developers, these APIs allow\nthe management and monitoring of deployments for edge applications. For infrastructure\noperators, these APIs provide ways to manage and monitor the usage of cloudlet\ninfrastructures. Both developers and operators can take advantage of these APIS\nto manage users within the Organization. ## Important note.\n API can return more\nfields than provided in the specification. Specification is a main source of truth.",
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "title": "Edge Connect API",
    "version": "2.0"
  },
  "paths": {
    "/": {
      "get": {
        "description": "Returns OK when server is set-up and running.",
        "responses": {
          "200": {
            "description": "OK\" \"ok",
            "schema": {
              "type": "string"
            }
          }
        },
        "summary": "Show server is running",
        "tags": [
          "monitoring"
        ]
      }
    },
    "/auth/ctrl/CreateApp": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "Creates App specification, validating of the params. Please, read\ndescription of the fields since not every one is required in every configuration.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestCreateApp"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Creates App specification.",
        "tags": [
          "App"
        ]
      }
    },
    "/auth/ctrl/CreateAppInst": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "Create App instance on the cloudlet. Requests can be done as web\nsocket or regular http request returning all the steps as array of json messages.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestCreateAppInst"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "items": {
                "$ref": "#/definitions/handler.RequestCreateAppInstMessage"
              },
              "type": "array"
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Create app instance.",
        "tags": [
          "AppInst"
        ]
      }
    },
    "/auth/ctrl/DeleteApp": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "Update app specification with limitation to the key.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestDeleteApp"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Update app specs.",
        "tags": [
          "App"
        ]
      }
    },
    "/auth/ctrl/DeleteAppInst": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "Deletes app instance at the specified cloudlet.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestDeleteAppInst"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Deletes app instance by key.",
        "tags": [
          "AppInst"
        ]
      }
    },
    "/auth/ctrl/ShowApp": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "returns app specifications for provided region. Filter is done\nwith providing app fields from the model.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestShowApp"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "items": {
                "$ref": "#/definitions/handler.App"
              },
              "type": "array"
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Shows list of apps for the region.",
        "tags": [
          "App"
        ]
      }
    },
    "/auth/ctrl/ShowAppInst": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "Returns app instances for provided region. Filter is done with\nproviding app instances fields from the model.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestShowAppInst"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "items": {
                "$ref": "#/definitions/handler.AppInst"
              },
              "type": "array"
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Shows list of app instances for the region.",
        "tags": [
          "AppInst"
        ]
      }
    },
    "/auth/ctrl/UpdateApp": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "Update app specification with limitation to the key.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestUpdateApp"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Update app specs.",
        "tags": [
          "App"
        ]
      }
    },
    "/auth/ctrl/UpdateAppInst": {
      "post": {
        "consumes": [
          "application/json"
        ],
        "description": "Update app instance by key with limited set of fields.",
        "parameters": [
          {
            "description": "body",
            "in": "body",
            "name": "_",
            "required": true,
            "schema": {
              "$ref": "#/definitions/handler.RequestUpdateAppInst"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "summary": "Update app instance by key.",
        "tags": [
          "AppInst"
        ]
      }
    }
  },
  "securityDefinitions": {
    "Bearer": {
      "type": "basic"
    }
  },
  "swagger": "2.0"
}
