// CreateSession implements Service.
485271
func (e Endpoints) CreateSession(ctx context.Context, session *pb.Session) (*pb.Session, error) {
	req := &pb.CreateSessionRequest{
		Session: session,
	}
	response, err := e.CreateSessionEndpoint(ctx, req)
	if err != nil {
		return nil, err
	}
	res := response.(*pb.CreateSessionReply)
	return res.Session, toError(res.Err)
}
1295476
func (s *PoolService) CreateStoragePool(p *CreateStoragePoolParams) (*CreateStoragePoolResponse, error) {
	resp, err := s.cs.newRequest("createStoragePool", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r CreateStoragePoolResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
6870
func (s *ScanService) TakeSession(fn SessionFunction) ScanFunction {
	return func(req *restful.Request, resp *restful.Response, sc *scan.Scan) {
		id := req.PathParameter(SessionParamId)
		if !s.IsId(id) {
			resp.WriteServiceError(http.StatusBadRequest, services.IdHexErr)
			return
		}

		objId := manager.ToId(id)

		sess := sc.GetSession(objId)
		if sess == nil {
			resp.WriteErrorString(http.StatusNotFound, "Not found")
			return
		}
		fn(req, resp, sc, sess)
	}
}
804220
func (m *MockRequester) SetSession(arg0 fosite.Session) {
	m.ctrl.Call(m, "SetSession", arg0)
}
448493
func (c *Client) NewSession() (*Session, error) {
	ch, in, err := c.OpenChannel("session", nil)
	if err != nil {
		return nil, err
	}
	return newSession(ch, in)
}
1222085
func (lk *consulLock) createSession() error {
	// session configuration
	sessCfg := api.SessionEntry{
		Name:      lk.keyName,
		Behavior:  "delete",
		LockDelay: 10 * time.Millisecond,
		TTL:       lk.ttl,
	}

	// Create consul session
	sessionID, _, err := lk.client.Session().CreateNoChecks(&sessCfg, nil)
	if err != nil {
		log.Errorf("Error Creating session for lock %s. Err: %v", lk.keyName, err)
		return err
	}

	log.Infof("Created session: %s for lock %s/%s", sessionID, lk.name, lk.myID)

	// save the session ID for later
	lk.mutex.Lock()
	lk.sessionID = sessionID
	lk.mutex.Unlock()

	return nil
}
691871
func (r *Report) AddSession(k string, v interface{}) {
	r.Request.Session[k] = v
}
262181
func (s *VerifySoftwareTokenInput) SetSession(v string) *VerifySoftwareTokenInput {
	s.Session = &v
	return s
}
1090735
func (s *InitiateAuthOutput) SetSession(v string) *InitiateAuthOutput {
	s.Session = &v
	return s
}
783365
func (m *MockAccessRequester) SetSession(arg0 fosite.Session) {
	m.ctrl.Call(m, "SetSession", arg0)
}
758074
func (c *CameraModel) OpenSession() error {
	eosError := C.EdsOpenSession((*C.struct___EdsObject)(unsafe.Pointer(c.camera)))
	if eosError != C.EDS_ERR_OK {
		return errors.New(fmt.Sprintf("Error when opening session with camera (code=%d)", eosError))
	}
	c.sessionOpen = true
	return nil
}
949713
func (s *SSO) StartSession(w http.ResponseWriter, cs crowd.Session) {
	ck := http.Cookie{
		Name:    s.CookieConfig.Name,
		Domain:  s.CookieConfig.Domain,
		Secure:  s.CookieConfig.Secure,
		Value:   cs.Token,
		Expires: cs.Expires,
	}
	http.SetCookie(w, &ck)
}
789506
func (s *HTTPServer) SessionCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
	// Default the session to our node + serf check + release session
	// invalidate behavior.
	args := structs.SessionRequest{
		Op: structs.SessionCreate,
		Session: structs.Session{
			Node:      s.agent.config.NodeName,
			Checks:    []types.CheckID{structs.SerfCheckID},
			LockDelay: 15 * time.Second,
			Behavior:  structs.SessionKeysRelease,
			TTL:       "",
		},
	}
	s.parseDC(req, &args.Datacenter)
	s.parseToken(req, &args.Token)

	// Handle optional request body
	if req.ContentLength > 0 {
		fixup := func(raw interface{}) error {
			if err := FixupLockDelay(raw); err != nil {
				return err
			}
			if err := FixupChecks(raw, &args.Session); err != nil {
				return err
			}
			return nil
		}
		if err := decodeBody(req, &args.Session, fixup); err != nil {
			resp.WriteHeader(http.StatusBadRequest)
			fmt.Fprintf(resp, "Request decode failed: %v", err)
			return nil, nil
		}
	}

	// Create the session, get the ID
	var out string
	if err := s.agent.RPC("Session.Apply", &args, &out); err != nil {
		return nil, err
	}

	// Format the response as a JSON object
	return sessionCreateResponse{out}, nil
}
277966
func (u Users) create(session uint32) *User {
	user := &User{
		Session: session,
	}
	u[session] = user
	return user
}
233716
func (p11w *Pkcs11Wrapper) InitSession() (err error) {

	// Look for provided slot
	slot, _, err := FindSlotByLabel(p11w.Context, p11w.SlotLabel)
	if err != nil {
		return
	}

	// Create session for matching slot
	p11w.Session, err = p11w.Context.OpenSession(slot, pkcs11.CKF_SERIAL_SESSION|pkcs11.CKF_RW_SESSION)

	return

}
813479
func (s *VerifySoftwareTokenOutput) SetSession(v string) *VerifySoftwareTokenOutput {
	s.Session = &v
	return s
}
590651
func (mr *MockAccessRequesterMockRecorder) SetSession(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSession", reflect.TypeOf((*MockAccessRequester)(nil).SetSession), arg0)
}