Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Move http_wrapper dependency to util project #71

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ampolicy/api_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
Expand All @@ -28,7 +28,7 @@ import (
)

func HTTPPoliciesPolAssoIdDelete(c *gin.Context) {
req := http_wrapper.NewRequest(c.Request, nil)
req := httpwrapper.NewRequest(c.Request, nil)
req.Params["polAssoId"], _ = c.Params.Get("polAssoId")

rsp := producer.HandleDeletePoliciesPolAssoId(req)
Expand All @@ -49,7 +49,7 @@ func HTTPPoliciesPolAssoIdDelete(c *gin.Context) {

// HTTPPoliciesPolAssoIdGet -
func HTTPPoliciesPolAssoIdGet(c *gin.Context) {
req := http_wrapper.NewRequest(c.Request, nil)
req := httpwrapper.NewRequest(c.Request, nil)
req.Params["polAssoId"], _ = c.Params.Get("polAssoId")

rsp := producer.HandleGetPoliciesPolAssoId(req)
Expand Down Expand Up @@ -98,7 +98,7 @@ func HTTPPoliciesPolAssoIdUpdatePost(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, policyAssociationUpdateRequest)
req := httpwrapper.NewRequest(c.Request, policyAssociationUpdateRequest)
req.Params["polAssoId"], _ = c.Params.Get("polAssoId")

rsp := producer.HandleUpdatePostPoliciesPolAssoId(req)
Expand Down Expand Up @@ -154,7 +154,7 @@ func HTTPPoliciesPost(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, policyAssociationRequest)
req := httpwrapper.NewRequest(c.Request, policyAssociationRequest)
req.Params["polAssoId"], _ = c.Params.Get("polAssoId")

rsp := producer.HandlePostPolicies(req)
Expand Down
4 changes: 2 additions & 2 deletions bdtpolicy/api_bdt_policies_collection_routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
Expand Down Expand Up @@ -57,7 +57,7 @@ func HTTPCreateBDTPolicy(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, bdtReqData)
req := httpwrapper.NewRequest(c.Request, bdtReqData)
rsp := producer.HandleCreateBDTPolicyContextRequest(req)
// step 5: response
for key, val := range rsp.Header { // header response is optional
Expand Down
6 changes: 3 additions & 3 deletions bdtpolicy/api_individual_bdt_policy_document_routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
Expand All @@ -28,7 +28,7 @@ import (

// GetBDTPolicy - Read an Individual BDT policy
func HTTPGetBDTPolicy(c *gin.Context) {
req := http_wrapper.NewRequest(c.Request, nil)
req := httpwrapper.NewRequest(c.Request, nil)
req.Params["bdtPolicyId"] = c.Params.ByName("bdtPolicyId")

rsp := producer.HandleGetBDTPolicyContextRequest(req)
Expand Down Expand Up @@ -78,7 +78,7 @@ func HTTPUpdateBDTPolicy(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, bdtPolicyDataPatch)
req := httpwrapper.NewRequest(c.Request, bdtPolicyDataPatch)
req.Params["bdtPolicyId"] = c.Params.ByName("bdtPolicyId")

rsp := producer.HandleUpdateBDTPolicyContextProcedure(req)
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/omec-project/MongoDBLibrary v1.1.3
github.com/omec-project/config5g v1.2.0
github.com/omec-project/http2_util v1.1.0
github.com/omec-project/http_wrapper v1.1.0
github.com/omec-project/logger_conf v1.1.0
github.com/omec-project/logger_util v1.1.0
github.com/omec-project/openapi v1.1.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ github.com/omec-project/config5g v1.2.0 h1:fyIg+1LZ9jn8DTkVUbD4jyxA4FgMICdIBwZVn
github.com/omec-project/config5g v1.2.0/go.mod h1:AWFzCbbgCBx/iJwt+zWbpDGLHRpFzg24OYHqIkdcMVA=
github.com/omec-project/http2_util v1.1.0 h1:8H2NME/V8iONth8TlyK/3w4pguAzaeUnEv9pmeAocwQ=
github.com/omec-project/http2_util v1.1.0/go.mod h1:QwoZRaUyhEp/kTEqXvf0gCYtfQrNHBdkVw939vsMjZY=
github.com/omec-project/http_wrapper v1.1.0 h1:2hD8RUaR/VVg3tUUfuxsuo1/JNpZLiAE8IvATGqDME4=
github.com/omec-project/http_wrapper v1.1.0/go.mod h1:mc045fjVVJ0/q0g4QG4nuSC0N1BIqGR/ZoK76XgifVU=
github.com/omec-project/logger_conf v1.1.0 h1:C0/HbsSOWV8D3/lm7Iqe1nUL9ltVtVO4MDC9ZxIo/xc=
github.com/omec-project/logger_conf v1.1.0/go.mod h1:2+SOX9OFbPZ+UNv8k+tvPnaWHo4CuX5G/x12dz5sWUE=
github.com/omec-project/logger_util v1.1.0 h1:R7tT80+ML1HlK4OoTrNv/UK+2H/u2GdIFNBx41g630Q=
Expand Down
4 changes: 2 additions & 2 deletions httpcallback/amf_status_change_notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
"github.com/omec-project/pcf/producer"
"github.com/omec-project/util/httpwrapper"
)

func HTTPAmfStatusChangeNotify(c *gin.Context) {
Expand Down Expand Up @@ -47,7 +47,7 @@ func HTTPAmfStatusChangeNotify(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, amfStatusChangeNotification)
req := httpwrapper.NewRequest(c.Request, amfStatusChangeNotification)

rsp := producer.HandleAmfStatusChangeNotify(req)

Expand Down
4 changes: 2 additions & 2 deletions httpcallback/sm_policy_notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
"github.com/omec-project/pcf/producer"
"github.com/omec-project/util/httpwrapper"
)

// Nudr-Notify-smpolicy
Expand Down Expand Up @@ -47,7 +47,7 @@ func HTTPNudrNotify(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, policyDataChangeNotification)
req := httpwrapper.NewRequest(c.Request, policyDataChangeNotification)
req.Params["ReqURI"] = c.Params.ByName("supi")

rsp := producer.HandleSmPolicyNotify(req)
Expand Down
4 changes: 2 additions & 2 deletions oam/api_get_am_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
Expand All @@ -27,7 +27,7 @@ func setCorsHeader(c *gin.Context) {
func HTTPOAMGetAmPolicy(c *gin.Context) {
setCorsHeader(c)

req := http_wrapper.NewRequest(c.Request, nil)
req := httpwrapper.NewRequest(c.Request, nil)
req.Params["supi"] = c.Params.ByName("supi")

rsp := producer.HandleOAMGetAmPolicyRequest(req)
Expand Down
4 changes: 2 additions & 2 deletions policyauthorization/api_application_sessions_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
Expand Down Expand Up @@ -66,7 +66,7 @@ func HTTPPostAppSessions(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, appSessionContext)
req := httpwrapper.NewRequest(c.Request, appSessionContext)
rsp := producer.HandlePostAppSessionsContext(req)

for key, val := range rsp.Header {
Expand Down
6 changes: 3 additions & 3 deletions policyauthorization/api_events_subscription_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
Expand All @@ -29,7 +29,7 @@ import (

// HTTPDeleteEventsSubsc - deletes the Events Subscription subresource
func HTTPDeleteEventsSubsc(c *gin.Context) {
req := http_wrapper.NewRequest(c.Request, nil)
req := httpwrapper.NewRequest(c.Request, nil)
req.Params["appSessionId"], _ = c.Params.Get("appSessionId")

rsp := producer.HandleDeleteEventsSubscContext(req)
Expand Down Expand Up @@ -85,7 +85,7 @@ func HTTPUpdateEventsSubsc(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, eventsSubscReqData)
req := httpwrapper.NewRequest(c.Request, eventsSubscReqData)
req.Params["appSessionId"], _ = c.Params.Get("appSessionId")

rsp := producer.HandleUpdateEventsSubscContext(req)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/util/httpwrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/logger"
Expand Down Expand Up @@ -59,7 +59,7 @@ func HTTPDeleteAppSession(c *gin.Context) {
}
}

req := http_wrapper.NewRequest(c.Request, eventsSubscReqData)
req := httpwrapper.NewRequest(c.Request, eventsSubscReqData)
req.Params["appSessionId"], _ = c.Params.Get("appSessionId")

rsp := producer.HandleDeleteAppSessionContext(req)
Expand All @@ -80,7 +80,7 @@ func HTTPDeleteAppSession(c *gin.Context) {

// HTTPGetAppSession - Reads an existing Individual Application Session Context
func HTTPGetAppSession(c *gin.Context) {
req := http_wrapper.NewRequest(c.Request, nil)
req := httpwrapper.NewRequest(c.Request, nil)
req.Params["appSessionId"], _ = c.Params.Get("appSessionId")

rsp := producer.HandleGetAppSessionContext(req)
Expand Down Expand Up @@ -129,7 +129,7 @@ func HTTPModAppSession(c *gin.Context) {
return
}

req := http_wrapper.NewRequest(c.Request, appSessionContextUpdateData)
req := httpwrapper.NewRequest(c.Request, appSessionContextUpdateData)
req.Params["appSessionId"], _ = c.Params.Get("appSessionId")

rsp := producer.HandleModAppSessionContext(req)
Expand Down
32 changes: 16 additions & 16 deletions producer/ampolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ import (

"github.com/mohae/deepcopy"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
"github.com/omec-project/pcf/consumer"
pcf_context "github.com/omec-project/pcf/context"
"github.com/omec-project/pcf/logger"
"github.com/omec-project/pcf/util"
"github.com/omec-project/util/httpwrapper"
)

func HandleDeletePoliciesPolAssoId(request *http_wrapper.Request) *http_wrapper.Response {
func HandleDeletePoliciesPolAssoId(request *httpwrapper.Request) *httpwrapper.Response {
logger.AMpolicylog.Infof("Handle AM Policy Association Delete")

polAssoId := request.Params["polAssoId"]

problemDetails := DeletePoliciesPolAssoIdProcedure(polAssoId)
if problemDetails == nil {
return http_wrapper.NewResponse(http.StatusNoContent, nil, nil)
return httpwrapper.NewResponse(http.StatusNoContent, nil, nil)
} else {
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
}

Expand All @@ -46,22 +46,22 @@ func DeletePoliciesPolAssoIdProcedure(polAssoId string) *models.ProblemDetails {
}

// PoliciesPolAssoIdGet -
func HandleGetPoliciesPolAssoId(request *http_wrapper.Request) *http_wrapper.Response {
func HandleGetPoliciesPolAssoId(request *httpwrapper.Request) *httpwrapper.Response {
logger.AMpolicylog.Infof("Handle AM Policy Association Get")

polAssoId := request.Params["polAssoId"]

response, problemDetails := GetPoliciesPolAssoIdProcedure(polAssoId)
if response != nil {
return http_wrapper.NewResponse(http.StatusOK, nil, response)
return httpwrapper.NewResponse(http.StatusOK, nil, response)
} else if problemDetails != nil {
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
problemDetails = &models.ProblemDetails{
Status: http.StatusForbidden,
Cause: "UNSPECIFIED",
}
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}

func GetPoliciesPolAssoIdProcedure(polAssoId string) (*models.PolicyAssociation, *models.ProblemDetails) {
Expand Down Expand Up @@ -92,23 +92,23 @@ func GetPoliciesPolAssoIdProcedure(polAssoId string) (*models.PolicyAssociation,
return &rsp, nil
}

func HandleUpdatePostPoliciesPolAssoId(request *http_wrapper.Request) *http_wrapper.Response {
func HandleUpdatePostPoliciesPolAssoId(request *httpwrapper.Request) *httpwrapper.Response {
logger.AMpolicylog.Infof("Handle AM Policy Association Update")

polAssoId := request.Params["polAssoId"]
policyAssociationUpdateRequest := request.Body.(models.PolicyAssociationUpdateRequest)

response, problemDetails := UpdatePostPoliciesPolAssoIdProcedure(polAssoId, policyAssociationUpdateRequest)
if response != nil {
return http_wrapper.NewResponse(http.StatusOK, nil, response)
return httpwrapper.NewResponse(http.StatusOK, nil, response)
} else if problemDetails != nil {
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
problemDetails = &models.ProblemDetails{
Status: http.StatusForbidden,
Cause: "UNSPECIFIED",
}
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}

func UpdatePostPoliciesPolAssoIdProcedure(polAssoId string,
Expand Down Expand Up @@ -184,7 +184,7 @@ func UpdatePostPoliciesPolAssoIdProcedure(polAssoId string,
}

// Create AM Policy
func HandlePostPolicies(request *http_wrapper.Request) *http_wrapper.Response {
func HandlePostPolicies(request *httpwrapper.Request) *httpwrapper.Response {
logger.AMpolicylog.Infof("Handle AM Policy Create Request")

polAssoId := request.Params["polAssoId"]
Expand All @@ -195,15 +195,15 @@ func HandlePostPolicies(request *http_wrapper.Request) *http_wrapper.Response {
"Location": {locationHeader},
}
if response != nil {
return http_wrapper.NewResponse(http.StatusCreated, headers, response)
return httpwrapper.NewResponse(http.StatusCreated, headers, response)
} else if problemDetails != nil {
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
problemDetails = &models.ProblemDetails{
Status: http.StatusForbidden,
Cause: "UNSPECIFIED",
}
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}

func PostPoliciesProcedure(polAssoId string,
Expand Down
Loading