asyncapi: 2.0.0
info:
  version: 3.0.0
  x-visibility: external
  title: Asset Management - Asset Model Notification Async API  
  description: |
    Asset Model Notification Async API provides messaging operations for receiving notifications when an Asset Model is changed. The notification will be received on the following changes to Asset Model objects:

    <b> Aspect Type </b>
    * Create Aspect Type
    * Update Aspect Type
      * Change description
      * Add variable on aspect type
      * Remove variable from aspect type
      * Rename variable on aspect type
      * Change unit on aspect variable
      * Change default value on static aspect variable
    * Delete Aspect Type

    <b> Asset Type </b>
    * Create Asset Type
    * Update Asset Type
      * Change description, and image on Asset Type
      * Rename Asset Type
      * Add Asset Type direct variable
      * Rename Asset Type direct variable
      * Change unit on Asset Type direct variable
      * Change default value on Asset Type direct variable
      * Change length on Asset Type direct variable of type STRING
      * Delete Asset Type direct Variable
      * Create Aspect on Asset Type
      * Remove Aspect from Asset Type
      * Rename Aspect on Asset Type
    * Delete Asset Type

    <b> Asset </b>
    * Create Asset
    * Update Asset
      * Change asset name, description, and location
      * Change or override the default value of direct asset type variable
      * Change or override the default value of static aspect variable
    * Delete Asset
    * Move Asset
    
    Users will receive notifications about changes to Asset Model after subscribing to given topics. The notification message will contain information like the id of the asset model object, resource (type of asset model object), action (create, update or delete), tenant id, and timestamp. The tenant and topicId will be provided as part of the header for the message. The sample message payload can be found in the examples section below.
    
    
    For more details, please see the 'Asset Management - Asset Model Notification Async API' section on the MindSphere Developer Documentation page.
    
defaultContentType: application/json

channels:
  mdsp.core.assetmanagement.v1.pubsub.aspecttype.ext.notification:
    description: The topic ID on which Asset Model notification for changes to Aspect Type will be received.
    subscribe:
      summary: Subscribe to this topic to receive an Asset Model notification message for Aspect Type create, update or delete action.
      message:
        $ref: '#/components/messages/aspectTypeNotificationData'
  mdsp.core.assetmanagement.v1.pubsub.assettype.ext.notification:
    description: The topic ID on which Asset Model notification for changes to Asset Type will be received.
    subscribe:
      summary: Subscribe to this topic to receive an Asset Model notification message for Asset Type create, update or delete action.
      message:
        $ref: '#/components/messages/assetTypeNotificationData'
  mdsp.core.assetmanagement.v1.pubsub.asset.ext.notification:
    description: The topic ID on which Asset Model notification for changes to Asset will be received.
    subscribe:
      summary: Subscribe to this topic to receive Asset Model notification message for Asset create, update, delete or move action.
      message:
        $ref: '#/components/messages/assetNotificationData'

components:
  messages:
    aspectTypeNotificationData:
      title: Aspect Type notification
      summary: Notify about create, update or delete action on Aspect Type.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/aspectTypeNotificationPayload"
    assetTypeNotificationData:
      title: Asset Type notification
      summary: Notify about create, update or delete action on Asset Type.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/assetTypeNotificationPayload"
    assetNotificationData:
      title: Asset notification
      summary: Notify about create, update, delete or move action on Asset.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/assetNotificationPayload"

  schemas:
    aspectTypeNotificationPayload:
      type: object
      properties:
        header:
          type: object
          description: The message payload will be based on the tenant.
          properties:
            topic:
              type: string
              description: Topic name to which the tenant is subscribed to receive aspect type notification
              example: mdsp.core.assetmanagement.v1.pubsub.aspecttype.ext.notification
            tenantContext:
              type: array
              minimum: 1
              description: Tenant Context of tenant
              items:
                  type: string
                  example: siemens
        aspectType:
          type: object
          description: The message payload for Aspect Type notification.
          properties:
            id:
              type: string
              description: aspect type id
              example: siemens.aspectType
            resource:
              type: string
              description: Type of an asset model resource
              example: ASPECT_TYPE
              enum:
                - ASPECT_TYPE
            action:
              type: string
              description: Action performed on an Aspect Type.
              enum:
                - CREATE
                - UPDATE
                - DELETE
            tenant:
              type: string
              description: tenant id
              example: siemens
            timestamp:
              type: string
              description: Timestamp associated with aspect type action
              example: '2022-02-08T06:24:35.629Z'

    assetTypeNotificationPayload:
      type: object
      properties:
        header:
          type: object
          description: The message payload will be based on the tenant.
          properties:
            topic:
              type: string
              description: Topic name to which the tenant is subscribed to receive asset type notification
              example: mdsp.core.assetmanagement.v1.pubsub.assettype.ext.notification
            tenantContext:
              type: array
              minimum: 1
              description: Tenant Context of tenant
              items:
                  type: string
                  example: siemens
        assetType:
          type: object
          description: The message payload for Asset Type notification.
          properties:
            id:
              type: string
              description: asset type id
              example: siemens.assetType
            resource:
              type: string
              description: Type of an asset model resource
              example: ASSET_TYPE
              enum:
                - ASSET_TYPE
            action:
              type: string
              description: Action performed on an Asset Type.
              enum:
                - CREATE
                - UPDATE
                - DELETE
            tenant:
              type: string
              description: tenant id
              example: siemens
            timestamp:
              type: string
              description: Timestamp associated with asset type action
              example: '2022-02-08T06:24:35.629Z'
    assetNotificationPayload:
      type: object
      properties:
        header:
          type: object
          description: The message payload will be based on the tenant.
          properties:
            topic:
              type: string
              description: Topic name to which the tenant is subscribed to received asset notification
              example: mdsp.core.assetmanagement.v1.pubsub.asset.ext.notification
            tenantContext:
              type: array
              minimum: 1
              description: Tenant Context of tenant
              items:
                  type: string
                  example: siemens        
        asset:
          type: object
          description: The message payload for Asset notification.
          properties:
            id:
              type: string
              description: asset id
              example: 4ed7e69d1f6747dcb96dafec7a844488
            resource:
              type: string
              description: Type of the asset model resource
              example: ASSET
            action:
              type: string
              description: Action performed on an Asset.
              enum:
                - CREATE
                - UPDATE
                - DELETE
                - MOVE
            tenant:
              type: string
              description: tenant id
              example: siemens
            timestamp:
              type: string
              description: Timestamp associated with asset action
              example: '2022-02-08T06:24:35.629Z'
