// GetState returns the State field if it's non-nil, zero value otherwise.
183092
func (i *IssueRequest) GetState() string {
	if i == nil || i.State == nil {
		return ""
	}
	return *i.State
}
775386
func (vm *VM) GetState() (string, error) {
	server, err := getServer(vm)
	if err != nil {
		return "", err
	}

	if server == nil {
		// VM state "unknown"
		return "", lvm.ErrVMInfoFailed
	}

	if server.Status == StateActive {
		return lvm.VMRunning, nil
	} else if server.Status == StateShutOff {
		return lvm.VMHalted, nil
	} else if server.Status == StateError {
		return lvm.VMError, nil
	}
	return lvm.VMUnknown, nil
}
1029098
func (_m *Query) GetState(namespace string, key string) ([]byte, error) {
	ret := _m.Called(namespace, key)

	var r0 []byte
	if rf, ok := ret.Get(0).(func(string, string) []byte); ok {
		r0 = rf(namespace, key)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]byte)
		}
	}

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

	return r0, r1
}
98791
func (ctlr *Controller) GetState(modelTag names.ModelTag) (*PooledState, error) {
	return ctlr.pool.Get(modelTag.Id())
}
464877
func (s *InitializeClusterOutput) SetState(v string) *InitializeClusterOutput {
	s.State = &v
	return s
}
1026845
func (key *KeyState) State() int {
	if key.lastState {
		if key.currentState {
			return KeyStateDown
		}
		return KeyStateJustUp
	}
	if key.currentState {
		return KeyStateJustDown
	}
	return KeyStateUp
}
1039394
func (vm *VM) GetState() (string, error) {
	// Set up the authorizer
	tok, err := getServicePrincipalToken(&vm.Creds, azure.PublicCloud.ResourceManagerEndpoint)
	if err != nil {
		return "", err
	}
	authorizer := autorest.NewBearerAuthorizer(tok)

	virtualMachinesClient := compute.NewVirtualMachinesClient(vm.Creds.SubscriptionID)
	virtualMachinesClient.Authorizer = authorizer

	r, e := virtualMachinesClient.Get(vm.ResourceGroup, vm.Name, "InstanceView")
	if e != nil {
		return "", e
	}

	if r.VirtualMachineProperties != nil && r.VirtualMachineProperties.InstanceView != nil && len(*r.VirtualMachineProperties.InstanceView.Statuses) > 1 {
		state := *(*r.VirtualMachineProperties.InstanceView.Statuses)[1].DisplayStatus
		return translateState(state), e
	}

	return "", errors.New("failed to get VM status")
}
496893
func (vm *VM) GetState() (string, error) {
	svc, err := getService(vm.Region)
	if err != nil {
		return "", fmt.Errorf("failed to get AWS service: %v", err)
	}

	if vm.InstanceID == "" {
		// Probably need to call Provision first.
		return "", ErrNoInstanceID
	}

	stat, err := svc.DescribeInstances(&ec2.DescribeInstancesInput{
		InstanceIds: []*string{
			aws.String(vm.InstanceID),
		},
	})
	if err != nil {
		return "", fmt.Errorf("Failed to describe instance: %s", err)
	}

	if n := len(stat.Reservations); n < 1 {
		return "", ErrNoInstance
	}
	if n := len(stat.Reservations[0].Instances); n < 1 {
		return "", ErrNoInstance
	}

	return *stat.Reservations[0].Instances[0].State.Name, nil
}
911458
func (o *PooledObject) GetState() PooledObjectState {
	o.lock.Lock()
	defer o.lock.Unlock()
	return o.state
}
279653
func (s *ReservedElasticsearchInstance) SetState(v string) *ReservedElasticsearchInstance {
	s.State = &v
	return s
}
878079
func (s *LogStream) State(c context.Context) *LogStreamState {
	var lst LogStreamState
	s.PopulateState(c, &lst)
	return &lst
}
153504
func (vm *VM) GetState() (state string, err error) {
	if err := SetupSession(vm); err != nil {
		return "", lvm.ErrVMInfoFailed
	}
	defer func() {
		vm.client.Logout(vm.ctx)
		vm.cancel()
	}()
	state, err = getState(vm)
	if err != nil {
		return "", err
	}

	if state == "running" {
		return lvm.VMRunning, nil
	} else if state == "standby" {
		return lvm.VMSuspended, nil
	} else if state == "shuttingDown" || state == "resetting" || state == "notRunning" {
		return lvm.VMHalted, nil
	}
	// VM state "unknown"
	return "", lvm.ErrVMInfoFailed
}
725551
func GetState(s string) (State, error) {
	lower := strings.ToLower(s)
	switch {
	case lower == "":
		return State_STATE_UNSPECIFIED, nil
	case strings.HasPrefix("free", lower):
		return State_FREE, nil
	case strings.HasPrefix("prerelease", lower):
		return State_PRERELEASE, nil
	case strings.HasPrefix("serving", lower):
		return State_SERVING, nil
	case strings.HasPrefix("test", lower):
		return State_TEST, nil
	case strings.HasPrefix("repair", lower):
		return State_REPAIR, nil
	case strings.HasPrefix("decommissioned", lower):
		return State_DECOMMISSIONED, nil
	default:
		return -1, errors.Reason("string %q did not match any known state", s).Err()
	}
}
432471
func (s *ListDirectoriesInput) SetState(v string) *ListDirectoriesInput {
	s.State = &v
	return s
}
1233731
func (h *Handler) HandleGetState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) {
	getState := &pb.GetState{}
	err := proto.Unmarshal(msg.Payload, getState)
	if err != nil {
		return nil, errors.Wrap(err, "unmarshal failed")
	}

	var res []byte
	chaincodeName := h.ChaincodeName()
	collection := getState.Collection
	chaincodeLogger.Debugf("[%s] getting state for chaincode %s, key %s, channel %s", shorttxid(msg.Txid), chaincodeName, getState.Key, txContext.ChainID)

	if isCollectionSet(collection) {
		if txContext.IsInitTransaction {
			return nil, errors.New("private data APIs are not allowed in chaincode Init()")
		}
		if err := errorIfCreatorHasNoReadAccess(chaincodeName, collection, txContext); err != nil {
			return nil, err
		}
		res, err = txContext.TXSimulator.GetPrivateData(chaincodeName, collection, getState.Key)
	} else {
		res, err = txContext.TXSimulator.GetState(chaincodeName, getState.Key)
	}
	if err != nil {
		return nil, errors.WithStack(err)
	}
	if res == nil {
		chaincodeLogger.Debugf("[%s] No state associated with key: %s. Sending %s with an empty payload", shorttxid(msg.Txid), getState.Key, pb.ChaincodeMessage_RESPONSE)
	}

	// Send response msg back to chaincode. GetState will not trigger event
	return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Payload: res, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil
}
1043954
func (s *state) getData() *KVState {
	s.mtx.RLock()
	defer s.mtx.RUnlock()
	d := &KVState{}
	*d = s.data
	return d
}
1233532
func (c *Ctx) GetOperationState(sh SessionHandle) ([]byte, error) {
	var (
		state    C.CK_BYTE_PTR
		statelen C.CK_ULONG
	)
	e := C.GetOperationState(c.ctx, C.CK_SESSION_HANDLE(sh), &state, &statelen)
	defer C.free(unsafe.Pointer(state))
	if toError(e) != nil {
		return nil, toError(e)
	}
	b := C.GoBytes(unsafe.Pointer(state), C.int(statelen))
	return b, nil
}