Support for XApp configuration update (new retry)
[ric-plt/appmgr.git] / api / appmgr_rest_api.yaml
diff --git a/api/appmgr_rest_api.yaml b/api/appmgr_rest_api.yaml
new file mode 100644 (file)
index 0000000..0a5cf73
--- /dev/null
@@ -0,0 +1,529 @@
+swagger: '2.0'
+info:
+  description: This is a draft API for RIC appmgr
+  version: 0.1.2
+  title: RIC appmgr
+  license:
+    name: Apache 2.0
+    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
+host: hostname
+basePath: /ric/v1
+schemes:
+  - https
+  - http
+paths:
+  /health:
+    get:
+      summary: Health check of xApp Manager
+      tags:
+        - health
+      operationId: getHealth
+      responses:
+        '200':
+          description: Status of xApp Manager is ok
+  /xapps:
+    post:
+      summary: Deploy a xapp
+      tags:
+        - xapp
+      operationId: deployXapp
+      consumes:
+        - application/json
+      produces:
+        - application/json
+      parameters:
+        - name: xAppInfo
+          in: body
+          description: xApp information
+          schema:
+            type: object
+            required:
+              - xAppName
+            properties:
+              xAppName:
+                type: string
+                description: Name of the xApp
+                example: xapp-dummy
+      responses:
+        '201':
+          description: xApp successfully created
+          schema:
+            $ref: '#/definitions/Xapp'
+        '400':
+          description: Invalid input
+        '500':
+          description: Internal error
+    get:
+      summary: Returns the status of all xapps
+      tags:
+        - xapp
+      operationId: getAllXapps
+      produces:
+        - application/json
+      responses:
+        '200':
+          description: successful query of xApps
+          schema:
+            $ref: '#/definitions/AllXapps'
+        '500':
+          description: Internal error
+  '/xapps/{xAppName}':
+    get:
+      summary: Returns the status of a given xapp
+      tags:
+        - xapp
+      operationId: getXappByName
+      produces:
+        - application/json
+      parameters:
+        - name: xAppName
+          in: path
+          description: Name of xApp
+          required: true
+          type: string
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/Xapp'
+        '400':
+          description: Invalid ID supplied
+        '404':
+          description: Xapp not found
+        '500':
+          description: Internal error
+    delete:
+      summary: Undeploy an existing xapp
+      tags:
+        - xapp
+      operationId: undeployXapp
+      parameters:
+        - name: xAppName
+          in: path
+          description: Xapp to be undeployed
+          required: true
+          type: string
+      responses:
+        '204':
+          description: Successful deletion of xApp
+        '400':
+          description: Invalid xApp name supplied
+        '500':
+          description: Internal error
+  '/xapps/{xAppName}/instances/{xAppInstanceName}':
+    get:
+      summary: Returns the status of a given xapp
+      tags:
+        - xapp
+      operationId: getXappInstanceByName
+      produces:
+        - application/json
+      parameters:
+        - name: xAppName
+          in: path
+          description: Name of xApp
+          required: true
+          type: string
+        - name: xAppInstanceName
+          in: path
+          description: Name of xApp instance to get information
+          required: true
+          type: string
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/XappInstance'
+        '400':
+          description: Invalid name supplied
+        '404':
+          description: Xapp not found
+        '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:
+        - xapp
+      operationId: ModifyXappConfig
+      consumes:
+        - application/json
+      produces:
+        - application/json
+      parameters:
+        - name: xAppConfig
+          in: body
+          description: xApp config
+          schema:
+            $ref: '#/definitions/xAppConfig'
+      responses:
+        '200':
+          description: xApp config successfully modified
+          schema:
+            $ref: '#/definitions/xAppConfig'
+        '400':
+          description: Invalid input
+        '422':
+          description: Validation of configuration failed
+        '500':
+          description: Internal error
+    get:
+      summary: Returns the configuration of all xapps
+      tags:
+        - xapp
+      operationId: getAllXappConfig
+      produces:
+        - application/json
+      responses:
+        '200':
+          description: successful query of xApp config
+          schema:
+            $ref: '#/definitions/AllXappConfig'
+        '500':
+          description: Internal error
+    delete:
+      summary: Delete xApp configuration
+      tags:
+        - xapp
+      operationId: deleteXappConfig
+      parameters:
+        - name: xAppConfigInfo
+          in: body
+          description: xApp configuration information
+          schema:
+            $ref: '#/definitions/xAppConfigInfo'
+      responses:
+        '204':
+          description: Successful deletion of xApp
+        '400':
+          description: Invalid parameters supplied
+        '500':
+          description: Internal error
+  /subscriptions:
+    post:
+      summary: Subscribe event
+      tags:
+        - xapp
+        - subscriptions
+      operationId: addSubscription
+      consumes:
+        - application/json
+      produces:
+        - application/json
+      parameters:
+        - name: subscriptionRequest
+          in: body
+          description: New subscription
+          required: true
+          schema:
+            $ref: '#/definitions/subscriptionRequest'
+      responses:
+        '200':
+          description: Subscription successful
+          schema:
+            $ref: '#/definitions/subscriptionResponse'
+        '400':
+          description: Invalid input
+    get:
+      summary: Returns all subscriptions
+      tags:
+        - xapp
+        - subscriptions
+      operationId: getSubscriptions
+      produces:
+        - application/json
+      responses:
+        '200':
+          description: successful query of subscriptions
+          schema:
+            $ref: '#/definitions/allSubscriptions'
+  '/subscriptions/{subscriptionId}':
+    get:
+      summary: Returns the information of subscription
+      tags:
+        - xapp
+        - subscriptions
+      operationId: getSubscriptionById
+      produces:
+        - application/json
+      parameters:
+        - name: subscriptionId
+          in: path
+          description: ID of subscription
+          required: true
+          type: integer
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/subscription'
+        '400':
+          description: Invalid ID supplied
+        '404':
+          description: Subscription not found
+    put:
+      summary: Modify event subscription
+      tags:
+        - xapp
+        - subscriptions
+      operationId: modifySubscription
+      consumes:
+        - application/json
+      produces:
+        - application/json
+      parameters:
+        - name: subscriptionId
+          in: path
+          description: ID of subscription
+          required: true
+          type: integer
+        - in: body
+          name: subscriptionRequest
+          description: Modified subscription
+          required: true
+          schema:
+            $ref: '#/definitions/subscriptionRequest'
+      responses:
+        '200':
+          description: Subscription modification successful
+          schema:
+            $ref: '#/definitions/subscriptionResponse'
+        '400':
+          description: Invalid input
+    delete:
+      summary: Unsubscribe event
+      tags:
+        - xapp
+        - subscriptions
+      description: ''
+      operationId: deleteSubscription
+      parameters:
+        - name: subscriptionId
+          in: path
+          description: ID of subscription
+          required: true
+          type: integer
+      responses:
+        '204':
+          description: Successful deletion of subscription
+        '400':
+          description: Invalid subscription supplied
+definitions:
+  AllXapps:
+    type: array
+    items:
+      $ref: '#/definitions/Xapp'
+  Xapp:
+    type: object
+    required:
+      - name
+    properties:
+      name:
+        type: string
+        example: xapp-dummy
+      status:
+        type: string
+        description: xapp status in the RIC
+        enum:
+          - unknown
+          - deployed
+          - deleted
+          - superseded
+          - failed
+          - deleting
+      version:
+        type: string
+        example: 1.2.3
+      instances:
+        type: array
+        items:
+          $ref: '#/definitions/XappInstance'
+  XappInstance:
+    type: object
+    required:
+      - name
+    properties:
+      name:
+        type: string
+        example: xapp-dummy-6cd577d9-4v255
+      status:
+        type: string
+        description: xapp instance status
+        enum:
+          - pending
+          - running
+          - succeeded
+          - failed
+          - unknown
+          - completed
+          - 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
+  xAppConfigInfo:
+    type: object
+    required:
+      - xAppName
+      - configMapName
+      - namespace
+    properties:
+      xAppName:
+        type: string
+        description: Name of the xApp
+        example: xapp-dummy
+      configMapName:
+        type: string
+        description: Name of the config map
+        example: xapp-dummy-config-map
+      namespace:
+        type: string
+        description: Name of the namespace
+        example: ricxapp
+  xAppConfig:
+    type: object
+    required:
+      - xAppConfigInfo
+      - configSchema
+      - configMap
+    properties:
+      xAppConfigInfo:
+        $ref: '#/definitions/xAppConfigInfo'
+      configSchema:
+        type: object
+        description: Schema of configuration in JSON format
+      configMap:
+        type: object
+        description: Configuration in JSON format
+  AllXappConfig:
+    type: array
+    items:
+      $ref: '#/definitions/xAppConfig'
+  subscriptionRequest:
+    type: object
+    required:
+      - targetUrl
+      - eventType
+      - maxRetries
+      - retryTimer
+    properties:
+      targetUrl:
+        type: string
+        example: 'http://localhost:11111/apps/webhook/'
+      eventType:
+        type: string
+        description: Event which is subscribed
+        enum:
+          - created
+          - deleted
+          - 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
+  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
+  allSubscriptions:
+    type: array
+    items:
+      $ref: '#/definitions/subscription'
+  subscription:
+    type: object
+    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
+  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
+      xApps:
+        $ref: '#/definitions/AllXapps'