Commit 7e200e20 authored by muhammadh's avatar muhammadh
Browse files

implement links in serviceInfo in meep-app-enablement

parent e367e763
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -674,6 +674,15 @@ components:
          type: string
        state:
          $ref: '#/components/schemas/ServiceState'
        transportId:
          type: string
          description: > 
            Identifier of the platform-provided transport to be used by
            the service. Valid identifiers may be obtained using the
            "Transport information query" procedure. May be present
            in POST requests to signal the use of a platform-provided
            transport for the service, and shall be absent otherwise.
            See note 2.
        transportInfo:
          $ref: '#/components/schemas/TransportInfo'
        serializer:
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 2.1.1
- Build date: 2021-11-23T08:34:30.141026-05:00[America/Toronto]
- Build date: 2022-06-09T16:36:32.163308+05:00[Asia/Karachi]


### Running the server
+4 −2
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ type ServiceInfo struct {
	Version string `json:"version"`

	State *ServiceState `json:"state"`
	// Identifier of the platform-provided transport to be used by the service. Valid identifiers may be obtained using the \"Transport information query\" procedure. May be present in POST requests to signal the use of a platform-provided transport for the service, and shall be absent otherwise.
	TransportId string `json:"transportId,omitempty"`

	TransportInfo *TransportInfo `json:"transportInfo,omitempty"`

@@ -42,10 +44,10 @@ type ServiceInfo struct {
	ScopeOfLocality *LocalityType `json:"scopeOfLocality,omitempty"`
	// Indicate whether the service can only be consumed by the MEC applications located in the same locality (as defined by scopeOfLocality) as this  service instance.
	// manually removed the omitempty
	ConsumedLocalOnly bool `json:"consumedLocalOnly,omitempty"`
	ConsumedLocalOnly bool `json:"consumedLocalOnly"`
	// Indicate whether the service is located in the same locality (as defined by scopeOfLocality) as the consuming MEC application.
	// manually removed the omitempty
	IsLocal bool `json:"isLocal,omitempty"`
	IsLocal bool `json:"isLocal"`

	LivenessInterval int32 `json:"livenessInterval,omitempty"`

+6 −0
Original line number Diff line number Diff line
@@ -43,7 +43,13 @@ type ServiceInfoPost struct {

	ScopeOfLocality *LocalityType `json:"scopeOfLocality,omitempty"`
	// Indicate whether the service can only be consumed by the MEC applications located in the same locality (as defined by scopeOfLocality) as this  service instance.
	// manually removed the omitempty
	ConsumedLocalOnly bool `json:"consumedLocalOnly"`
	// Indicate whether the service is located in the same locality (as defined by scopeOfLocality) as the consuming MEC application.
	// manually removed the omitempty
	IsLocal bool `json:"isLocal"`

	LivenessInterval int32 `json:"livenessInterval,omitempty"`

	Links *ServiceInfoLinks `json:"_links"`
}
+11 −0
Original line number Diff line number Diff line
@@ -265,6 +265,12 @@ func appServicesPOST(w http.ResponseWriter, r *http.Request) {
		errHandlerProblemDetails(w, errStr, http.StatusBadRequest)
		return
	}
	if sInfoPost.Links != nil {
		errStr := "Links parameter should not be present in request"
		log.Error(errStr)
		errHandlerProblemDetails(w, errStr, http.StatusBadRequest)
		return
	}
	if sInfoPost.TransportInfo != nil {
		if sInfoPost.TransportInfo.Id == "" ||
			sInfoPost.TransportInfo.Name == "" ||
@@ -299,6 +305,11 @@ func appServicesPOST(w http.ResponseWriter, r *http.Request) {
		errHandlerProblemDetails(w, err.Error(), retCode)
		return
	}
	sInfo.Links = &ServiceInfoLinks{
		Self: &LinkType{
			Href: hostUrl.String() + basePath + "applications/" + appId + "/services/" + sInfo.SerInstanceId,
		},
	}

	// Send response
	w.Header().Set("Location", hostUrl.String()+basePath+"applications/"+appId+"/services/"+sInfo.SerInstanceId)