From a2c77896738843fe325e4bb72d05897cf5dd9069 Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Mon, 17 Oct 2022 13:46:19 -0500 Subject: [PATCH 1/9] Add GetClusterFeatures to teleterm Cluster To enable feature detection in the Connect application, we need to ping the auth server to understand which features are enabled. Previously, we could get away with any cluster information stored in the cluster profile but a proxy dial is necessary now to get an auth ping response. --- lib/teleterm/api/proto/v1/cluster.proto | 8 ++++++ .../apiserver/handler/handler_clusters.go | 5 +++- lib/teleterm/clusters/cluster.go | 26 +++++++++++++++++++ lib/teleterm/daemon/daemon.go | 13 ++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/lib/teleterm/api/proto/v1/cluster.proto b/lib/teleterm/api/proto/v1/cluster.proto index b826e7a43165a..5c32b2c8c2909 100644 --- a/lib/teleterm/api/proto/v1/cluster.proto +++ b/lib/teleterm/api/proto/v1/cluster.proto @@ -33,6 +33,8 @@ message Cluster { bool leaf = 5; // User is the cluster access control list of the logged-in user LoggedInUser logged_in_user = 7; + // features describes the auth servers features + Features features = 8; } // LoggedInUser describes a logged-in user @@ -90,3 +92,9 @@ message ResourceAccess { // delete determines "delete" access bool delete = 5; } + +// Features describes the auth servers features +message Features { + // AdvancedAccessWorkflows enables search-based access requests + bool advanced_access_workflows = 1; +} diff --git a/lib/teleterm/apiserver/handler/handler_clusters.go b/lib/teleterm/apiserver/handler/handler_clusters.go index a192e49f018dc..c919504da3e4a 100644 --- a/lib/teleterm/apiserver/handler/handler_clusters.go +++ b/lib/teleterm/apiserver/handler/handler_clusters.go @@ -76,7 +76,7 @@ func (s *Handler) RemoveCluster(ctx context.Context, req *api.RemoveClusterReque // GetCluster returns a cluster func (s *Handler) GetCluster(ctx context.Context, req *api.GetClusterRequest) (*api.Cluster, error) { - cluster, err := s.DaemonService.ResolveCluster(req.ClusterUri) + cluster, err := s.DaemonService.GetCluster(ctx, req.ClusterUri) if err != nil { return nil, trace.Wrap(err) } @@ -91,6 +91,9 @@ func newAPIRootCluster(cluster *clusters.Cluster) *api.Cluster { Name: cluster.Name, ProxyHost: cluster.GetProxyHost(), Connected: cluster.Connected(), + Features: &api.Features{ + AdvancedAccessWorkflows: cluster.Features.GetAdvancedAccessWorkflows(), + }, LoggedInUser: &api.LoggedInUser{ Name: loggedInUser.Name, SshLogins: loggedInUser.SSHLogins, diff --git a/lib/teleterm/clusters/cluster.go b/lib/teleterm/clusters/cluster.go index e91bea59ec5d2..07baae7179734 100644 --- a/lib/teleterm/clusters/cluster.go +++ b/lib/teleterm/clusters/cluster.go @@ -19,6 +19,7 @@ package clusters import ( "context" + "github.com/gravitational/teleport/api/client/proto" "github.com/gravitational/teleport/api/types" "github.com/gravitational/teleport/lib/auth" "github.com/gravitational/teleport/lib/client" @@ -50,6 +51,8 @@ type Cluster struct { clusterClient *client.TeleportClient // clock is a clock for time-related operations clock clockwork.Clock + // Auth server features + Features *proto.Features } // Connected indicates if connection to the cluster can be established @@ -57,6 +60,29 @@ func (c *Cluster) Connected() bool { return c.status.Name != "" && !c.status.IsExpired(c.clock) } +// GetClusterFeatures returns a list of features enabled/disabled by the auth server +func (c *Cluster) GetClusterFeatures(ctx context.Context) (*proto.Features, error) { + var authPingResponse proto.PingResponse + + err := addMetadataToRetryableError(ctx, func() error { + proxyClient, err := c.clusterClient.ConnectToProxy(ctx) + if err != nil { + return trace.Wrap(err) + } + defer proxyClient.Close() + + authPingResponse, err = proxyClient.CurrentCluster().Ping(ctx) + + return trace.Wrap(err) + }) + + if err != nil { + return nil, trace.Wrap(err) + } + + return authPingResponse.ServerFeatures, nil +} + // GetRoles returns currently logged-in user roles func (c *Cluster) GetRoles(ctx context.Context) ([]*types.Role, error) { var roles []*types.Role diff --git a/lib/teleterm/daemon/daemon.go b/lib/teleterm/daemon/daemon.go index 0024afc9385aa..08f6a0a949227 100644 --- a/lib/teleterm/daemon/daemon.go +++ b/lib/teleterm/daemon/daemon.go @@ -109,6 +109,19 @@ func (s *Service) ResolveCluster(uri string) (*clusters.Cluster, error) { return cluster, nil } +// GetCluster returns cluster information +func (s *Service) GetCluster(ctx context.Context, uri string) (*clusters.Cluster, error) { + cluster, err := s.ResolveCluster(uri) + if err != nil { + return nil, trace.Wrap(err) + } + + features, err := cluster.GetClusterFeatures(ctx) + cluster.Features = features + + return cluster, nil +} + // ClusterLogout logs a user out from the cluster func (s *Service) ClusterLogout(ctx context.Context, uri string) error { cluster, err := s.ResolveCluster(uri) From 0b1b6a0c0fdff060dabb001a90001a2c428ba949 Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Mon, 17 Oct 2022 13:48:36 -0500 Subject: [PATCH 2/9] Add protogen files --- .../api/protogen/golang/v1/cluster.pb.go | 256 ++++++++++++------ .../api/protogen/js/v1/cluster_pb.d.ts | 28 ++ lib/teleterm/api/protogen/js/v1/cluster_pb.js | 205 +++++++++++++- 3 files changed, 400 insertions(+), 89 deletions(-) diff --git a/lib/teleterm/api/protogen/golang/v1/cluster.pb.go b/lib/teleterm/api/protogen/golang/v1/cluster.pb.go index 399697c1da267..9974e76b27c0c 100644 --- a/lib/teleterm/api/protogen/golang/v1/cluster.pb.go +++ b/lib/teleterm/api/protogen/golang/v1/cluster.pb.go @@ -53,6 +53,8 @@ type Cluster struct { Leaf bool `protobuf:"varint,5,opt,name=leaf,proto3" json:"leaf,omitempty"` // User is the cluster access control list of the logged-in user LoggedInUser *LoggedInUser `protobuf:"bytes,7,opt,name=logged_in_user,json=loggedInUser,proto3" json:"logged_in_user,omitempty"` + // features describes the auth servers features + Features *Features `protobuf:"bytes,8,opt,name=features,proto3" json:"features,omitempty"` } func (x *Cluster) Reset() { @@ -129,6 +131,13 @@ func (x *Cluster) GetLoggedInUser() *LoggedInUser { return nil } +func (x *Cluster) GetFeatures() *Features { + if x != nil { + return x.Features + } + return nil +} + // LoggedInUser describes a logged-in user type LoggedInUser struct { state protoimpl.MessageState @@ -447,12 +456,61 @@ func (x *ResourceAccess) GetDelete() bool { return false } +// Features describes the auth servers features +type Features struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // AdvancedAccessWorkflows enables search-based access requests + AdvancedAccessWorkflows bool `protobuf:"varint,1,opt,name=advanced_access_workflows,json=advancedAccessWorkflows,proto3" json:"advanced_access_workflows,omitempty"` +} + +func (x *Features) Reset() { + *x = Features{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_cluster_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Features) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Features) ProtoMessage() {} + +func (x *Features) ProtoReflect() protoreflect.Message { + mi := &file_v1_cluster_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Features.ProtoReflect.Descriptor instead. +func (*Features) Descriptor() ([]byte, []int) { + return file_v1_cluster_proto_rawDescGZIP(), []int{4} +} + +func (x *Features) GetAdvancedAccessWorkflows() bool { + if x != nil { + return x.AdvancedAccessWorkflows + } + return false +} + var File_v1_cluster_proto protoreflect.FileDescriptor var file_v1_cluster_proto_rawDesc = []byte{ 0x0a, 0x10, 0x76, 0x31, 0x2f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, - 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x22, 0xca, 0x01, 0x0a, 0x07, 0x43, 0x6c, 0x75, + 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x22, 0x86, 0x02, 0x0a, 0x07, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, @@ -465,80 +523,88 @@ var file_v1_cluster_proto_rawDesc = []byte{ 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x0c, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, - 0x6e, 0x55, 0x73, 0x65, 0x72, 0x22, 0xad, 0x01, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, - 0x49, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, - 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, - 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x73, 0x68, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x73, 0x73, 0x68, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x73, 0x12, - 0x2b, 0x0a, 0x03, 0x61, 0x63, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, - 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x43, 0x4c, 0x52, 0x03, 0x61, 0x63, 0x6c, 0x12, 0x27, 0x0a, 0x0f, - 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x73, 0x22, 0xa4, 0x06, 0x0a, 0x03, 0x41, 0x43, 0x4c, 0x12, 0x40, 0x0a, - 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, - 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x4d, 0x0a, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, + 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x46, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x22, 0xad, 0x01, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x55, 0x73, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x73, 0x68, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x73, 0x68, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x03, 0x61, + 0x63, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x0e, - 0x61, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x3a, - 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, - 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x75, 0x73, - 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, + 0x41, 0x43, 0x4c, 0x52, 0x03, 0x61, 0x63, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x73, 0x22, 0xa4, 0x06, 0x0a, 0x03, 0x41, 0x43, 0x4c, 0x12, 0x40, 0x0a, 0x08, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, + 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, + 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4d, 0x0a, 0x0f, 0x61, + 0x75, 0x74, 0x68, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, + 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x72, 0x6f, + 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, - 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x4f, 0x0a, 0x10, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, - 0x64, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x0f, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3c, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x65, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3c, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x73, 0x12, 0x3e, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, - 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x73, 0x12, 0x38, 0x0a, 0x04, 0x61, 0x70, 0x70, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x05, 0x75, 0x73, 0x65, + 0x72, 0x73, 0x12, 0x4f, 0x0a, 0x10, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, + 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, + 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x52, 0x0f, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x73, 0x12, 0x3c, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, + 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0x3c, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x04, 0x61, 0x70, 0x70, 0x73, 0x12, 0x36, 0x0a, - 0x03, 0x64, 0x62, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, - 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x03, 0x64, 0x62, 0x73, 0x12, 0x46, 0x0a, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, - 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, - 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, - 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, + 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, + 0x3e, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, + 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, + 0x38, 0x0a, 0x04, 0x61, 0x70, 0x70, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, + 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x52, 0x04, 0x61, 0x70, 0x70, 0x73, 0x12, 0x36, 0x0a, 0x03, 0x64, 0x62, 0x73, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x0e, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x22, 0x7c, 0x0a, 0x0e, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x12, - 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6c, 0x69, - 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x04, 0x72, 0x65, 0x61, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x64, 0x69, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x65, 0x64, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61, 0x76, 0x69, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x6c, 0x69, 0x62, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x2f, 0x76, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x03, 0x64, 0x62, + 0x73, 0x12, 0x46, 0x0a, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x6b, 0x75, + 0x62, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, 0x0f, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x74, 0x65, + 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x22, 0x7c, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x72, 0x65, + 0x61, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x64, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x04, 0x65, 0x64, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x22, 0x46, 0x0a, 0x08, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x61, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x5f, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x61, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x42, 0x33, + 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61, + 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x2f, 0x6c, 0x69, 0x62, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x72, 0x6d, + 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -553,33 +619,35 @@ func file_v1_cluster_proto_rawDescGZIP() []byte { return file_v1_cluster_proto_rawDescData } -var file_v1_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v1_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_v1_cluster_proto_goTypes = []interface{}{ (*Cluster)(nil), // 0: teleport.terminal.v1.Cluster (*LoggedInUser)(nil), // 1: teleport.terminal.v1.LoggedInUser (*ACL)(nil), // 2: teleport.terminal.v1.ACL (*ResourceAccess)(nil), // 3: teleport.terminal.v1.ResourceAccess + (*Features)(nil), // 4: teleport.terminal.v1.Features } var file_v1_cluster_proto_depIdxs = []int32{ 1, // 0: teleport.terminal.v1.Cluster.logged_in_user:type_name -> teleport.terminal.v1.LoggedInUser - 2, // 1: teleport.terminal.v1.LoggedInUser.acl:type_name -> teleport.terminal.v1.ACL - 3, // 2: teleport.terminal.v1.ACL.sessions:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 3: teleport.terminal.v1.ACL.auth_connectors:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 4: teleport.terminal.v1.ACL.roles:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 5: teleport.terminal.v1.ACL.users:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 6: teleport.terminal.v1.ACL.trusted_clusters:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 7: teleport.terminal.v1.ACL.events:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 8: teleport.terminal.v1.ACL.tokens:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 9: teleport.terminal.v1.ACL.servers:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 10: teleport.terminal.v1.ACL.apps:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 11: teleport.terminal.v1.ACL.dbs:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 12: teleport.terminal.v1.ACL.kubeservers:type_name -> teleport.terminal.v1.ResourceAccess - 3, // 13: teleport.terminal.v1.ACL.access_requests:type_name -> teleport.terminal.v1.ResourceAccess - 14, // [14:14] is the sub-list for method output_type - 14, // [14:14] is the sub-list for method input_type - 14, // [14:14] is the sub-list for extension type_name - 14, // [14:14] is the sub-list for extension extendee - 0, // [0:14] is the sub-list for field type_name + 4, // 1: teleport.terminal.v1.Cluster.features:type_name -> teleport.terminal.v1.Features + 2, // 2: teleport.terminal.v1.LoggedInUser.acl:type_name -> teleport.terminal.v1.ACL + 3, // 3: teleport.terminal.v1.ACL.sessions:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 4: teleport.terminal.v1.ACL.auth_connectors:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 5: teleport.terminal.v1.ACL.roles:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 6: teleport.terminal.v1.ACL.users:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 7: teleport.terminal.v1.ACL.trusted_clusters:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 8: teleport.terminal.v1.ACL.events:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 9: teleport.terminal.v1.ACL.tokens:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 10: teleport.terminal.v1.ACL.servers:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 11: teleport.terminal.v1.ACL.apps:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 12: teleport.terminal.v1.ACL.dbs:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 13: teleport.terminal.v1.ACL.kubeservers:type_name -> teleport.terminal.v1.ResourceAccess + 3, // 14: teleport.terminal.v1.ACL.access_requests:type_name -> teleport.terminal.v1.ResourceAccess + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_v1_cluster_proto_init() } @@ -636,6 +704,18 @@ func file_v1_cluster_proto_init() { return nil } } + file_v1_cluster_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Features); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -643,7 +723,7 @@ func file_v1_cluster_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_v1_cluster_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/lib/teleterm/api/protogen/js/v1/cluster_pb.d.ts b/lib/teleterm/api/protogen/js/v1/cluster_pb.d.ts index df5006cfbebb8..43674de59b855 100644 --- a/lib/teleterm/api/protogen/js/v1/cluster_pb.d.ts +++ b/lib/teleterm/api/protogen/js/v1/cluster_pb.d.ts @@ -29,6 +29,12 @@ export class Cluster extends jspb.Message { setLoggedInUser(value?: LoggedInUser): Cluster; + hasFeatures(): boolean; + clearFeatures(): void; + getFeatures(): Features | undefined; + setFeatures(value?: Features): Cluster; + + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Cluster.AsObject; static toObject(includeInstance: boolean, msg: Cluster): Cluster.AsObject; @@ -47,6 +53,7 @@ export namespace Cluster { connected: boolean, leaf: boolean, loggedInUser?: LoggedInUser.AsObject, + features?: Features.AsObject, } } @@ -233,3 +240,24 @@ export namespace ResourceAccess { pb_delete: boolean, } } + +export class Features extends jspb.Message { + getAdvancedAccessWorkflows(): boolean; + setAdvancedAccessWorkflows(value: boolean): Features; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Features.AsObject; + static toObject(includeInstance: boolean, msg: Features): Features.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Features, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Features; + static deserializeBinaryFromReader(message: Features, reader: jspb.BinaryReader): Features; +} + +export namespace Features { + export type AsObject = { + advancedAccessWorkflows: boolean, + } +} diff --git a/lib/teleterm/api/protogen/js/v1/cluster_pb.js b/lib/teleterm/api/protogen/js/v1/cluster_pb.js index 4e88512edca43..c8f481c31d198 100644 --- a/lib/teleterm/api/protogen/js/v1/cluster_pb.js +++ b/lib/teleterm/api/protogen/js/v1/cluster_pb.js @@ -17,6 +17,7 @@ var global = (function() { return this || window || global || self || Function(' goog.exportSymbol('proto.teleport.terminal.v1.ACL', null, global); goog.exportSymbol('proto.teleport.terminal.v1.Cluster', null, global); +goog.exportSymbol('proto.teleport.terminal.v1.Features', null, global); goog.exportSymbol('proto.teleport.terminal.v1.LoggedInUser', null, global); goog.exportSymbol('proto.teleport.terminal.v1.ResourceAccess', null, global); /** @@ -103,6 +104,27 @@ if (goog.DEBUG && !COMPILED) { */ proto.teleport.terminal.v1.ResourceAccess.displayName = 'proto.teleport.terminal.v1.ResourceAccess'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.teleport.terminal.v1.Features = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.teleport.terminal.v1.Features, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.teleport.terminal.v1.Features.displayName = 'proto.teleport.terminal.v1.Features'; +} @@ -140,7 +162,8 @@ proto.teleport.terminal.v1.Cluster.toObject = function(includeInstance, msg) { proxyHost: jspb.Message.getFieldWithDefault(msg, 3, ""), connected: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), leaf: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), - loggedInUser: (f = msg.getLoggedInUser()) && proto.teleport.terminal.v1.LoggedInUser.toObject(includeInstance, f) + loggedInUser: (f = msg.getLoggedInUser()) && proto.teleport.terminal.v1.LoggedInUser.toObject(includeInstance, f), + features: (f = msg.getFeatures()) && proto.teleport.terminal.v1.Features.toObject(includeInstance, f) }; if (includeInstance) { @@ -202,6 +225,11 @@ proto.teleport.terminal.v1.Cluster.deserializeBinaryFromReader = function(msg, r reader.readMessage(value,proto.teleport.terminal.v1.LoggedInUser.deserializeBinaryFromReader); msg.setLoggedInUser(value); break; + case 8: + var value = new proto.teleport.terminal.v1.Features; + reader.readMessage(value,proto.teleport.terminal.v1.Features.deserializeBinaryFromReader); + msg.setFeatures(value); + break; default: reader.skipField(); break; @@ -274,6 +302,14 @@ proto.teleport.terminal.v1.Cluster.serializeBinaryToWriter = function(message, w proto.teleport.terminal.v1.LoggedInUser.serializeBinaryToWriter ); } + f = message.getFeatures(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.teleport.terminal.v1.Features.serializeBinaryToWriter + ); + } }; @@ -404,6 +440,43 @@ proto.teleport.terminal.v1.Cluster.prototype.hasLoggedInUser = function() { }; +/** + * optional Features features = 8; + * @return {?proto.teleport.terminal.v1.Features} + */ +proto.teleport.terminal.v1.Cluster.prototype.getFeatures = function() { + return /** @type{?proto.teleport.terminal.v1.Features} */ ( + jspb.Message.getWrapperField(this, proto.teleport.terminal.v1.Features, 8)); +}; + + +/** + * @param {?proto.teleport.terminal.v1.Features|undefined} value + * @return {!proto.teleport.terminal.v1.Cluster} returns this +*/ +proto.teleport.terminal.v1.Cluster.prototype.setFeatures = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.teleport.terminal.v1.Cluster} returns this + */ +proto.teleport.terminal.v1.Cluster.prototype.clearFeatures = function() { + return this.setFeatures(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.teleport.terminal.v1.Cluster.prototype.hasFeatures = function() { + return jspb.Message.getField(this, 8) != null; +}; + + /** * List of repeated fields within this message type. @@ -1701,4 +1774,134 @@ proto.teleport.terminal.v1.ResourceAccess.prototype.setDelete = function(value) }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.teleport.terminal.v1.Features.prototype.toObject = function(opt_includeInstance) { + return proto.teleport.terminal.v1.Features.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.teleport.terminal.v1.Features} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.teleport.terminal.v1.Features.toObject = function(includeInstance, msg) { + var f, obj = { + advancedAccessWorkflows: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.teleport.terminal.v1.Features} + */ +proto.teleport.terminal.v1.Features.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.teleport.terminal.v1.Features; + return proto.teleport.terminal.v1.Features.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.teleport.terminal.v1.Features} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.teleport.terminal.v1.Features} + */ +proto.teleport.terminal.v1.Features.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAdvancedAccessWorkflows(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.teleport.terminal.v1.Features.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.teleport.terminal.v1.Features.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.teleport.terminal.v1.Features} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.teleport.terminal.v1.Features.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAdvancedAccessWorkflows(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool advanced_access_workflows = 1; + * @return {boolean} + */ +proto.teleport.terminal.v1.Features.prototype.getAdvancedAccessWorkflows = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.teleport.terminal.v1.Features} returns this + */ +proto.teleport.terminal.v1.Features.prototype.setAdvancedAccessWorkflows = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + goog.object.extend(exports, proto.teleport.terminal.v1); From 65c76f1ea47a474bc7ed563c1d54206012f3c653 Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Mon, 17 Oct 2022 14:01:22 -0500 Subject: [PATCH 3/9] Handle GetClusterFeatures error --- lib/teleterm/daemon/daemon.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/teleterm/daemon/daemon.go b/lib/teleterm/daemon/daemon.go index 08f6a0a949227..5f9f74027aca4 100644 --- a/lib/teleterm/daemon/daemon.go +++ b/lib/teleterm/daemon/daemon.go @@ -117,6 +117,10 @@ func (s *Service) GetCluster(ctx context.Context, uri string) (*clusters.Cluster } features, err := cluster.GetClusterFeatures(ctx) + if err != nil { + return nil, trace.Wrap(err) + } + cluster.Features = features return cluster, nil From 681d7c9ded514cf1f9bde0360dffc99794be4b58 Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Mon, 17 Oct 2022 17:20:27 -0500 Subject: [PATCH 4/9] Remove extra lines before err handling --- lib/teleterm/clusters/cluster.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/teleterm/clusters/cluster.go b/lib/teleterm/clusters/cluster.go index 07baae7179734..6a7cb734bcd61 100644 --- a/lib/teleterm/clusters/cluster.go +++ b/lib/teleterm/clusters/cluster.go @@ -72,10 +72,8 @@ func (c *Cluster) GetClusterFeatures(ctx context.Context) (*proto.Features, erro defer proxyClient.Close() authPingResponse, err = proxyClient.CurrentCluster().Ping(ctx) - return trace.Wrap(err) }) - if err != nil { return nil, trace.Wrap(err) } From 94337d9b9065f529786dbbb4b63dfb3df044a57c Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Wed, 19 Oct 2022 17:53:57 -0500 Subject: [PATCH 5/9] Update comments around Feature in clusters.Cluster related operations --- lib/teleterm/api/proto/v1/cluster.proto | 2 ++ lib/teleterm/api/proto/v1/service.proto | 2 ++ lib/teleterm/clusters/cluster.go | 2 ++ lib/teleterm/daemon/daemon.go | 4 +++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/teleterm/api/proto/v1/cluster.proto b/lib/teleterm/api/proto/v1/cluster.proto index 5c32b2c8c2909..81af7d946a376 100644 --- a/lib/teleterm/api/proto/v1/cluster.proto +++ b/lib/teleterm/api/proto/v1/cluster.proto @@ -34,6 +34,8 @@ message Cluster { // User is the cluster access control list of the logged-in user LoggedInUser logged_in_user = 7; // features describes the auth servers features + // Only present in situations where detailed + // information is queried from the auth server. Features features = 8; } diff --git a/lib/teleterm/api/proto/v1/service.proto b/lib/teleterm/api/proto/v1/service.proto index 677b05fbba2c4..51ec2637d8d05 100644 --- a/lib/teleterm/api/proto/v1/service.proto +++ b/lib/teleterm/api/proto/v1/service.proto @@ -30,8 +30,10 @@ option go_package = "github.com/gravitational/teleport/lib/teleterm/v1"; // TerminalService describes Teleterm service service TerminalService { // ListRootClusters lists root clusters + // Does not include detailed cluster information that would require a network request. rpc ListRootClusters(ListClustersRequest) returns (ListClustersResponse); // ListLeafClusters lists leaf clusters + // Does not include detailed cluster information that would require a network request. rpc ListLeafClusters(ListLeafClustersRequest) returns (ListClustersResponse); // GetAllDatabases lists all databases without pagination rpc GetAllDatabases(GetAllDatabasesRequest) returns (GetAllDatabasesResponse); diff --git a/lib/teleterm/clusters/cluster.go b/lib/teleterm/clusters/cluster.go index 6a7cb734bcd61..6a20c2c618681 100644 --- a/lib/teleterm/clusters/cluster.go +++ b/lib/teleterm/clusters/cluster.go @@ -52,6 +52,8 @@ type Cluster struct { // clock is a clock for time-related operations clock clockwork.Clock // Auth server features + // only present where the auth client can be queried + // and set with GetClusterFeatures Features *proto.Features } diff --git a/lib/teleterm/daemon/daemon.go b/lib/teleterm/daemon/daemon.go index 5f9f74027aca4..95cc25f693f8d 100644 --- a/lib/teleterm/daemon/daemon.go +++ b/lib/teleterm/daemon/daemon.go @@ -99,7 +99,9 @@ func (s *Service) RemoveCluster(ctx context.Context, uri string) error { return nil } -// ResolveCluster resolves a cluster by URI +// ResolveCluster resolves a cluster by URI and returns +// information stored in the profile along with a TeleportClient. +// It will not include detailed information returned from the web/auth servers func (s *Service) ResolveCluster(uri string) (*clusters.Cluster, error) { cluster, err := s.cfg.Storage.GetByResourceURI(uri) if err != nil { From 3b82f5dc0fac2a05877aa3335f88adcc20676649 Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Wed, 19 Oct 2022 17:54:33 -0500 Subject: [PATCH 6/9] Conditionally set features field in cluster proto responses --- .../apiserver/handler/handler_clusters.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/teleterm/apiserver/handler/handler_clusters.go b/lib/teleterm/apiserver/handler/handler_clusters.go index c919504da3e4a..e234201a1a16f 100644 --- a/lib/teleterm/apiserver/handler/handler_clusters.go +++ b/lib/teleterm/apiserver/handler/handler_clusters.go @@ -86,14 +86,11 @@ func (s *Handler) GetCluster(ctx context.Context, req *api.GetClusterRequest) (* func newAPIRootCluster(cluster *clusters.Cluster) *api.Cluster { loggedInUser := cluster.GetLoggedInUser() - return &api.Cluster{ + apiCluster := &api.Cluster{ Uri: cluster.URI.String(), Name: cluster.Name, ProxyHost: cluster.GetProxyHost(), Connected: cluster.Connected(), - Features: &api.Features{ - AdvancedAccessWorkflows: cluster.Features.GetAdvancedAccessWorkflows(), - }, LoggedInUser: &api.LoggedInUser{ Name: loggedInUser.Name, SshLogins: loggedInUser.SSHLogins, @@ -101,6 +98,16 @@ func newAPIRootCluster(cluster *clusters.Cluster) *api.Cluster { ActiveRequests: loggedInUser.ActiveRequests, }, } + + // Only include features in the api response if they + // exist on the supplied cluster + if cluster.Features != nil { + apiCluster.Features = &api.Features{ + AdvancedAccessWorkflows: cluster.Features.GetAdvancedAccessWorkflows(), + } + } + + return apiCluster } func newAPILeafCluster(leaf clusters.LeafCluster) *api.Cluster { From 636680147ef9bcf0b087ff8a536fa9391f427cbf Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Wed, 19 Oct 2022 17:54:39 -0500 Subject: [PATCH 7/9] Protofiles --- lib/teleterm/api/protogen/golang/v1/cluster.pb.go | 2 ++ lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go | 4 ++++ lib/teleterm/api/protogen/js/v1/service_grpc_pb.js | 2 ++ 3 files changed, 8 insertions(+) diff --git a/lib/teleterm/api/protogen/golang/v1/cluster.pb.go b/lib/teleterm/api/protogen/golang/v1/cluster.pb.go index 9974e76b27c0c..e9384697ebdd0 100644 --- a/lib/teleterm/api/protogen/golang/v1/cluster.pb.go +++ b/lib/teleterm/api/protogen/golang/v1/cluster.pb.go @@ -54,6 +54,8 @@ type Cluster struct { // User is the cluster access control list of the logged-in user LoggedInUser *LoggedInUser `protobuf:"bytes,7,opt,name=logged_in_user,json=loggedInUser,proto3" json:"logged_in_user,omitempty"` // features describes the auth servers features + // Only present in situations where detailed + // information is queried from the auth server. Features *Features `protobuf:"bytes,8,opt,name=features,proto3" json:"features,omitempty"` } diff --git a/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go b/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go index 27fdab7c3597e..762c483902bbe 100644 --- a/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go +++ b/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go @@ -23,8 +23,10 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type TerminalServiceClient interface { // ListRootClusters lists root clusters + // Does not include detailed cluster information that would require a network request. ListRootClusters(ctx context.Context, in *ListClustersRequest, opts ...grpc.CallOption) (*ListClustersResponse, error) // ListLeafClusters lists leaf clusters + // Does not include detailed cluster information that would require a network request. ListLeafClusters(ctx context.Context, in *ListLeafClustersRequest, opts ...grpc.CallOption) (*ListClustersResponse, error) // GetAllDatabases lists all databases without pagination GetAllDatabases(ctx context.Context, in *GetAllDatabasesRequest, opts ...grpc.CallOption) (*GetAllDatabasesResponse, error) @@ -444,8 +446,10 @@ func (x *terminalServiceTransferFileClient) Recv() (*FileTransferProgress, error // for forward compatibility type TerminalServiceServer interface { // ListRootClusters lists root clusters + // Does not include detailed cluster information that would require a network request. ListRootClusters(context.Context, *ListClustersRequest) (*ListClustersResponse, error) // ListLeafClusters lists leaf clusters + // Does not include detailed cluster information that would require a network request. ListLeafClusters(context.Context, *ListLeafClustersRequest) (*ListClustersResponse, error) // GetAllDatabases lists all databases without pagination GetAllDatabases(context.Context, *GetAllDatabasesRequest) (*GetAllDatabasesResponse, error) diff --git a/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js b/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js index 16721498c7e3a..f2734c4bffa4c 100644 --- a/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js +++ b/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js @@ -603,6 +603,7 @@ function deserialize_teleport_terminal_v1_SetGatewayTargetSubresourceNameRequest // TerminalService describes Teleterm service var TerminalServiceService = exports.TerminalServiceService = { // ListRootClusters lists root clusters +// Does not include detailed cluster information that would require a network request. listRootClusters: { path: '/teleport.terminal.v1.TerminalService/ListRootClusters', requestStream: false, @@ -615,6 +616,7 @@ listRootClusters: { responseDeserialize: deserialize_teleport_terminal_v1_ListClustersResponse, }, // ListLeafClusters lists leaf clusters +// Does not include detailed cluster information that would require a network request. listLeafClusters: { path: '/teleport.terminal.v1.TerminalService/ListLeafClusters', requestStream: false, From fb06ef743fd58a2f28a91d9821ba5d795351f89a Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Thu, 20 Oct 2022 11:43:40 -0500 Subject: [PATCH 8/9] Update GetCluster comment --- lib/teleterm/api/proto/v1/service.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/teleterm/api/proto/v1/service.proto b/lib/teleterm/api/proto/v1/service.proto index 51ec2637d8d05..028d51255eafe 100644 --- a/lib/teleterm/api/proto/v1/service.proto +++ b/lib/teleterm/api/proto/v1/service.proto @@ -91,7 +91,8 @@ service TerminalService { // GetAuthSettings returns cluster auth settigns rpc GetAuthSettings(GetAuthSettingsRequest) returns (AuthSettings); - // GetCluster returns a cluster + // GetCluster returns cluster. Makes a network request and includes detailed + // information about enterprise features availabed on the connected auth server rpc GetCluster(GetClusterRequest) returns (Cluster); // Login logs in a user to a cluster rpc Login(LoginRequest) returns (EmptyResponse); From 477d0586ba81cfeba12aafa7f270be9d379d7103 Mon Sep 17 00:00:00 2001 From: Michael Myers Date: Thu, 20 Oct 2022 11:44:05 -0500 Subject: [PATCH 9/9] Update protofiles --- lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go | 6 ++++-- lib/teleterm/api/protogen/js/v1/service_grpc_pb.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go b/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go index 762c483902bbe..f3d14b9cccd06 100644 --- a/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go +++ b/lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go @@ -82,7 +82,8 @@ type TerminalServiceClient interface { SetGatewayLocalPort(ctx context.Context, in *SetGatewayLocalPortRequest, opts ...grpc.CallOption) (*Gateway, error) // GetAuthSettings returns cluster auth settigns GetAuthSettings(ctx context.Context, in *GetAuthSettingsRequest, opts ...grpc.CallOption) (*AuthSettings, error) - // GetCluster returns a cluster + // GetCluster returns cluster. Makes a network request and includes detailed + // information about enterprise features availabed on the connected auth server GetCluster(ctx context.Context, in *GetClusterRequest, opts ...grpc.CallOption) (*Cluster, error) // Login logs in a user to a cluster Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*EmptyResponse, error) @@ -505,7 +506,8 @@ type TerminalServiceServer interface { SetGatewayLocalPort(context.Context, *SetGatewayLocalPortRequest) (*Gateway, error) // GetAuthSettings returns cluster auth settigns GetAuthSettings(context.Context, *GetAuthSettingsRequest) (*AuthSettings, error) - // GetCluster returns a cluster + // GetCluster returns cluster. Makes a network request and includes detailed + // information about enterprise features availabed on the connected auth server GetCluster(context.Context, *GetClusterRequest) (*Cluster, error) // Login logs in a user to a cluster Login(context.Context, *LoginRequest) (*EmptyResponse, error) diff --git a/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js b/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js index f2734c4bffa4c..96bab62366f8f 100644 --- a/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js +++ b/lib/teleterm/api/protogen/js/v1/service_grpc_pb.js @@ -922,7 +922,8 @@ getAuthSettings: { responseSerialize: serialize_teleport_terminal_v1_AuthSettings, responseDeserialize: deserialize_teleport_terminal_v1_AuthSettings, }, - // GetCluster returns a cluster + // GetCluster returns cluster. Makes a network request and includes detailed +// information about enterprise features availabed on the connected auth server getCluster: { path: '/teleport.terminal.v1.TerminalService/GetCluster', requestStream: false,