From 3e07b2ffaf6073e58379479bd9daeec25472521c Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 26 May 2023 15:45:20 -0700 Subject: [PATCH] bsr: rename fields and remove project id from meta --- internal/bsr/bsr.go | 4 ++-- internal/bsr/meta_session.go | 19 ++++++++----------- internal/bsr/testing.go | 4 +--- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/internal/bsr/bsr.go b/internal/bsr/bsr.go index ca57ffd2e1..79cfc2a162 100644 --- a/internal/bsr/bsr.go +++ b/internal/bsr/bsr.go @@ -59,8 +59,8 @@ func NewSession(ctx context.Context, meta *SessionRecordingMeta, sessionMeta *Se case len(sessionMeta.StaticJSONCredentials) == 0 && len(sessionMeta.StaticUsernamePasswordCredentials) == 0 && len(sessionMeta.StaticSshPrivateKeyCredentials) == 0 && - len(sessionMeta.VaultLibraries) == 0 && - len(sessionMeta.VaultSshCertLibraries) == 0: + len(sessionMeta.VaultGenericLibraries) == 0 && + len(sessionMeta.VaultSshCertificateLibraries) == 0: return nil, fmt.Errorf("%s: missing credential information: %w", op, ErrInvalidParameter) case is.Nil(sessionMeta.User): return nil, fmt.Errorf("%s: missing session user: %w", op, ErrInvalidParameter) diff --git a/internal/bsr/meta_session.go b/internal/bsr/meta_session.go index 5dd3b9da19..ad2b44f399 100644 --- a/internal/bsr/meta_session.go +++ b/internal/bsr/meta_session.go @@ -89,7 +89,6 @@ type StaticCredentialStore struct { // StaticJsonCredential represents a static json credential used for this session type StaticJsonCredential struct { PublicId string - ProjectId string Name string // optional field Description string // optional field ObjectHmac []byte @@ -100,9 +99,9 @@ type StaticJsonCredential struct { // StaticUsernamePasswordCredential represents a Static username password credential used for this session type StaticUsernamePasswordCredential struct { PublicId string - ProjectId string Name string // optional field Description string // optional field + Username string PasswordHmac []byte Purposes []string CredentialStore StaticCredentialStore @@ -111,9 +110,9 @@ type StaticUsernamePasswordCredential struct { // StaticSshPrivateKeyCredential represents a Static Ssh private key credential used for this session type StaticSshPrivateKeyCredential struct { PublicId string - ProjectId string Name string // optional field Description string // optional field + Username string PrivateKeyHmac []byte PrivateKeyPassphraseHmac []byte // optional field Purposes []string @@ -133,10 +132,9 @@ type VaultCredentialStore struct { WorkerFilter string // optional field } -// VaultLibrary contains information about the Vault library used for this session -type VaultLibrary struct { +// VaultGenericLibrary contains information about the Vault library used for this session +type VaultGenericLibrary struct { PublicId string - ProjectId string Name string // optional field Description string // optional field VaultPath string @@ -147,10 +145,9 @@ type VaultLibrary struct { CredentialStore VaultCredentialStore } -// VaultSshCertLibrary contains information about a Vault Ssh Cert library for this session -type VaultSshCertLibrary struct { +// VaultSshCertificateLibrary contains information about a Vault Ssh Cert library for this session +type VaultSshCertificateLibrary struct { PublicId string - ProjectId string Name string // optional field Description string // optional field VaultPath string @@ -179,6 +176,6 @@ type SessionMeta struct { StaticJSONCredentials []StaticJsonCredential StaticUsernamePasswordCredentials []StaticUsernamePasswordCredential StaticSshPrivateKeyCredentials []StaticSshPrivateKeyCredential - VaultLibraries []VaultLibrary - VaultSshCertLibraries []VaultSshCertLibrary + VaultGenericLibraries []VaultGenericLibrary + VaultSshCertificateLibraries []VaultSshCertificateLibrary } diff --git a/internal/bsr/testing.go b/internal/bsr/testing.go index c6a9d688de..db4128391e 100644 --- a/internal/bsr/testing.go +++ b/internal/bsr/testing.go @@ -48,7 +48,6 @@ func TestSessionMeta(s string) *SessionMeta { StaticJSONCredentials: []StaticJsonCredential{ { PublicId: "scjson123", - ProjectId: "proj123", ObjectHmac: []byte("hmac"), CredentialStore: StaticCredentialStore{ PublicId: "scs123", @@ -56,10 +55,9 @@ func TestSessionMeta(s string) *SessionMeta { }, }, }, - VaultLibraries: []VaultLibrary{ + VaultGenericLibraries: []VaultGenericLibrary{ { PublicId: "vl123", - ProjectId: "proj123", VaultPath: "/a/path", HttpMethod: "GET", CredentialType: "magic",