2d8a1d24d7b7740af09016d665e9da8801472a4a
[ealt-edge.git] / mep / mepserver / mp1 / mepspace.go
1 /*
2  * Copyright 2020 Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 package mp1
19
20 import (
21         "net/http"
22         "net/url"
23
24         "github.com/apache/servicecomb-service-center/server/core/proto"
25         "golang.org/x/net/context"
26
27         "mepserver/mp1/arch/workspace"
28 )
29
30 type MepSpace struct {
31         workspace.SpaceBase
32         R *http.Request       `json:"r"`
33         W http.ResponseWriter `json:"w"`
34
35         Ctx           context.Context `json:"ctx"`
36         ServiceId     string          `json:"serviceId"`
37         RestBody      interface{}     `json:"restBody"`
38         AppInstanceId string          `json:"appInstanceId"`
39         InstanceId    string          `json:"instanceId"`
40         SubscribeId   string          `json:"subscribeId"`
41         QueryParam    url.Values      `json:"queryParam"`
42
43         CoreRequest interface{}     `json:"coreRequest"`
44         CoreRsp     interface{}     `json:"coreRsp"`
45         HttPErrInf  *proto.Response `json:"httpErrInf"`
46         HttPRsp     interface{}     `json:"httpRsp"`
47 }
48
49 func NewWorkSpace(w http.ResponseWriter, r *http.Request) *MepSpace {
50         var plan = MepSpace{
51                 W: w,
52                 R: r,
53         }
54
55         plan.Init()
56         return &plan
57 }