Skip to content

Commit

Permalink
switch trusted/remote cluster management to atomic write (#48094)
Browse files Browse the repository at this point in the history
  • Loading branch information
fspmarshall authored Oct 30, 2024
1 parent 7a8ad88 commit 63bcaaf
Show file tree
Hide file tree
Showing 6 changed files with 914 additions and 284 deletions.
8 changes: 8 additions & 0 deletions api/types/trustedcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"time"

"github.com/gravitational/trace"

"github.com/gravitational/teleport/api/utils"
)

// TrustedCluster holds information needed for a cluster that can not be directly
Expand Down Expand Up @@ -60,6 +62,8 @@ type TrustedCluster interface {
SetReverseTunnelAddress(string)
// CanChangeStateTo checks the TrustedCluster can transform into another.
CanChangeStateTo(TrustedCluster) error
// Clone returns a deep copy of the TrustedCluster.
Clone() TrustedCluster
}

// NewTrustedCluster is a convenience way to create a TrustedCluster resource.
Expand Down Expand Up @@ -259,6 +263,10 @@ func (c *TrustedClusterV2) CanChangeStateTo(t TrustedCluster) error {
return nil
}

func (c *TrustedClusterV2) Clone() TrustedCluster {
return utils.CloneProtoMsg(c)
}

// String represents a human readable version of trusted cluster settings.
func (c *TrustedClusterV2) String() string {
return fmt.Sprintf("TrustedCluster(Enabled=%v,Roles=%v,Token=%v,ProxyAddress=%v,ReverseTunnelAddress=%v)",
Expand Down
Loading

0 comments on commit 63bcaaf

Please sign in to comment.