Move Session.CheckIDs into OSS only code. (#6993)

This commit is contained in:
Matt Keeler 2020-01-03 15:51:19 -05:00 committed by GitHub
parent 89f57372ce
commit 421148f793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 16 deletions

View File

@ -1932,22 +1932,6 @@ type ServiceCheck struct {
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) {
type Alias Session
aux := &struct {

View File

@ -6,6 +6,7 @@ import (
"hash"
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/types"
)
var emptyEnterpriseMeta = EnterpriseMeta{}
@ -91,3 +92,19 @@ func (cid *CheckID) String() string {
func (_ *HealthCheck) Validate() error {
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
}