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
10 changes: 10 additions & 0 deletions lib/teleterm/api/proto/v1/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ 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
// Only present in situations where detailed
// information is queried from the auth server.
Features features = 8;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to include the entire ping response? It seems like knowing things like the version, whether or not it's a FIPS server, and if there are any license warnings might also be useful.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason besides wanting to keep the API concise and tidy to what is needed for this PR. Not opposed to adding in the extra, unused responses to prevent extra PRs in the future.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually recommended Michael to only include what he absolutely needs; it's easy to add to APIs, but hard to remove from them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like with the struct in the clusters package, I don't think it's good idea to have a field that's empty most of the time with the exception of one particular endpoint.

It might be better to introduce a new message, extending Cluster fields or copying them over (I don't know what capabilities protobufs offer in this area).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remarks as above, I think this is alright.

A few counter-examples in our codebase:

}

// LoggedInUser describes a logged-in user
Expand Down Expand Up @@ -90,3 +94,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;
}
5 changes: 4 additions & 1 deletion lib/teleterm/api/proto/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment to GetCluster that it makes a network request and returns detailed cluster information?

rpc ListLeafClusters(ListLeafClustersRequest) returns (ListClustersResponse);
// GetAllDatabases lists all databases without pagination
rpc GetAllDatabases(GetAllDatabasesRequest) returns (GetAllDatabasesResponse);
Expand Down Expand Up @@ -89,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);
Expand Down
258 changes: 170 additions & 88 deletions lib/teleterm/api/protogen/golang/v1/cluster.pb.go

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions lib/teleterm/api/protogen/golang/v1/service_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions lib/teleterm/api/protogen/js/v1/cluster_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -47,6 +53,7 @@ export namespace Cluster {
connected: boolean,
leaf: boolean,
loggedInUser?: LoggedInUser.AsObject,
features?: Features.AsObject,
}
}

Expand Down Expand Up @@ -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<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
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,
}
}
205 changes: 204 additions & 1 deletion lib/teleterm/api/protogen/js/v1/cluster_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
/**
Expand Down Expand Up @@ -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';
}



Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
);
}
};


Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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_<name>, 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);
Loading