feat(session): Support connecting to an address associated to a Target

This commit is contained in:
Damian Debkowski authored and Hugo Vieira committed 2023-01-09 15:39:55 +00:00
1 parent 760671f223
commit bca7c371d8
7 files changed
+311 -77

No files matched your search

+6 -10
View File
@@ -68,12 +68,8 @@ type Session struct {
PublicId string `json:"public_id,omitempty" gorm:"primary_key"`
// UserId for the session
UserId string `json:"user_id,omitempty" gorm:"default:null"`
// HostId of the session
HostId string `json:"host_id,omitempty" gorm:"default:null"`
// TargetId for the session
TargetId string `json:"target_id,omitempty" gorm:"default:null"`
// HostSetId for the session
HostSetId string `json:"host_set_id,omitempty" gorm:"default:null"`
// AuthTokenId for the session
AuthTokenId string `json:"auth_token_id,omitempty" gorm:"default:null"`
// ProjectId for the session
@@ -124,6 +120,12 @@ type Session struct {
// StaticCredentials for the session.
StaticCredentials []*StaticCredential `gorm:"-"`
// HostSetId for the session
HostSetId string `gorm:"-"`
// HostId of the session
HostId string `gorm:"-"`
// Connections for the session are for read only and are ignored during write operations
Connections []*Connection `gorm:"-"`
@@ -347,15 +349,9 @@ func (s *Session) validateNewSession() error {
if s.UserId == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing user id")
}
if s.HostId == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing host id")
}
if s.TargetId == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing target id")
}
if s.HostSetId == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing host set id")
}
if s.AuthTokenId == "" {
return errors.NewDeprecated(errors.InvalidParameter, op, "missing auth token id")
}