Files
threshold/internal/session/connection_closed_with.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
799 B
Go
Raw Normal View History

2020-11-05 16:54:03 -05:00
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
2023-02-02 17:15:17 -08:00
package session
import (
"context"
2020-11-05 16:54:03 -05:00
"github.com/hashicorp/boundary/internal/errors"
)
// CloseWith defines the boundary data that is saved in the repo when the
// worker closes a connection between the client and the endpoint.
type CloseWith struct {
ConnectionId string
BytesUp int64
BytesDown int64
ClosedReason ClosedReason
}
func (c CloseWith) validate(ctx context.Context) error {
const op = "session.(CloseWith).validate"
if c.ConnectionId == "" {
return errors.New(ctx, errors.InvalidParameter, op, "missing connection id")
}
if c.ClosedReason.String() == "" {
return errors.New(ctx, errors.InvalidParameter, op, "missing closed reason")
}
// 0 is valid for BytesUp and BytesDown
return nil
}