Skip to content

Commit

Permalink
switch trusted/remote cluster management to atomic write
Browse files Browse the repository at this point in the history
  • Loading branch information
fspmarshall committed Oct 28, 2024
1 parent de64686 commit b0603a5
Show file tree
Hide file tree
Showing 6 changed files with 724 additions and 274 deletions.
7 changes: 7 additions & 0 deletions api/types/trustedcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"slices"
"time"

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

Expand Down Expand Up @@ -60,6 +61,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 +262,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 b0603a5

Please sign in to comment.