Commit d6b12736 authored by Ikram Haq's avatar Ikram Haq
Browse files

Implement the logic to create the CAPIF event subscription (POST)

parent e449c845
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -955,6 +955,15 @@ components:
          description: |
            URI to which notifications will be sent. Shall be set to the value of the "callbackReference" attribute in the "SerAvailabilityNotificationSubscription" structure.
          format: uri
    CAPIFEventFilter:
      title: CAPIFEventFilter
      type: object
      properties:
        apiIds:
          type: array
          description: Identifiers of service instances about which to report events.
          items:
            type: string
    EventSubscription:
      required:
      - events
@@ -965,6 +974,10 @@ components:
          type: array
          items:
            $ref: '#/components/schemas/CAPIFEvent'
        eventFilters:
          type: array
          items:
            $ref: '#/components/schemas/CAPIFEventFilter'
        notificationDestination:
          type: string
          description: |
+9 −0
Original line number Diff line number Diff line
@@ -68,6 +68,15 @@ func convertSerAvailabilityNotifSubToJson(obj *SerAvailabilityNotificationSubscr
	return string(jsonInfo)
}

func convertSerAvailabilityNotifSubToJson_1(obj *EventSubscription) string {
	jsonInfo, err := json.Marshal(*obj)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}

func convertJsonToSerAvailabilityNotifSub(jsonData string) *SerAvailabilityNotificationSubscription {
	var obj SerAvailabilityNotificationSubscription
	err := json.Unmarshal([]byte(jsonData), &obj)
+20 −0
Original line number Diff line number Diff line
/*
 * MEC service management realized by CAPIF APIs
 *
 * The ETSI MEC ISG MEC011 MEC Service Management realized by CAPIF APIs described using OpenAPI
 *
 * API version: 3.2.1
 * Contact: cti_support@etsi.org
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package server

// CapifEvent : The CAPIFEvent data type represents the type of events for which the subscription is made.
type CapifEvent string

// List of CAPIFEvent
const (
	AVAILABLE   CapifEvent = "SERVICE_API_AVAILABLE"
	UNAVAILABLE CapifEvent = "SERVICE_API_UNAVAILABLE"
	UPDATE      CapifEvent = "SERVICE_API_UPDATE"
)
+15 −0
Original line number Diff line number Diff line
/*
 * MEC service management realized by CAPIF APIs
 *
 * The ETSI MEC ISG MEC011 MEC Service Management realized by CAPIF APIs described using OpenAPI
 *
 * API version: 3.2.1
 * Contact: cti_support@etsi.org
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package server

type CapifEventFilter struct {
	// Identifiers of service instances about which to report events.
	ApiIds []string `json:"apiIds,omitempty"`
}
+22 −0
Original line number Diff line number Diff line
/*
 * MEC service management realized by CAPIF APIs
 *
 * The ETSI MEC ISG MEC011 MEC Service Management realized by CAPIF APIs described using OpenAPI
 *
 * API version: 3.2.1
 * Contact: cti_support@etsi.org
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package server

type EventSubscription struct {
	Events []CapifEvent `json:"events"`

	EventFilters []CapifEventFilter `json:"eventFilters,omitempty"`
	// URI selected by the MEC application instance to receive notifications on the subscribed MEC service availability information. This shall be included in both the request and the response.
	NotificationDestination string `json:"notificationDestination"`

	RequestTestNotification bool `json:"requestTestNotification,omitempty"`

	WebsocketNotifConfig string `json:"websocketNotifConfig,omitempty"`
}
Loading