add session recording API definitions

This commit is contained in:
Johan Brandhorst-Satzkorn authored and Timothy Messier committed 2023-05-31 12:18:10 +00:00
1 parent 7bb44b46f5
commit 7632143861
9 files changed
+2720 -1

No files matched your search

@@ -0,0 +1,176 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
package controller.api.resources.sessionrecordings.v1;
import "controller/api/resources/scopes/v1/scope.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/session_recordings;session_recordings";
// ChannelRecording contains recorded information about a single Channel within a Connection.
// Channels are only present in multiplexed protocols, such as SSH.
message ChannelRecording {
// The ID of the Channel recording.
string id = 1; // @gotags: class:"public"
// The total number of bytes uploaded from the client in the Channel.
uint64 bytes_up = 2 [json_name = "bytes_up"]; // @gotags: class:"public"
// The total number of bytes downloaded to the client in the Channel.
uint64 bytes_down = 3 [json_name = "bytes_down"]; // @gotags: class:"public"
// The time the Channel started.
google.protobuf.Timestamp start_time = 4 [json_name = "start_time"]; // @gotags: class:"public"
// The time the Channel ended.
google.protobuf.Timestamp end_time = 5 [json_name = "end_time"]; // @gotags: class:"public"
// The total duration of the Channel.
google.protobuf.Duration duration = 6; // @gotags: class:"public"
// MimeTypes define the mime types that can
// be used to consume the recording of this Channel.
// The only supported mime type is "application/x-asciicast".
repeated string mime_types = 7 [json_name = "mime_types"]; // @gotags: class:"public"
}
// ConnectionRecording contains the recording of a single Connection within a Session.
message ConnectionRecording {
// The ID of the Connection recording.
string id = 1; // @gotags: class:"public"
// The ID of the Connection this is a recording of.
string connection_id = 2 [json_name = "connection_id"]; // @gotags: class:"public"
// The total number of bytes uploaded from the client in the Connection.
// This includes any protocol overhead.
uint64 bytes_up = 3 [json_name = "bytes_up"]; // @gotags: class:"public"
// The total number of bytes downloaded to the client in the Connection.
// This includes any protocol overhead.
uint64 bytes_down = 4 [json_name = "bytes_down"]; // @gotags: class:"public"
// The time the Connection started.
google.protobuf.Timestamp start_time = 5 [json_name = "start_time"]; // @gotags: class:"public"
// The time the Connection ended.
google.protobuf.Timestamp end_time = 6 [json_name = "end_time"]; // @gotags: class:"public"
// The total duration of the Connection.
google.protobuf.Duration duration = 7; // @gotags: class:"public"
// MimeTypes define the mime types that can
// be used to consume the recording of this Connection.
// No mime types are currently supported.
repeated string mime_types = 8 [json_name = "mime_types"]; // @gotags: class:"public"
// Optionally, the channels used in this Connection,
// if it is using a multiplexed protocol, such as SSH.
repeated ChannelRecording channel_recordings = 9 [json_name = "channel_recordings"];
}
// User describes an authenticated user in Boundary.
message User {
// The ID of the User.
string id = 1; // @gotags: class:"public"
// The name of the User that created the Session.
string name = 2; // @gotags: class:"sensitive"
// The description of the User that created the Session.
string description = 3; // @gotags: class:"sensitive"
// The full name of the User that created the Session,
// inferred from the account used by the user.
string full_name = 4 [json_name = "full_name"]; // @gotags: class:"sensitive"
// The login name of the User that created the Session,
// inferred from the account used by the user.
string login_name = 5 [json_name = "login_name"]; // @gotags: class:"sensitive"
// The email of the User that created the Session,
// inferred from the account used by the user.
string email = 6; // @gotags: class:"sensitive"
// The scope that the User is in.
resources.scopes.v1.ScopeInfo scope = 7;
// The ID of the account that the User that created the Session authenticated with.
string account_id = 8 [json_name = "account_id"]; // @gotags: class:"public"
}
// Target describes a target in Boundary.
message Target {
// The ID of the Target.
string id = 1; // @gotags: class:"public"
// The name of the Target.
string name = 2; // @gotags: class:"public"
// The project that the Target is in.
resources.scopes.v1.ScopeInfo scope = 3;
// The ID of the storage bucket this Target's recordings use.
string storage_bucket_id = 4 [json_name = "storage_bucket_id"]; // @gotags: class:"public"
}
// SessionRecording contains information about the recording of a Session.
message SessionRecording {
// The ID of the Session recording.
string id = 1; // @gotags: class:"public"
// The scope that the Session Recording is in.
// This is inferred from the storage bucket associated
// with the target.
resources.scopes.v1.ScopeInfo scope = 2;
// Information about the User that created the Session.
User user = 3;
// The ID of the Session which this Session Recording recorded.
string session_id = 4 [json_name = "session_id"]; // @gotags: class:"public"
// Information about the Target the Session connected to.
Target target = 5;
// The total number of bytes uploaded from the client in the Session.
// This includes all bytes uploaded over all Connections, including
// any protocol overhead.
uint64 bytes_up = 6 [json_name = "bytes_up"]; // @gotags: class:"public"
// The total number of bytes downloaded to the client in the Session.
// This includes all bytes downloaded over all Connections, including
// any protocol overhead.
uint64 bytes_down = 7 [json_name = "bytes_down"]; // @gotags: class:"public"
// The time the Session started.
google.protobuf.Timestamp start_time = 8 [json_name = "start_time"]; // @gotags: class:"public"
// The time the Session ended.
google.protobuf.Timestamp end_time = 9 [json_name = "end_time"]; // @gotags: class:"public"
// The total duration of the Session.
google.protobuf.Duration duration = 10; // @gotags: class:"public"
// The time that the Session recording will be deleted.
google.protobuf.Timestamp delete_on = 11 [json_name = "delete_on"]; // @gotags: class:"public"
// Type of the Session that was recorded (e.g. ssh).
string type = 12; // @gotags: class:"public"
// MimeTypes define the mime types that can
// be used to consume the recording of this Session.
// No mime types are currently supported.
repeated string mime_types = 13 [json_name = "mime_types"]; // @gotags: class:"public"
// The recordings of the connections that were created in the Session.
// This field may be unset when listing Session recordings.
repeated ConnectionRecording connection_recordings = 14 [json_name = "connection_recordings"];
// The available actions on this resource for this user.
repeated string authorized_actions = 15 [json_name = "authorized_actions"]; // @gotags: class:"public"
}
@@ -0,0 +1,80 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
package controller.api.services.v1;
import "controller/api/resources/sessionrecordings/v1/session_recording.proto";
import "google/api/annotations.proto";
import "google/api/httpbody.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services";
service SessionRecordingService {
// GetSessionRecording returns a stored Session recording if present. The provided request
// must include the Session recording ID for the Session recording being retrieved,
// or the ID of the Session that was recorded. If that ID is missing, malformed or reference a
// non existing resource, an error is returned.
rpc GetSessionRecording(GetSessionRecordingRequest) returns (GetSessionRecordingResponse) {
option (google.api.http) = {
get: "/v1/session-recordings/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {summary: "GetSessionRecording returns a stored Session recording if present. The provided request must include the Session recording ID for the Session recording being retrieved, or the ID of the Session that was recorded. If that ID is missing, malformed or reference a non existing resource, an error is returned."};
}
// ListSessionRecordings lists all session recordings.
// Session recordings are ordered by start_time descending (most recently started first).
rpc ListSessionRecordings(ListSessionRecordingsRequest) returns (ListSessionRecordingsResponse) {
option (google.api.http) = {get: "/v1/session-recordings"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {summary: "ListSessionRecordings lists all Session recordings. Session recordings are ordered by start_time descending (most recently started first)."};
}
// Download returns the contents of the specified resource in the specified mime type.
// Supports both Session ID and Session recording ID for looking up a Session recording.
// Supports both Connection ID and Connection recording ID to look up a Connection recording.
// A Channel recording ID is required to look up a Channel recording.
// The only supported mime type is "application/x-asciicast".
rpc Download(DownloadRequest) returns (stream google.api.HttpBody) {
option (google.api.http) = {get: "/v1/session-recordings/{id}:download"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {summary: "Download returns the contents of the specified resource in the specified mime type. Supports both Session ID and Session recording ID for looking up a Session recording. Supports both Connection ID and Connection recording ID to look up a Connection recording. A Channel recording ID is required to look up a Channel recording. The only supported mime type is \"application/x-asciicast\"."};
}
}
message GetSessionRecordingRequest {
// The ID of the Session recording, or the ID of the Session that was recorded.
string id = 1; // @gotags: class:"public"
}
message GetSessionRecordingResponse {
// The requested recording.
resources.sessionrecordings.v1.SessionRecording item = 1;
}
message ListSessionRecordingsRequest {
// The scope in which to list session recordings.
// Must be set unless recursive is set.
string scope_id = 1; // @gotags: class:"public"
// Whether to recurse into child scopes when listing.
// If set and scope_id is empty, shows session recordings in
// all scopes the caller has access to.
bool recursive = 2; // @gotags: class:"public"
}
message ListSessionRecordingsResponse {
// All Session recordings, ordered by start_time descending (most recently started first).
repeated resources.sessionrecordings.v1.SessionRecording items = 1;
}
message DownloadRequest {
// The ID of the resource that should be downloaded. Supported types:
// - Session ID and Session recording ID for Session recordings
// - Connection ID and Connection recording ID for Connection recordings
// - Channel recording ID for Channel recordings
string id = 1; // @gotags: class:"public"
// The format of the response. The only supported mime type is "application/x-asciicast".
// Defaults to "application/x-asciicast" if not set.
string mime_type = 2 [json_name = "mime_type"]; // @gotags: class:"public"
}