src/server/enterprise/server/api_server.go
func (a *apiServer) GetState(ctx context.Context, req *ec.GetStateRequest) (resp *ec.GetStateResponse, retErr error) {
	a.LogReq(req)
	defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())

	expiration, ok := a.enterpriseExpiration.Load().(time.Time)
	if !ok {
		return nil, fmt.Errorf("could not retrieve enterprise expiration time")
	}
	if expiration.IsZero() {
		return &ec.GetStateResponse{State: ec.State_NONE}, nil
	}
	expirationProto, err := types.TimestampProto(expiration)
	if err != nil {
		return nil, fmt.Errorf("could not convert expiration time \"%s\" to response proto: %s", expiration.String(), err.Error())
	}
	resp = &ec.GetStateResponse{
		Info: &ec.TokenInfo{
			Expires: expirationProto,
		},
	}
	if time.Now().After(expiration) {
		resp.State = ec.State_EXPIRED
	} else {
		resp.State = ec.State_ACTIVE
	}
	return resp, nil
}
func (a *apiServer) GetState(ctx context.Context, req *ec.GetStateRequest) (resp *ec.GetStateResponse, retErr error) {
	a.LogReq(req)
	defer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())

	expiration, ok := a.enterpriseExpiration.Load().(time.Time)
	if !ok {
		return nil, fmt.Errorf("could not retrieve enterprise expiration time")
	}
	if expiration.IsZero() {
		return &ec.GetStateResponse{State: ec.State_NONE}, nil
	}
	expirationProto, err := types.TimestampProto(expiration)
	if err != nil {
		return nil, fmt.Errorf("could not convert expiration time \"%s\" to response proto: %s", expiration.String(), err.Error())
	}
	resp = &ec.GetStateResponse{
		Info: &ec.TokenInfo{
			Expires: expirationProto,
		},
	}
	if time.Now().After(expiration) {
		resp.State = ec.State_EXPIRED
	} else {
		resp.State = ec.State_ACTIVE
	}
	return resp, nil
}
// GetState returns the current state of the cluster's Pachyderm Enterprise key (ACTIVE, EXPIRED, or NONE)