Files
threshold/internal/bsr/testing.go
T
Timothy Messier 78ea1a9f3a refact(bsr): Use JSON for session meta and summary data
The session metadata is provided all at once when a new bsr is opened.
While the session recording metadata records metadata about a recording
while the recording is happening, notably it records each time a new
connection occurs.

The nested structure of the session metadata does not lend itself to the
append-only syntax of the recording meta file. In addition we do not
want to mix different kinds of metadata together. Thus the session
metadata is now written to a separate file in the BSR, and is written as
JSON which better handles the nested structure and allows for simpler
encoding/decoding.

Similarly the summary files are intended to be written to as containers
close and have been switched to JSON.
2023-05-31 12:18:23 +00:00

81 lines
1.7 KiB
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package bsr
func TestSessionRecordingMeta(s string, p Protocol) *SessionRecordingMeta {
return &SessionRecordingMeta{
Id: s,
Protocol: p,
}
}
func TestSessionMeta(s string) *SessionMeta {
return &SessionMeta{
PublicId: s,
User: &User{
PublicId: "user123",
Scope: Scope{
PublicId: "global",
Type: "global",
},
},
StaticHost: &StaticHost{
PublicId: "host123",
Catalog: StaticHostCatalog{
PublicId: "staticcat123",
ProjectId: "proj123",
},
Address: "127.0.0.1",
},
Target: &Target{
PublicId: "target123",
Scope: Scope{
PublicId: "proj123",
Type: "project",
ParentId: "org123",
},
DefaultPort: 0,
SessionMaxSeconds: 0,
SessionConnectionLimit: 0,
},
Worker: &Worker{
PublicId: "w_12345",
Version: "0.25.5",
Sha: "beepboopgitsha",
},
StaticCredentialStore: []StaticCredentialStore{
{
PublicId: "scs123",
ProjectId: "proj123",
StaticJsonCredentials: []StaticJsonCredential{
{
PublicId: "scjson123",
ProjectId: "proj123",
ObjectHmac: []byte("hmac"),
},
},
},
},
VaultCredentialStore: []VaultCredentialStore{
{
PublicId: "vcs123",
ProjectId: "proj123",
VaultAddress: "an/address",
Namespace: "name",
TlsServerName: "imaserver",
TlsSkipVerify: false,
VaultGenericLibraries: []VaultLibrary{
{
PublicId: "vl123",
ProjectId: "proj123",
VaultPath: "/a/path",
HttpMethod: "GET",
CredentialType: "magic",
},
},
},
},
}
}