This repository has been archived by the owner on Apr 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
api_nf_instance_id_document.go
87 lines (71 loc) · 2.14 KB
/
api_nf_instance_id_document.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* NSSF NSSAI Availability
*
* NSSF NSSAI Availability Service
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package NSSAIAvailability
import (
"net/http"
"github.com/gin-gonic/gin"
"free5gc/lib/http_wrapper"
. "free5gc/lib/openapi/models"
"free5gc/src/nssf/nssf_handler"
"free5gc/src/nssf/nssf_handler/nssf_message"
"free5gc/src/nssf/plugin"
"free5gc/src/nssf/util"
)
func ApiNfInstanceIdDocumentDelete(c *gin.Context) {
var request interface{}
req := http_wrapper.NewRequest(c.Request, request)
req.Params["nfId"] = c.Param("nfId")
message := nssf_message.NewMessage(nssf_message.NSSAIAvailabilityDelete, req)
nssf_handler.SendMessage(message)
rsp := <-message.ResponseChan
httpResponse := rsp.HttpResponse
c.JSON(httpResponse.Status, httpResponse.Body)
}
func ApiNfInstanceIdDocumentPatch(c *gin.Context) {
var request plugin.PatchDocument
err := c.ShouldBindJSON(&request)
if err != nil {
problemDetail := "[Request Body] " + err.Error()
d := ProblemDetails{
Title: util.MALFORMED_REQUEST,
Status: http.StatusBadRequest,
Detail: problemDetail,
}
c.JSON(http.StatusBadRequest, d)
return
}
req := http_wrapper.NewRequest(c.Request, request)
req.Params["nfId"] = c.Param("nfId")
message := nssf_message.NewMessage(nssf_message.NSSAIAvailabilityPatch, req)
nssf_handler.SendMessage(message)
rsp := <-message.ResponseChan
httpResponse := rsp.HttpResponse
c.JSON(httpResponse.Status, httpResponse.Body)
}
func ApiNfInstanceIdDocumentPut(c *gin.Context) {
var request NssaiAvailabilityInfo
err := c.ShouldBindJSON(&request)
if err != nil {
problemDetail := "[Request Body] " + err.Error()
d := ProblemDetails{
Title: util.MALFORMED_REQUEST,
Status: http.StatusBadRequest,
Detail: problemDetail,
}
c.JSON(http.StatusBadRequest, d)
return
}
req := http_wrapper.NewRequest(c.Request, request)
req.Params["nfId"] = c.Param("nfId")
message := nssf_message.NewMessage(nssf_message.NSSAIAvailabilityPut, req)
nssf_handler.SendMessage(message)
rsp := <-message.ResponseChan
httpResponse := rsp.HttpResponse
c.JSON(httpResponse.Status, httpResponse.Body)
}