Skip to content

Commit

Permalink
refactor: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
JadhavPoonam committed Aug 9, 2023
1 parent 98dcc3c commit af2a121
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/resource/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (h *resourceHandler) handleWrite(w http.ResponseWriter, r *http.Request, ct
return
}

tenancyInfo, resourceName, version := checkURL(r)
tenancyInfo, resourceName, version := parseParams(r)

rsp, err := h.client.Write(ctx, &pbresource.WriteRequest{
Resource: &pbresource.Resource{
Expand Down Expand Up @@ -114,7 +114,7 @@ func (h *resourceHandler) handleWrite(w http.ResponseWriter, r *http.Request, ct
w.Write(output)
}

func checkURL(r *http.Request) (tenancy *pbresource.Tenancy, resourceName string, version string) {
func parseParams(r *http.Request) (tenancy *pbresource.Tenancy, resourceName string, version string) {
params := r.URL.Query()
tenancy = &pbresource.Tenancy{
Partition: params.Get("partition"),
Expand Down Expand Up @@ -172,7 +172,7 @@ func handleResponseError(err error, w http.ResponseWriter, h *resourceHandler) {
}

func (h *resourceHandler) handleDelete(w http.ResponseWriter, r *http.Request, ctx context.Context) {
tenancyInfo, resourceName, version := checkURL(r)
tenancyInfo, resourceName, version := parseParams(r)
_, err := h.client.Delete(ctx, &pbresource.DeleteRequest{
Id: &pbresource.ID{
Type: h.reg.Type,
Expand Down

0 comments on commit af2a121

Please sign in to comment.