Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v17] switch trusted/remote cluster management to atomic write #48094

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading