// itemFromTrustedCluster attempts to encode the supplied trusted cluster
// as an instance of `backend.Item` suitable for storage.
itemFromTrustedCluster attempts to encode the supplied trusted cluster
as an instance of `backend.Item` suitable for storage.
// itemFromTrustedCluster attempts to encode the supplied trusted cluster // as an instance of ` backend . Item ` suitable for storage .
func itemFromTrustedCluster(tc services.TrustedCluster) (*backend.Item, error) {
	if err := tc.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}
	value, err := services.GetTrustedClusterMarshaler().Marshal(tc)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	item := &backend.Item{
		Key:     backend.Key(trustedClustersPrefix, tc.GetName()),
		Value:   value,
		Expires: tc.Expiry(),
		ID:      tc.GetResourceID(),
	}
	return item, nil
}
func itemFromTrustedCluster ( tc services . TrustedCluster ) ( * backend . Item , error ) { if err := tc . CheckAndSetDefaults ( ) ; err != nil { return nil , trace . Wrap ( err ) } value , err := services . GetTrustedClusterMarshaler ( ) . Marshal ( tc ) if err != nil { return nil , trace . Wrap ( err ) } item := & backend . Item { Key : backend . Key ( trustedClustersPrefix , tc . GetName ( ) ) , Value : value , Expires : tc . Expiry ( ) , ID : tc . GetResourceID ( ) , } return item , nil }
itemFromTrustedCluster attempts to encode the supplied trusted cluster
as an instance of `backend.Item` suitable for storage.
itemFromTrustedCluster attempts to encode the supplied trusted cluster as an instance of ` backend . Item ` suitable for storage .