RIC-1059: dms_cli to use flask-restx
[ric-plt/appmgr.git] / api / appmgr_rest_api.yaml
old mode 100644 (file)
new mode 100755 (executable)
index de1f9bc..15d530f
@@ -1,7 +1,23 @@
+#==================================================================================
+#  Copyright (c) 2019 AT&T Intellectual Property.
+#  Copyright (c) 2019 Nokia
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#==================================================================================
 swagger: '2.0'
 info:
   description: This is a draft API for RIC appmgr
-  version: 0.1.6
+  version: 0.3.3
   title: RIC appmgr
   license:
     name: Apache 2.0
@@ -42,38 +58,11 @@ paths:
       produces:
         - application/json
       parameters:
-        - name: xAppInfo
+        - name: XappDescriptor
           in: body
-          description: xApp information
+          description: xApp deployment info
           schema:
-            type: object
-            required:
-              - name
-            properties:
-              name:
-                type: string
-                description: Name of the xApp.
-                example: xapp-dummy
-              configName:
-                type: string
-                description: Name of the xApp configmap. Overrides the value given in Helm chart value file.
-                example: xapp-dummy-configmap
-              namespace:
-                type: string
-                description: Name of the namespace to which xApp is deployed. Overrides the value given in Helm chart value file.
-                example: ricxapps
-              serviceName:
-                type: string
-                description: Name of the service xApp is providing. Overrides the value given in Helm chart value file.
-                example: xapp-dummy-service
-              imageRepo:
-                type: string
-                description: Name of the docker repository xApp is located. Overrides the value given in Helm chart value file.
-                example: xapprepo
-              hostname:
-                type: string
-                description: Hostname for the pod. Used by messaging library. Overrides the value given in Helm chart value file.
-                example: xapp-dummy
+            $ref: '#/definitions/XappDescriptor'
       responses:
         '201':
           description: xApp successfully created
@@ -97,7 +86,7 @@ paths:
             $ref: '#/definitions/AllDeployedXapps'
         '500':
           description: Internal error
-  '/xapps/list':
+  /xapps/list:
     get:
       summary: Returns the list of all deployable xapps
       tags:
@@ -112,7 +101,7 @@ paths:
             $ref: '#/definitions/AllDeployableXapps'
         '500':
           description: Internal error
-  '/xapps/{xAppName}':
+  /xapps/{xAppName}:
     get:
       summary: Returns the status of a given xapp
       tags:
@@ -155,7 +144,7 @@ paths:
           description: Invalid xApp name supplied
         '500':
           description: Internal error
-  '/xapps/{xAppName}/instances/{xAppInstanceName}':
+  /xapps/{xAppName}/instances/{xAppInstanceName}:
     get:
       summary: Returns the status of a given xapp
       tags:
@@ -186,32 +175,6 @@ paths:
         '500':
           description: Internal error
   /config:
-    post:
-      summary: Create xApp config
-      tags:
-        - xapp
-      operationId: createXappConfig
-      consumes:
-        - application/json
-      produces:
-        - application/json
-      parameters:
-        - name: XAppConfig
-          in: body
-          description: xApp config
-          schema:
-            $ref: '#/definitions/XAppConfig'
-      responses:
-        '201':
-          description: xApp config successfully created
-          schema:
-            $ref: '#/definitions/XAppConfig'
-        '400':
-          description: Invalid input
-        '422':
-          description: Validation of configuration failed
-        '500':
-          description: Internal error
     put:
       summary: Modify xApp config
       tags:
@@ -231,7 +194,7 @@ paths:
         '200':
           description: xApp config successfully modified
           schema:
-            $ref: '#/definitions/XAppConfig'
+            $ref: '#/definitions/ConfigValidationErrors'
         '400':
           description: Invalid input
         '422':
@@ -252,22 +215,25 @@ paths:
             $ref: '#/definitions/AllXappConfig'
         '500':
           description: Internal error
-    delete:
-      summary: Delete xApp configuration
+  /config/{element}:
+    get:
+      summary: Returns the given element of the configuration
       tags:
         - xapp
-      operationId: deleteXappConfig
+      operationId: GetConfigElement
+      produces:
+        - application/json
       parameters:
-        - name: ConfigMetadata
-          in: body
-          description: xApp configuration information
-          schema:
-            $ref: '#/definitions/ConfigMetadata'
+        - name: element
+          in: path
+          description: Name of configuration element
+          required: true
+          type: string
       responses:
-        '204':
-          description: Successful deletion of xApp config
-        '400':
-          description: Invalid parameters supplied
+        '200':
+          description: successful query of config elements
+          schema:
+            $ref: '#/definitions/AllXappConfig'
         '500':
           description: Internal error
   /subscriptions:
@@ -308,7 +274,7 @@ paths:
           description: successful query of subscriptions
           schema:
             $ref: '#/definitions/allSubscriptions'
-  '/subscriptions/{subscriptionId}':
+  /subscriptions/{subscriptionId}:
     get:
       summary: Returns the information of subscription
       tags:
@@ -379,12 +345,57 @@ paths:
           description: Successful deletion of subscription
         '400':
           description: Invalid subscription supplied
+  /register:
+    post:
+      summary: Register a new xApp
+      tags:
+        - xapp
+        - registration
+      operationId: registerXapp
+      consumes:
+        - application/json
+      produces:
+        - application/json
+      parameters:
+        - name: registerRequest
+          in: body
+          description: New xApp registration
+          required: true
+          schema:
+            $ref: '#/definitions/registerRequest'
+      responses:
+        '201':
+          description: Registration successful
+        '400':
+          description: Invalid input
+  /deregister:           
+    post:
+      summary: Deregister an existing xApp
+      tags:
+        - xapp
+        - registration
+      operationId: deregisterXapp
+      consumes:
+        - application/json
+      parameters:
+        - name: deregisterRequest
+          in: body
+          description: Xapp to be unregistered
+          required: true
+          schema:
+            $ref: '#/definitions/deregisterRequest'
+      responses:
+        '204':
+          description: Successful deregistration of xApp
+        '400':
+          description: Invalid xApp name supplied
+        '500':
+          description: Internal error
 definitions:
   AllDeployableXapps:
     type: array
     items:
       type: string
-      example: "xapp-dummy"
   AllDeployedXapps:
     type: array
     items:
@@ -396,7 +407,6 @@ definitions:
     properties:
       name:
         type: string
-        example: xapp-dummy
       status:
         type: string
         description: xapp status in the RIC
@@ -409,7 +419,6 @@ definitions:
           - deleting
       version:
         type: string
-        example: 1.2.3
       instances:
         type: array
         items:
@@ -421,7 +430,6 @@ definitions:
     properties:
       name:
         type: string
-        example: xapp-dummy-6cd577d9-4v255
       status:
         type: string
         description: xapp instance status
@@ -435,51 +443,80 @@ definitions:
           - crashLoopBackOff
       ip:
         type: string
-        example: 192.168.0.1
       port:
         type: integer
-        example: 32300
       txMessages:
         type: array
         items:
           type: string
-          example: ControlIndication
       rxMessages:
         type: array
         items:
           type: string
-          example: LoadIndication
+      policies:
+         type: array
+         items:
+           type: integer
+  XappDescriptor:
+    type: object
+    required:
+      - xappName
+    properties:
+      xappName:
+        type: string
+        description: Name of the xApp in helm chart
+      helmVersion:
+        type: string
+        description: The exact xapp helm chart version to install
+      releaseName:
+        type: string
+        description: Name of the xapp to be visible in Kubernetes
+      namespace:
+        type: string
+        description: Name of the namespace to which xApp is deployed. Overrides the value given in Helm chart value file.
+      overrideFile:
+        type: object
+        description: JSON string of override file for 'helm install' command
+  XappDescriptorList:
+    type: array
+    items:
+      $ref: '#/definitions/XappDescriptor'
   ConfigMetadata:
     type: object
     required:
-      - name
-      - configName
+      - xappName
       - namespace
     properties:
-      name:
+      xappName:
         type: string
         description: Name of the xApp
-        example: xapp-dummy
-      configName:
-        type: string
-        description: Name of the config map
-        example: xapp-dummy-config-map
       namespace:
         type: string
         description: Name of the namespace
-        example: ricxapp
+  ConfigValidationError:
+    type: object
+    required:
+      - field
+      - error
+    properties:
+      field:
+        type: string
+        description: Name of the parameter
+      error:
+        type: string
+        description: Description of validation error
+  ConfigValidationErrors:
+    type: array
+    items:
+      $ref: '#/definitions/ConfigValidationError'
   XAppConfig:
     type: object
     required:
       - metadata
-      - descriptor
       - config
     properties:
       metadata:
         $ref: '#/definitions/ConfigMetadata'
-      descriptor:
-        type: object
-        description: Schema of configuration in JSON format
       config:
         type: object
         description: Configuration in JSON format
@@ -487,7 +524,18 @@ definitions:
     type: array
     items:
       $ref: '#/definitions/XAppConfig'
-  subscriptionRequest:
+  EventType:
+    type: string
+    description: Event which is subscribed
+    enum:
+      - deployed
+      - undeployed
+      - created
+      - modified
+      - deleted
+      - restarted
+      - all
+  SubscriptionData:
     type: object
     required:
       - targetUrl
@@ -499,37 +547,29 @@ definitions:
         type: string
         example: 'http://localhost:11111/apps/webhook/'
       eventType:
-        type: string
-        description: Event which is subscribed
-        enum:
-          - created
-          - deleted
-          - all
+        $ref: '#/definitions/EventType'
       maxRetries:
         type: integer
         description: Maximum number of retries
-        example: 11
       retryTimer:
         type: integer
         description: Time in seconds to wait before next retry
-        example: 22
+  subscriptionRequest:
+    type: object
+    required:
+      - data
+    properties:
+      data:
+        $ref: '#/definitions/SubscriptionData'
   subscriptionResponse:
     type: object
     properties:
       id:
         type: string
-        example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
       version:
         type: integer
-        example: 2
       eventType:
-        type: string
-        description: Event which is subscribed
-        enum:
-          - created
-          - deleted
-          - updated
-          - all
+        $ref: '#/definitions/EventType'
   allSubscriptions:
     type: array
     items:
@@ -539,41 +579,49 @@ definitions:
     properties:
       id:
         type: string
-        example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
-      targetUrl:
-        type: string
-        example: 'http://localhost:11111/apps/webhook/'
-      eventType:
-        type: string
-        description: Event which is subscribed
-        enum:
-          - created
-          - deleted
-          - updated
-          - all
-      maxRetries:
-        type: integer
-        description: Maximum number of retries
-        example: 11
-      retryTimer:
-        type: integer
-        description: Time in seconds to wait before next retry
-        example: 22
+      data:
+        $ref: '#/definitions/SubscriptionData'
   subscriptionNotification:
     type: object
     properties:
       id:
         type: string
-        example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
       version:
         type: integer
-        example: 2
       eventType:
-        type: string
-        description: Event to be notified
-        enum:
-          - created
-          - deleted
-          - updated
+        $ref: '#/definitions/EventType'
       xApps:
         $ref: '#/definitions/AllDeployedXapps'
+  registerRequest:
+    type: object
+    required:
+      - appName
+      - appInstanceName
+      - httpEndpoint
+      - rmrEndpoint
+    properties:
+      appName:
+        type: string
+      appVersion:
+        type: string
+      configPath:
+        type: string
+      appInstanceName:
+        type: string
+      httpEndpoint:
+        type: string
+      rmrEndpoint:
+        type: string
+      config:
+        type: string
+        description: Configuration in JSON string format
+  deregisterRequest:
+    type: object
+    required:
+      - appName
+      - appInstanceName
+    properties:
+      appName:
+        type: string
+      appInstanceName:
+        type: string