Skip to content
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
2,322 changes: 910 additions & 1,412 deletions api/client/proto/authservice.pb.go

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions api/client/proto/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,6 @@ func (d *Duration) Set(value time.Duration) {
*d = Duration(value)
}

// FromWatchKind converts the watch kind value between internal
// and the protobuf format
func FromWatchKind(wk types.WatchKind) WatchKind {
return WatchKind{
Name: wk.Name,
Kind: wk.Kind,
SubKind: wk.SubKind,
LoadSecrets: wk.LoadSecrets,
Filter: wk.Filter,
}
}

// ToWatchKind converts the watch kind value between the protobuf
// and the internal format
func ToWatchKind(wk WatchKind) types.WatchKind {
return types.WatchKind{
Name: wk.Name,
Kind: wk.Kind,
SubKind: wk.SubKind,
LoadSecrets: wk.LoadSecrets,
Filter: wk.Filter,
}
}

// CheckAndSetDefaults checks and sets default values
func (req *HostCertsRequest) CheckAndSetDefaults() error {
if req.HostID == "" {
Expand Down
6 changes: 1 addition & 5 deletions api/client/streamwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ import (
// NewWatcher returns a new streamWatcher
func (c *Client) NewWatcher(ctx context.Context, watch types.Watch) (types.Watcher, error) {
cancelCtx, cancel := context.WithCancel(ctx)
var protoWatch proto.Watch
for _, kind := range watch.Kinds {
protoWatch.Kinds = append(protoWatch.Kinds, proto.FromWatchKind(kind))
}
stream, err := c.grpc.WatchEvents(cancelCtx, &protoWatch, c.callOpts...)
stream, err := c.grpc.WatchEvents(cancelCtx, &proto.Watch{Kinds: watch.Kinds}, c.callOpts...)
if err != nil {
cancel()
return nil, trail.FromGRPC(err)
Expand Down
2 changes: 1 addition & 1 deletion api/proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ lint:
- teleport/legacy/client/proto/joinservice.proto
breaking:
use:
- FILE
- WIRE_JSON
21 changes: 1 addition & 20 deletions api/proto/teleport/legacy/client/proto/authservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,12 @@ message Event {
// Watch specifies watch parameters
message Watch {
// Kinds specifies object kinds to watch
repeated WatchKind Kinds = 1 [
repeated types.WatchKind Kinds = 1 [
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "kinds,omitempty"
];
}

// WatchKind specifies resource kind to watch
message WatchKind {
// Kind is a resource kind to watch
string Kind = 1 [(gogoproto.jsontag) = "kind"];
// LoadSecrets specifies whether to load secrets
bool LoadSecrets = 2 [(gogoproto.jsontag) = "load_secrets"];
// Name is an optional specific resource type to watch,
// if specified only the events with a specific resource
// name will be sent
string Name = 3 [(gogoproto.jsontag) = "name"];
// Filter is an optional mapping of custom filter parameters.
// Valid values vary by resource kind.
map<string, string> Filter = 4 [(gogoproto.jsontag) = "filter,omitempty"];
// SubKind is a resource subkind to watch
string SubKind = 5 [(gogoproto.jsontag) = "sub_kind,omitempty"];
}

// HostCertsRequest specifies certificate-generation parameters
// for a server.
message HostCertsRequest {
Expand Down Expand Up @@ -306,8 +289,6 @@ message UserCertsRequest {
// reserving the struct field number 18 to prevent future breakage.
//
// https://github.com/gravitational/teleport/issues/24817
reserved 18;
reserved "RequesterName";

// SSHLogin is the OS Login for the SSH session that the certificate will be used for.
// This login is used when performing RBAC checks to determine if MFA is required
Expand Down
8 changes: 4 additions & 4 deletions api/proto/teleport/legacy/types/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3848,13 +3848,13 @@ message DatabaseSessionMalformedPacket {
// ElasticsearchCategory specifies Elasticsearch request category.
enum ElasticsearchCategory {
// GENERAL is for otherwise uncategorized calls.
GENERAL = 0;
ELASTICSEARCH_CATEGORY_GENERAL = 0;
// SECURITY is for _security and _ssl APIs.
SECURITY = 1;
ELASTICSEARCH_CATEGORY_SECURITY = 1;
// SEARCH is for search-related APIs.
SEARCH = 2;
ELASTICSEARCH_CATEGORY_SEARCH = 2;
// SQL covers _sql API.
SQL = 3;
ELASTICSEARCH_CATEGORY_SQL = 3;
}

// ElasticsearchRequest is emitted when user executes an Elasticsearch request, which isn't
Expand Down
19 changes: 19 additions & 0 deletions api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4674,3 +4674,22 @@ enum RequireMFAType {
// requiring double touch on session requests, normal Session MFA is disabled.
HARDWARE_KEY_TOUCH = 3;
}

// WatchKind specifies resource kind to watch
message WatchKind {
// Kind is a resource kind to watch
string Kind = 1 [(gogoproto.jsontag) = "kind"];
// LoadSecrets specifies whether to load secrets
bool LoadSecrets = 2 [(gogoproto.jsontag) = "load_secrets"];
// Name is an optional specific resource type to watch,
// if specified only the events with a specific resource
// name will be sent
string Name = 3 [(gogoproto.jsontag) = "name"];
// Filter is an optional mapping of custom filter parameters.
// Valid values vary by resource kind.
map<string, string> Filter = 4 [(gogoproto.jsontag) = "filter,omitempty"];
// SubKind is a resource subkind to watch
string SubKind = 5 [(gogoproto.jsontag) = "sub_kind,omitempty"];
// Version optionally specifies the resource version to watch.
string Version = 6 [(gogoproto.jsontag) = "version,omitempty"];
}
21 changes: 0 additions & 21 deletions api/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,6 @@ type Watch struct {
MetricComponent string
}

// WatchKind specifies resource kind to watch
type WatchKind struct {
// Kind is a resource kind to watch
Kind string
// SubKind optionally specifies the subkind of resource to watch.
// Some resource kinds are ambigious like web sessions, subkind in this case
// specifies the type of web session
SubKind string
// Name is an optional specific resource type to watch,
// if specified, only the events with the given resource
// name will be sent
Name string
// Version optionally specifies the resource version to watch.
Version string
// LoadSecrets specifies whether to load secrets
LoadSecrets bool
// Filter supplies custom event filter parameters that differ by
// resource (e.g. "state":"pending" for access requests).
Filter map[string]string
}

// Matches attempts to determine if the supplied event matches
// this WatchKind. If the WatchKind is misconfigured, or the
// event appears malformed, an error is returned.
Expand Down
Loading