mirror of https://github.com/status-im/consul.git
Move Session.CheckIDs into OSS only code. (#6993)
This commit is contained in:
parent
62a111f7b6
commit
fa2003d7cb
|
@ -1932,22 +1932,6 @@ type ServiceCheck struct {
|
||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckIDs returns the IDs for all checks associated with a session, regardless of type
|
|
||||||
func (s *Session) CheckIDs() []types.CheckID {
|
|
||||||
// Merge all check IDs into a single slice, since they will be handled the same way
|
|
||||||
checks := make([]types.CheckID, 0, len(s.Checks)+len(s.NodeChecks)+len(s.ServiceChecks))
|
|
||||||
checks = append(checks, s.Checks...)
|
|
||||||
|
|
||||||
for _, c := range s.NodeChecks {
|
|
||||||
checks = append(checks, types.CheckID(c))
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, c := range s.ServiceChecks {
|
|
||||||
checks = append(checks, types.CheckID(c.ID))
|
|
||||||
}
|
|
||||||
return checks
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Session) UnmarshalJSON(data []byte) (err error) {
|
func (s *Session) UnmarshalJSON(data []byte) (err error) {
|
||||||
type Alias Session
|
type Alias Session
|
||||||
aux := &struct {
|
aux := &struct {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"hash"
|
"hash"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/acl"
|
"github.com/hashicorp/consul/acl"
|
||||||
|
"github.com/hashicorp/consul/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var emptyEnterpriseMeta = EnterpriseMeta{}
|
var emptyEnterpriseMeta = EnterpriseMeta{}
|
||||||
|
@ -91,3 +92,19 @@ func (cid *CheckID) String() string {
|
||||||
func (_ *HealthCheck) Validate() error {
|
func (_ *HealthCheck) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckIDs returns the IDs for all checks associated with a session, regardless of type
|
||||||
|
func (s *Session) CheckIDs() []types.CheckID {
|
||||||
|
// Merge all check IDs into a single slice, since they will be handled the same way
|
||||||
|
checks := make([]types.CheckID, 0, len(s.Checks)+len(s.NodeChecks)+len(s.ServiceChecks))
|
||||||
|
checks = append(checks, s.Checks...)
|
||||||
|
|
||||||
|
for _, c := range s.NodeChecks {
|
||||||
|
checks = append(checks, types.CheckID(c))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, c := range s.ServiceChecks {
|
||||||
|
checks = append(checks, types.CheckID(c.ID))
|
||||||
|
}
|
||||||
|
return checks
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue