// GET Oper REST call
497819
func httpInspectAciGw(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	var obj AciGwInspect
	log.Debugf("Received httpInspectAciGw: %+v", vars)

	key := vars["key"]

	collections.aciGwMutex.Lock()
	defer collections.aciGwMutex.Unlock()
	objConfig := collections.aciGws[key]
	if objConfig == nil {
		log.Errorf("aciGw %s not found", key)
		return nil, errors.New("aciGw not found")
	}
	obj.Config = *objConfig

	if err := GetOperAciGw(&obj); err != nil {
		log.Errorf("GetAciGw error for: %+v. Err: %v", obj, err)
		return nil, err
	}

	// Return the obj
	return &obj, nil
}
578671
func (cli *OpsGenieClient) OpsGenieAPIUrl() string {
	if cli.opsGenieAPIURL == "" {
		cli.opsGenieAPIURL = endpointURL
	}
	return cli.opsGenieAPIURL
}
352227
func restGetDeviceByServiceName(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	sn, err := url.QueryUnescape(vars[SERVICENAME])
	if err != nil {
		LoggingClient.Error(err.Error())
		http.Error(w, err.Error(), http.StatusServiceUnavailable)
		return
	}

	// Check if the device service exists
	ds, err := dbClient.GetDeviceServiceByName(sn)
	if err != nil {
		if err == db.ErrNotFound {
			http.Error(w, err.Error(), http.StatusNotFound)
		} else {
			http.Error(w, err.Error(), http.StatusServiceUnavailable)
		}
		LoggingClient.Error(err.Error())
		return
	}

	// Find devices by service ID now that you have the Service object (and therefor the ID)
	res, err := dbClient.GetDevicesByServiceId(ds.Id)
	if err != nil {
		http.Error(w, err.Error(), http.StatusServiceUnavailable)
		LoggingClient.Error(err.Error())
		return
	}

	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(res)
}
1210179
func (client *lockRESTClient) restCall(call string, args dsync.LockArgs) (reply bool, err error) {

	reader := bytes.NewBuffer(make([]byte, 0, 2048))
	err = gob.NewEncoder(reader).Encode(args)
	if err != nil {
		return false, err
	}
	respBody, err := client.call(call, nil, reader, -1)
	if err != nil {
		return false, err
	}

	var resp lockResponse
	defer http.DrainBody(respBody)
	err = gob.NewDecoder(respBody).Decode(&resp)

	if err != nil || !resp.Success {
		reqInfo := &logger.ReqInfo{}
		reqInfo.AppendTags("resource", args.Resource)
		reqInfo.AppendTags("serveraddress", args.ServerAddr)
		reqInfo.AppendTags("serviceendpoint", args.ServiceEndpoint)
		reqInfo.AppendTags("source", args.Source)
		reqInfo.AppendTags("uid", args.UID)
		ctx := logger.SetReqInfo(context.Background(), reqInfo)
		logger.LogIf(ctx, err)
	}
	return resp.Success, err
}
845622
func (r *RestClient) Get(path string, v interface{}, options ...RequestOption) error {
	return r.Do("GET", path, nil, v, options...)
}
39976
func (_m *API) GetService(_a0 string) (*service.Service, error) {
	ret := _m.Called(_a0)

	var r0 *service.Service
	if rf, ok := ret.Get(0).(func(string) *service.Service); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*service.Service)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
871651
func GetObject(ops map[string]string, srcs Sources) http.HandlerFunc {
	return func(res http.ResponseWriter, req *http.Request) {
		sub := strings.TrimPrefix(req.URL.Path, ops["GetObject"])
		parts := strings.Split(sub, "/")
		src := parts[0]
		usr := parts[1]
		if _, ok := srcs[src]; !ok {
			res.WriteHeader(http.StatusNotFound)
			fmt.Fprintf(res, "source %s not found", src)
			return
		}
		if _, ok := srcs[src][usr]; !ok {
			res.WriteHeader(http.StatusNotFound)
			fmt.Fprintf(res, "user %s not found", usr)
			return
		}
		session := srcs[src][usr]
		r, urls, err := session.Get()
		if err != nil {
			res.WriteHeader(http.StatusServiceUnavailable)
			fmt.Fprintf(res, "source %s, user %s login failed", src, usr)
			return
		}

		// TODO also check body in case of POST params in body
		values := req.URL.Query()
		params := rets.GetObjectParams{
			Resource: values.Get("Resource"),
			Type:     values.Get("Type"),
			ID:       values.Get("ID"),
			UID:      values.Get("UID"),
		}

		if l := values.Get("Location"); l != "" {
			params.Location, _ = strconv.Atoi(l)
		}

		ctx := context.Background()
		response, err := rets.GetObjects(ctx, r, rets.GetObjectRequest{
			URL:                   urls.GetObject,
			HTTPMethod:            req.Method,
			HTTPFormEncodedValues: (req.Method == "POST"),
			GetObjectParams:       params,
		})
		defer response.Body.Close()
		if err != nil {
			res.WriteHeader(http.StatusBadGateway)
			fmt.Fprintf(res, "get objects err %s", err)
			return
		}
		// success, send the urls (modified to point to this server)
		res.Header()["Content-Type"] = response.Header["Content-Type"]
		res.WriteHeader(http.StatusOK)
		io.Copy(res, response.Body)
	}
}
135677
func (c *Context) GetUniform(program, location *js.Object) *js.Object {
	return c.Call("getUniform", program, location)
}
9122
func httpInspectServiceLB(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	var obj ServiceLBInspect
	log.Debugf("Received httpInspectServiceLB: %+v", vars)

	key := vars["key"]

	collections.serviceLBMutex.Lock()
	defer collections.serviceLBMutex.Unlock()
	objConfig := collections.serviceLBs[key]
	if objConfig == nil {
		log.Errorf("serviceLB %s not found", key)
		return nil, errors.New("serviceLB not found")
	}
	obj.Config = *objConfig

	if err := GetOperServiceLB(&obj); err != nil {
		log.Errorf("GetServiceLB error for: %+v. Err: %v", obj, err)
		return nil, err
	}

	// Return the obj
	return &obj, nil
}
941908
func callGetProfileService(email string) (rest.ResponseDTOWithProfile, apihelper.ApiErrors, int) {

	// call api
	req, err := http.NewRequest("GET", profileBaseUrl+"/"+email, nil)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	// read response
	body, _ := ioutil.ReadAll(resp.Body)

	userWithProfile := rest.ResponseDTOWithProfile{}
	apiErrors := apihelper.ApiErrors{}
	json.Unmarshal(body, &userWithProfile)
	json.Unmarshal(body, &apiErrors)

	return userWithProfile, apiErrors, resp.StatusCode
}
297772
func (v *HandshakeResponse) GetAPIVersion() (o int32) {
	if v != nil {
		o = v.APIVersion
	}
	return
}
543128
func (that *JSONNode) Get() interface{} {
	if that.t != TypeValue {
		panic(ErrorRetrieveUserValue)
	}
	if that.vChanged {
		rv := reflect.ValueOf(that.v)
		return rv.Elem().Interface()
	}
	return that.v
}
1122954
func callGetUserIdService(email string) (rest.ResponseDTOUserInfo, apihelper.ApiErrors, int) {

	// call api
	req, err := http.NewRequest("GET", userBaseUrl+"/email/"+email, nil)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	// read response
	body, _ := ioutil.ReadAll(resp.Body)

	userInfo := rest.ResponseDTOUserInfo{}
	apiErrors := apihelper.ApiErrors{}
	json.Unmarshal(body, &userInfo)
	json.Unmarshal(body, &apiErrors)

	return userInfo, apiErrors, resp.StatusCode
}
286607
func (r *GroupRolloutService) Get(appId string, groupId string) *GroupRolloutGetCall {
	c := &GroupRolloutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.appId = appId
	c.groupId = groupId
	return c
}
1366156
func (mj *Client) GetData(mdr *DataRequest, res interface{}, options ...RequestOptions) (err error) {
	url := buildDataURL(mj.apiBase, mdr)
	req, err := createRequest("GET", url, nil, nil, options...)
	if err != nil {
		return err
	}

	_, _, err = mj.httpClient.Send(req).Read(res).Call()
	return err
}
104332
func restGetTopServices(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) {
	topServices := []service.Service{}

	tsince, err := getSinceParameter(r)
	if err != nil {
		restServerError(w, err)
		return
	}

	// Instead of getting all services, get ServiceDetails for just the tenant Apps
	allTenants, err := ctx.getFacade().GetServiceDetailsByParentID(ctx.getDatastoreContext(), "", tsince)
	if err != nil {
		plog.WithError(err).Error("Could not get services")
		restServerError(w, err)
		return
	}
	for _, tenant := range allTenants {
		service, err := ctx.getFacade().GetService(ctx.getDatastoreContext(), tenant.ID)
		if err != nil {
			plog.WithField("tenantid", tenant.ID).WithError(err).Error("Could not get service")
			restServerError(w, err)
			return
		}
		topServices = append(topServices, *service)
	}
	topServices = append(topServices, isvcs.InternalServicesISVC)
	plog.WithField("numservices", len(topServices)).Debug("Got top services")
	w.WriteJson(&topServices)
}
830738
func (a *API) Get(url string, params Params, dst interface{}) error {
	resp, err := try(a.client.Get(url, params, a.token))
	if err != nil {
		return err
	}

	defer resp.Body.Close()

	// no destination, so caller was only interested in the
	// side effects.
	if dst == nil {
		return nil
	}

	decoder := json.NewDecoder(resp.Body)
	err = decoder.Decode(&dst)
	if err != nil {
		return err
	}

	return nil
}