From aef9073fa6ff90ce0bf974ceb86902a364669c22 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Thu, 25 Aug 2022 09:12:24 -0700 Subject: [PATCH] Upgrade to Go 1.19 (#2347) --- .go-version | 2 +- README.md | 2 +- api/go.mod | 5 +- api/go.sum | 2 - ci/goinstall.sh | 2 +- go.mod | 2 +- .../auth/oidc/repository_auth_method_read.go | 2 +- internal/authtoken/doc.go | 2 +- internal/cmd/base/servers.go | 10 +- internal/cmd/config/config.go | 1 - .../internal/sshprivatekey/sshprivatekey.go | 10 +- .../usernamepassword/usernamepassword.go | 10 +- internal/credential/vault/store/vault.pb.go | 8 +- internal/credential/vault/testing.go | 18 +- .../handlers/accounts/account_service.go | 6 +- .../authmethods/authmethod_service.go | 6 +- .../handlers/authtokens/authtoken_service.go | 6 +- .../credentiallibrary_service.go | 6 +- .../credentials/credential_service.go | 6 +- .../credentialstore_service.go | 6 +- .../daemon/controller/handlers/filtering.go | 2 +- .../handlers/groups/group_service.go | 6 +- .../host_catalogs/host_catalog_service.go | 10 +- .../handlers/host_sets/host_set_service.go | 10 +- .../controller/handlers/hosts/host_service.go | 10 +- .../managed_groups/managed_group_service.go | 6 +- .../controller/handlers/roles/role_service.go | 6 +- .../handlers/scopes/scope_service.go | 6 +- .../handlers/sessions/session_service.go | 6 +- .../handlers/targets/target_service.go | 6 +- .../controller/handlers/users/user_service.go | 6 +- .../handlers/workers/worker_service.go | 6 +- internal/daemon/worker/session/session.go | 2 +- internal/db/assert/docs.go | 42 ++--- internal/db/clause.go | 2 + internal/db/schema/doc.go | 15 +- .../db/schema/internal/edition/edition.go | 22 +-- .../db/schema/internal/postgres/postgres.go | 2 +- internal/db/schema/migration_log.go | 2 +- internal/db/schema/migrations/base.go | 1 + .../migrations/oss/internal/hook46001/hook.go | 1 - internal/db/schema/migrations/oss/oss.go | 1 + .../migrations/oss/postgres_11_01_test.go | 3 +- .../migrations/oss/postgres_12_01_test.go | 3 +- .../migrations/oss/postgres_2_10_test.go | 3 +- .../api/services/auth_method_service.pb.go | 3 + .../servers/services/credential.pb.go | 1 + .../server_coordination_service.pb.go | 1 + internal/gen/errors/errors.pb.go | 1 + .../gen/testing/attribute/attribute.pb.go | 3 + internal/host/plugin/store/host.pb.go | 3 +- internal/host/static/doc.go | 22 +-- internal/iam/principal_role.go | 2 +- internal/libs/crypto/derived_reader.go | 3 +- internal/libs/patchstruct/patchstruct.go | 22 +-- internal/oplog/any_operation.pb.go | 3 + internal/oplog/oplog.go | 3 +- internal/scheduler/job/doc.go | 38 ++-- internal/session/repository_session.go | 13 +- .../types/subtypes/attribute_transform.go | 14 +- internal/types/subtypes/interceptor.go | 167 +++++++++--------- internal/ui/assets.go | 1 + plugins/host/assets.go | 1 + plugins/kms/assets.go | 1 + sdk/go.mod | 2 +- .../api/resources/accounts/account.pb.go | 1 + .../resources/authmethods/auth_method.pb.go | 1 + .../credential_library.pb.go | 1 + .../resources/credentials/credential.pb.go | 1 + .../credentialstores/credential_store.pb.go | 1 + .../resources/hostcatalogs/host_catalog.pb.go | 1 + .../controller/api/resources/hosts/host.pb.go | 1 + .../api/resources/hostsets/host_set.pb.go | 1 + .../managedgroups/managed_group.pb.go | 1 + .../api/resources/targets/target.pb.go | 1 + testing/dbtest/docs.go | 16 +- ...on_list_benchmarks_dump_generation_test.go | 7 +- 77 files changed, 334 insertions(+), 294 deletions(-) diff --git a/.go-version b/.go-version index a67b05e87..815d5ca06 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.18.4 +1.19.0 diff --git a/README.md b/README.md index 030321585..85c926581 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ for permanent installations, are detailed in our [Installation Guide](https://ww ### Build and Start Boundary in Dev Mode If you have the following requirements met locally: -- Golang v1.18 or greater +- Golang v1.19 or greater - Docker - [Boundary UI Dependencies](https://github.com/hashicorp/boundary-ui#prerequisites) diff --git a/api/go.mod b/api/go.mod index 252021437..2cf229e9a 100644 --- a/api/go.mod +++ b/api/go.mod @@ -1,15 +1,15 @@ module github.com/hashicorp/boundary/api -go 1.18 +go 1.19 require ( - github.com/fatih/structs v1.1.0 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-kms-wrapping/v2 v2.0.1 github.com/hashicorp/go-retryablehttp v0.6.8 github.com/hashicorp/go-rootcerts v1.0.2 github.com/hashicorp/go-secure-stdlib/parseutil v0.1.1 github.com/hashicorp/go-uuid v1.0.2 + github.com/mitchellh/mapstructure v1.4.1 github.com/mr-tron/base58 v1.2.0 github.com/stretchr/testify v1.7.0 golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e @@ -27,7 +27,6 @@ require ( github.com/mattn/go-colorable v0.1.6 // indirect github.com/mattn/go-isatty v0.0.12 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.6.1 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect diff --git a/api/go.sum b/api/go.sum index e5ce1bcac..378727e6e 100644 --- a/api/go.sum +++ b/api/go.sum @@ -15,8 +15,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/ci/goinstall.sh b/ci/goinstall.sh index dc3c5f839..718c89505 100755 --- a/ci/goinstall.sh +++ b/ci/goinstall.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -VERSION="1.18.4" +VERSION="1.19" [ -z "$GOROOT" ] && GOROOT="$HOME/.go" [ -z "$GOPATH" ] && GOPATH="$HOME/go" diff --git a/go.mod b/go.mod index ddc256423..46d95885c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary -go 1.18 +go 1.19 replace github.com/hashicorp/boundary/api => ./api diff --git a/internal/auth/oidc/repository_auth_method_read.go b/internal/auth/oidc/repository_auth_method_read.go index f3675a8f9..4448731ee 100644 --- a/internal/auth/oidc/repository_auth_method_read.go +++ b/internal/auth/oidc/repository_auth_method_read.go @@ -28,7 +28,7 @@ func (r *Repository) LookupAuthMethod(ctx context.Context, publicId string, opt // ListAuthMethods returns a slice of AuthMethods for the scopeId. The // WithUnauthenticatedUser, WithLimit and WithOrder options are supported and -// all other options are ignored. +// all other options are ignored. func (r *Repository) ListAuthMethods(ctx context.Context, scopeIds []string, opt ...Option) ([]*AuthMethod, error) { const op = "oidc.(Repository).ListAuthMethods" if len(scopeIds) == 0 { diff --git a/internal/authtoken/doc.go b/internal/authtoken/doc.go index ecae023b9..aebc8e7e3 100644 --- a/internal/authtoken/doc.go +++ b/internal/authtoken/doc.go @@ -9,7 +9,7 @@ // expiration time and a last accessed time which are used to determine if the // token can still be used. // -// Repository +// # Repository // // A repository provides methods for creating, validating a provided token value, // and deleting the auth token. At validation time if the token is determined diff --git a/internal/cmd/base/servers.go b/internal/cmd/base/servers.go index e7ed4b227..316cd2237 100644 --- a/internal/cmd/base/servers.go +++ b/internal/cmd/base/servers.go @@ -855,11 +855,11 @@ func MakeSighupCh() chan struct{} { // // The setting is derived from one of the following, in order: // -// * Via the supplied value if non-zero. -// * BOUNDARY_STATUS_GRACE_PERIOD, if defined, can be set to an -// integer value to define the setting. -// * If either of these is missing, the default is used. See the -// defaultStatusGracePeriod value for the default value. +// - Via the supplied value if non-zero. +// - BOUNDARY_STATUS_GRACE_PERIOD, if defined, can be set to an +// integer value to define the setting. +// - If either of these is missing, the default is used. See the +// defaultStatusGracePeriod value for the default value. // // The minimum setting for this value is the default setting. Values // below this will be reset to the default. diff --git a/internal/cmd/config/config.go b/internal/cmd/config/config.go index 643b2854e..1bed08111 100644 --- a/internal/cmd/config/config.go +++ b/internal/cmd/config/config.go @@ -619,7 +619,6 @@ func Parse(d string) (*Config, error) { } // supportControllersRawConfig returns either initialUpstreamsRaw or controllersRaw depending on which is populated. Errors when both fields are populated. -// func supportControllersRawConfig(initialUpstreamsRaw, controllersRaw any) (any, error) { switch { case initialUpstreamsRaw == nil && controllersRaw != nil: diff --git a/internal/credential/vault/internal/sshprivatekey/sshprivatekey.go b/internal/credential/vault/internal/sshprivatekey/sshprivatekey.go index dd51bb574..370c6469a 100644 --- a/internal/credential/vault/internal/sshprivatekey/sshprivatekey.go +++ b/internal/credential/vault/internal/sshprivatekey/sshprivatekey.go @@ -97,10 +97,12 @@ func defaultExtract(sd data, usernameAttr, privateKeyAttr, passphraseAttr string // 'data' field within the data map. // // Additionaly it validates the data is in the expected KV-v2 format: -// { -// "data": {}, -// "metadata: {} -// } +// +// { +// "data": {}, +// "metadata: {} +// } +// // If the format does not match, it returns ("", ""). See: // https://www.vaultproject.io/api/secret/kv/kv-v2#sample-response-1 func kv2Extract(sd data, usernameAttr, privateKeyAttr, passphraseAttr string) ( diff --git a/internal/credential/vault/internal/usernamepassword/usernamepassword.go b/internal/credential/vault/internal/usernamepassword/usernamepassword.go index 279a0157c..7aa1ae3c6 100644 --- a/internal/credential/vault/internal/usernamepassword/usernamepassword.go +++ b/internal/credential/vault/internal/usernamepassword/usernamepassword.go @@ -82,10 +82,12 @@ func defaultExtract(sd data, usernameAttr, passwordAttr string) (username string // 'data' field within the data map. // // Additionaly it validates the data is in the expected KV-v2 format: -// { -// "data": {}, -// "metadata: {} -// } +// +// { +// "data": {}, +// "metadata: {} +// } +// // If the format does not match, it returns ("", ""). See: // https://www.vaultproject.io/api/secret/kv/kv-v2#sample-response-1 func kv2Extract(sd data, usernameAttr, passwordAttr string) (username string, password string) { diff --git a/internal/credential/vault/store/vault.pb.go b/internal/credential/vault/store/vault.pb.go index 05063e629..7a198ac30 100644 --- a/internal/credential/vault/store/vault.pb.go +++ b/internal/credential/vault/store/vault.pb.go @@ -248,7 +248,9 @@ type Token struct { // expiration_time is calculated when the token is renewed. // // The calculation is: - // expiration_time := time.Now().Add(LeaseDuration * time.Second) + // + // expiration_time := time.Now().Add(LeaseDuration * time.Second) + // // LeaseDuration is a value returned by Vault when the token is renewed. // // https://www.vaultproject.io/api-docs/auth/token#renew-a-token-self @@ -664,7 +666,9 @@ type Credential struct { // retrieved and whenever the credential's lease is renewed. // // The calculation is: - // expiration_time := time.Now().Add(LeaseDuration * time.Second) + // + // expiration_time := time.Now().Add(LeaseDuration * time.Second) + // // LeaseDuration is a value returned by Vault when the credential is // retrieved or the lease for the credential is renewed. // diff --git a/internal/credential/vault/testing.go b/internal/credential/vault/testing.go index 16ef04cc3..3a17a9a0f 100644 --- a/internal/credential/vault/testing.go +++ b/internal/credential/vault/testing.go @@ -738,9 +738,9 @@ func (v *TestVaultServer) addPolicy(t testing.TB, name string, pc pathCapabiliti // standard set of polices attached to tokens created with v.CreateToken. // The policy is defined as: // -// path "mountPath/*" { -// capabilities = ["create", "read", "update", "delete", "list"] -// } +// path "mountPath/*" { +// capabilities = ["create", "read", "update", "delete", "list"] +// } func (v *TestVaultServer) MountPKI(t testing.TB, opt ...TestOption) *vault.Secret { t.Helper() require := require.New(t) @@ -802,9 +802,9 @@ func (v *TestVaultServer) MountPKI(t testing.TB, opt ...TestOption) *vault.Secre // standard set of polices attached to tokens created with v.CreateToken. // The policy is defined as: // -// path "secret/*" { -// capabilities = ["create", "read", "update", "delete", "list"] -// } +// path "secret/*" { +// capabilities = ["create", "read", "update", "delete", "list"] +// } // // All options are ignored. func (v *TestVaultServer) AddKVPolicy(t testing.TB, _ ...TestOption) { @@ -872,9 +872,9 @@ func NewTestVaultServer(t testing.TB, opt ...TestOption) *TestVaultServer { // to the standard set of polices attached to tokens created with // v.CreateToken. The policy is defined as: // -// path "mountPath/*" { -// capabilities = ["create", "read", "update", "delete", "list"] -// } +// path "mountPath/*" { +// capabilities = ["create", "read", "update", "delete", "list"] +// } // // MountDatabase returns a TestDatabase for testing credentials from the // mount. diff --git a/internal/daemon/controller/handlers/accounts/account_service.go b/internal/daemon/controller/handlers/accounts/account_service.go index a5d3fd5aa..b82fd955a 100644 --- a/internal/daemon/controller/handlers/accounts/account_service.go +++ b/internal/daemon/controller/handlers/accounts/account_service.go @@ -936,9 +936,9 @@ func toStoragePwAccount(amId string, item *pb.Account) (*password.Account, error // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetAccountRequest) error { const op = "accounts.validateGetRequest" if req == nil { diff --git a/internal/daemon/controller/handlers/authmethods/authmethod_service.go b/internal/daemon/controller/handlers/authmethods/authmethod_service.go index a04c533d8..e708c4ca2 100644 --- a/internal/daemon/controller/handlers/authmethods/authmethod_service.go +++ b/internal/daemon/controller/handlers/authmethods/authmethod_service.go @@ -818,9 +818,9 @@ func toAuthTokenProto(t *authtoken.AuthToken) *pba.AuthToken { // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetAuthMethodRequest) error { const op = "authmethod.validateGetRequest" if req == nil { diff --git a/internal/daemon/controller/handlers/authtokens/authtoken_service.go b/internal/daemon/controller/handlers/authtokens/authtoken_service.go index e9e91b459..5efdfaa90 100644 --- a/internal/daemon/controller/handlers/authtokens/authtoken_service.go +++ b/internal/daemon/controller/handlers/authtokens/authtoken_service.go @@ -362,9 +362,9 @@ func toProto(ctx context.Context, in *authtoken.AuthToken, opt ...handlers.Optio // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetAuthTokenRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, authtoken.AuthTokenPrefix) } diff --git a/internal/daemon/controller/handlers/credentiallibraries/credentiallibrary_service.go b/internal/daemon/controller/handlers/credentiallibraries/credentiallibrary_service.go index dd4afb5a5..09af3371e 100644 --- a/internal/daemon/controller/handlers/credentiallibraries/credentiallibrary_service.go +++ b/internal/daemon/controller/handlers/credentiallibraries/credentiallibrary_service.go @@ -633,9 +633,9 @@ func toStorageVaultLibrary(storeId string, in *pb.CredentialLibrary) (out *vault // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetCredentialLibraryRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, vault.CredentialLibraryPrefix) } diff --git a/internal/daemon/controller/handlers/credentials/credential_service.go b/internal/daemon/controller/handlers/credentials/credential_service.go index 36dfdfdf8..dfb6f75e8 100644 --- a/internal/daemon/controller/handlers/credentials/credential_service.go +++ b/internal/daemon/controller/handlers/credentials/credential_service.go @@ -627,9 +627,9 @@ func toSshPrivateKeyStorageCredential(ctx context.Context, storeId string, in *p // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetCredentialRequest) error { return handlers.ValidateGetRequest( handlers.NoopValidatorFn, diff --git a/internal/daemon/controller/handlers/credentialstores/credentialstore_service.go b/internal/daemon/controller/handlers/credentialstores/credentialstore_service.go index cdda15f39..fb2ba7c79 100644 --- a/internal/daemon/controller/handlers/credentialstores/credentialstore_service.go +++ b/internal/daemon/controller/handlers/credentialstores/credentialstore_service.go @@ -770,9 +770,9 @@ func toStorageVaultStore(scopeId string, in *pb.CredentialStore) (out *vault.Cre // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetCredentialStoreRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, vault.CredentialStorePrefix, static.CredentialStorePrefix, static.PreviousCredentialStorePrefix) } diff --git a/internal/daemon/controller/handlers/filtering.go b/internal/daemon/controller/handlers/filtering.go index f09853681..7695af3bd 100644 --- a/internal/daemon/controller/handlers/filtering.go +++ b/internal/daemon/controller/handlers/filtering.go @@ -33,7 +33,7 @@ func NewFilter(f string) (*Filter, error) { // Match returns if the provided interface matches the filter. // If the filter does not match the structure of the object being Matched, false is returned. // TODO: Support more than just matching against the item being filtered. Also allow matching against -// values in the request or the request context itself. +// values in the request or the request context itself. func (f *Filter) Match(item interface{}) bool { if f.eval == nil { return true diff --git a/internal/daemon/controller/handlers/groups/group_service.go b/internal/daemon/controller/handlers/groups/group_service.go index ddba0efa4..250bfd123 100644 --- a/internal/daemon/controller/handlers/groups/group_service.go +++ b/internal/daemon/controller/handlers/groups/group_service.go @@ -651,9 +651,9 @@ func toProto(ctx context.Context, in *iam.Group, members []*iam.GroupMember, opt // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetGroupRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, iam.GroupPrefix) } diff --git a/internal/daemon/controller/handlers/host_catalogs/host_catalog_service.go b/internal/daemon/controller/handlers/host_catalogs/host_catalog_service.go index 79081450c..f4c827707 100644 --- a/internal/daemon/controller/handlers/host_catalogs/host_catalog_service.go +++ b/internal/daemon/controller/handlers/host_catalogs/host_catalog_service.go @@ -814,11 +814,11 @@ func toStoragePluginCatalog(ctx context.Context, projectId, plgId string, item * // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided -// * The type asserted by the ID and/or field is known -// * If relevant, the type derived from the id prefix matches what is claimed by the type field +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided +// - The type asserted by the ID and/or field is known +// - If relevant, the type derived from the id prefix matches what is claimed by the type field func validateGetRequest(req *pbs.GetHostCatalogRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, static.HostCatalogPrefix, plugin.HostCatalogPrefix, plugin.PreviousHostCatalogPrefix) } diff --git a/internal/daemon/controller/handlers/host_sets/host_set_service.go b/internal/daemon/controller/handlers/host_sets/host_set_service.go index a1f814a22..8a7e94191 100644 --- a/internal/daemon/controller/handlers/host_sets/host_set_service.go +++ b/internal/daemon/controller/handlers/host_sets/host_set_service.go @@ -937,11 +937,11 @@ func toStoragePluginSet(ctx context.Context, catalogId string, item *pb.HostSet) // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided -// * The type asserted by the ID and/or field is known -// * If relevant, the type derived from the id prefix matches what is claimed by the type field +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided +// - The type asserted by the ID and/or field is known +// - If relevant, the type derived from the id prefix matches what is claimed by the type field func validateGetRequest(req *pbs.GetHostSetRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, static.HostSetPrefix, plugin.HostSetPrefix, plugin.PreviousHostSetPrefix) } diff --git a/internal/daemon/controller/handlers/hosts/host_service.go b/internal/daemon/controller/handlers/hosts/host_service.go index 8505948c4..4c9ac35d7 100644 --- a/internal/daemon/controller/handlers/hosts/host_service.go +++ b/internal/daemon/controller/handlers/hosts/host_service.go @@ -601,11 +601,11 @@ func toProto(ctx context.Context, in host.Host, opt ...handlers.Option) (*pb.Hos // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided -// * The type asserted by the ID and/or field is known -// * If relevant, the type derived from the id prefix matches what is claimed by the type field +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided +// - The type asserted by the ID and/or field is known +// - If relevant, the type derived from the id prefix matches what is claimed by the type field func validateGetRequest(req *pbs.GetHostRequest) error { return handlers.ValidateGetRequest(func() map[string]string { badFields := map[string]string{} diff --git a/internal/daemon/controller/handlers/managed_groups/managed_group_service.go b/internal/daemon/controller/handlers/managed_groups/managed_group_service.go index c6621a4d2..15e02b3f4 100644 --- a/internal/daemon/controller/handlers/managed_groups/managed_group_service.go +++ b/internal/daemon/controller/handlers/managed_groups/managed_group_service.go @@ -572,9 +572,9 @@ func toProto(ctx context.Context, in auth.ManagedGroup, opt ...handlers.Option) // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetManagedGroupRequest) error { const op = "managed_groups.validateGetRequest" if req == nil { diff --git a/internal/daemon/controller/handlers/roles/role_service.go b/internal/daemon/controller/handlers/roles/role_service.go index 43ca3d3ef..7a35a521b 100644 --- a/internal/daemon/controller/handlers/roles/role_service.go +++ b/internal/daemon/controller/handlers/roles/role_service.go @@ -880,9 +880,9 @@ func toProto(ctx context.Context, in *iam.Role, principals []*iam.PrincipalRole, // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetRoleRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, iam.RolePrefix) } diff --git a/internal/daemon/controller/handlers/scopes/scope_service.go b/internal/daemon/controller/handlers/scopes/scope_service.go index 69a7148ba..25a23e8e1 100644 --- a/internal/daemon/controller/handlers/scopes/scope_service.go +++ b/internal/daemon/controller/handlers/scopes/scope_service.go @@ -591,9 +591,9 @@ func ToProto(ctx context.Context, in *iam.Scope, opt ...handlers.Option) (*pb.Sc // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetScopeRequest) error { badFields := map[string]string{} id := req.GetId() diff --git a/internal/daemon/controller/handlers/sessions/session_service.go b/internal/daemon/controller/handlers/sessions/session_service.go index f027dd5bb..99642f7a3 100644 --- a/internal/daemon/controller/handlers/sessions/session_service.go +++ b/internal/daemon/controller/handlers/sessions/session_service.go @@ -473,9 +473,9 @@ func toProto(ctx context.Context, in *session.Session, opt ...handlers.Option) ( // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetSessionRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, session.SessionPrefix) } diff --git a/internal/daemon/controller/handlers/targets/target_service.go b/internal/daemon/controller/handlers/targets/target_service.go index 576c997e0..15632a47f 100644 --- a/internal/daemon/controller/handlers/targets/target_service.go +++ b/internal/daemon/controller/handlers/targets/target_service.go @@ -1570,9 +1570,9 @@ func toProto(ctx context.Context, in target.Target, hostSources []target.HostSou // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetTargetRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, target.Prefixes()...) } diff --git a/internal/daemon/controller/handlers/users/user_service.go b/internal/daemon/controller/handlers/users/user_service.go index 963c212b9..526566c6e 100644 --- a/internal/daemon/controller/handlers/users/user_service.go +++ b/internal/daemon/controller/handlers/users/user_service.go @@ -661,9 +661,9 @@ func toProto(ctx context.Context, in *iam.User, accts []string, opt ...handlers. // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetUserRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, iam.UserPrefix) } diff --git a/internal/daemon/controller/handlers/workers/worker_service.go b/internal/daemon/controller/handlers/workers/worker_service.go index 23856c825..f43657b24 100644 --- a/internal/daemon/controller/handlers/workers/worker_service.go +++ b/internal/daemon/controller/handlers/workers/worker_service.go @@ -717,9 +717,9 @@ func tagsToMapProto(in map[string][]string) (map[string]*structpb.ListValue, err // A validateX method should exist for each method above. These methods do not make calls to any backing service but enforce // requirements on the structure of the request. They verify that: -// * The path passed in is correctly formatted -// * All required parameters are set -// * There are no conflicting parameters provided +// - The path passed in is correctly formatted +// - All required parameters are set +// - There are no conflicting parameters provided func validateGetRequest(req *pbs.GetWorkerRequest) error { return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, server.WorkerPrefix) } diff --git a/internal/daemon/worker/session/session.go b/internal/daemon/worker/session/session.go index 5a94199aa..738c4f83b 100644 --- a/internal/daemon/worker/session/session.go +++ b/internal/daemon/worker/session/session.go @@ -284,7 +284,7 @@ func (s *sess) RequestConnectConnection(ctx context.Context, info *pbs.ConnectCo } // CancelOpenLocalConnections closes the local connections in this session -//based on the connection's state by calling the connections context cancel +// based on the connection's state by calling the connections context cancel // function. // // The returned slice are connection ids that were closed. diff --git a/internal/db/assert/docs.go b/internal/db/assert/docs.go index 27ce15d26..2e8fc1e09 100644 --- a/internal/db/assert/docs.go +++ b/internal/db/assert/docs.go @@ -3,27 +3,27 @@ // // Example Usage: // -// import ( -// "testing" +// import ( +// "testing" // -// "github.com/hashicorp/internal/db/assert" -// ) +// "github.com/hashicorp/internal/db/assert" +// ) // -// func TestSomeDatabase(t *testing.T) { -// conn, err := sql.Open("postgres", "postgres://postgres:secret@localhost:%s?sslmode=disable") -// if err != nil { -// t.Fatal(err) -// } -// defer conn.Close() -// db, err := gorm.Open("postgres", conn) -// if err != nil { -// t.Fatal(err) -// } -// m := TestModel{} -// if err = rw.Create(&m); err != nil { -// t.Fatal(err) -// } -// dbassert := dbassert.New(t, db) -// dbassert.FieldIsNull(&someModel, "someField") -// } +// func TestSomeDatabase(t *testing.T) { +// conn, err := sql.Open("postgres", "postgres://postgres:secret@localhost:%s?sslmode=disable") +// if err != nil { +// t.Fatal(err) +// } +// defer conn.Close() +// db, err := gorm.Open("postgres", conn) +// if err != nil { +// t.Fatal(err) +// } +// m := TestModel{} +// if err = rw.Create(&m); err != nil { +// t.Fatal(err) +// } +// dbassert := dbassert.New(t, db) +// dbassert.FieldIsNull(&someModel, "someField") +// } package dbassert diff --git a/internal/db/clause.go b/internal/db/clause.go index ad666c2af..854f59621 100644 --- a/internal/db/clause.go +++ b/internal/db/clause.go @@ -27,9 +27,11 @@ type ExprValue struct { // column values for database operations. See: Expr(...) // // Set name column to null example: +// // SetColumnValues(map[string]interface{}{"name": Expr("NULL")}) // // Set exp_time column to N seconds from now: +// // SetColumnValues(map[string]interface{}{"exp_time": Expr("wt_add_seconds_to_now(?)", 10)}) func Expr(expr string, args ...interface{}) ExprValue { return ExprValue{sql: expr, vars: args} diff --git a/internal/db/schema/doc.go b/internal/db/schema/doc.go index ef67b11b4..d81155b17 100644 --- a/internal/db/schema/doc.go +++ b/internal/db/schema/doc.go @@ -7,16 +7,15 @@ // prior to creating a schema.Manager. This is generally done in an init // function of another package, i.e.: // -// //go:embed postgres -// var postgres embed.FS +// //go:embed postgres +// var postgres embed.FS // -// func init() { -// schema.RegisterEdition("oss", schema.Postgres, postgres, 0) -// } +// func init() { +// schema.RegisterEdition("oss", schema.Postgres, postgres, 0) +// } // // Then a manager can be created and used to apply the migrations: // -// m := schema.NewManager(ctx, schema.Postgres, db) -// m.ApplyMigrations() -// +// m := schema.NewManager(ctx, schema.Postgres, db) +// m.ApplyMigrations() package schema diff --git a/internal/db/schema/internal/edition/edition.go b/internal/db/schema/internal/edition/edition.go index 60062aec2..c624e7cd7 100644 --- a/internal/db/schema/internal/edition/edition.go +++ b/internal/db/schema/internal/edition/edition.go @@ -58,22 +58,22 @@ func (e Editions) Sort() { // lower number indicates a higher priority. New will panic if the structure // of the embed.FS is not correct. The files must be structured as follows: // -// / -// _.up.sql +// / +// _.up.sql // // Where majorVersion and minorVersion are integers. There can be any number of // leading directories prior to the major versions. For example a directory // structure like the following is correct: // -// migrations/oss/postgres/ -// 0/ -// 01_initial.up.sql -// 1/ -// 01_add_columns.up.sql -// 02_rename_table.up.sql -// 2/ -// 01_add_new_table.up.sql -// 02_refactor_views.up.sql +// migrations/oss/postgres/ +// 0/ +// 01_initial.up.sql +// 1/ +// 01_add_columns.up.sql +// 02_rename_table.up.sql +// 2/ +// 01_add_new_table.up.sql +// 02_refactor_views.up.sql func New(name string, dialect Dialect, m embed.FS, priority int, opt ...Option) (Edition, error) { var largestSchemaVersion int migrations := make(migration.Migrations) diff --git a/internal/db/schema/internal/postgres/postgres.go b/internal/db/schema/internal/postgres/postgres.go index 6314ce72c..e0b1c49ad 100644 --- a/internal/db/schema/internal/postgres/postgres.go +++ b/internal/db/schema/internal/postgres/postgres.go @@ -451,7 +451,7 @@ func (p *Postgres) EnsureMigrationLogTable(ctx context.Context) error { // GetMigrationLog will retrieve the migration logs from the db for the last // migration. -// The WithDeleteLog option is supported and will remove all log entries, +// The WithDeleteLog option is supported and will remove all log entries, // after reading the entries, when provided. func (p *Postgres) GetMigrationLog(ctx context.Context, opt ...log.Option) ([]*log.Entry, error) { const op = "postgres.(Postgres).GetMigrationLog" diff --git a/internal/db/schema/migration_log.go b/internal/db/schema/migration_log.go index c067b7bbb..a2bf0cf03 100644 --- a/internal/db/schema/migration_log.go +++ b/internal/db/schema/migration_log.go @@ -19,7 +19,7 @@ type LogEntry struct { // GetMigrationLog will retrieve the migration logs from the db for the last // migration. Once it's read the entries, it will delete them from the database. -// The WithDeleteLog option is supported and will remove all log entries when provided. +// The WithDeleteLog option is supported and will remove all log entries when provided. func (b *Manager) GetMigrationLog(ctx context.Context, opt ...Option) ([]LogEntry, error) { const op = "schema.GetMigrationLog" diff --git a/internal/db/schema/migrations/base.go b/internal/db/schema/migrations/base.go index ed1b7308b..bebd5221c 100644 --- a/internal/db/schema/migrations/base.go +++ b/internal/db/schema/migrations/base.go @@ -11,6 +11,7 @@ import ( // postgres contains the sql for creating the base tables used to manage // migrations. +// //go:embed base/postgres var postgres embed.FS diff --git a/internal/db/schema/migrations/oss/internal/hook46001/hook.go b/internal/db/schema/migrations/oss/internal/hook46001/hook.go index 56f771bd0..841023554 100644 --- a/internal/db/schema/migrations/oss/internal/hook46001/hook.go +++ b/internal/db/schema/migrations/oss/internal/hook46001/hook.go @@ -6,7 +6,6 @@ // belonging to the same project scope. // // The repair functionality removes all illegal associations and returns a report. -// package hook46001 import ( diff --git a/internal/db/schema/migrations/oss/oss.go b/internal/db/schema/migrations/oss/oss.go index 58db6fd84..62eeb2ac6 100644 --- a/internal/db/schema/migrations/oss/oss.go +++ b/internal/db/schema/migrations/oss/oss.go @@ -12,6 +12,7 @@ import ( ) // postgres contains the migrations sql files for postgres oss edition +// //go:embed postgres var postgres embed.FS diff --git a/internal/db/schema/migrations/oss/postgres_11_01_test.go b/internal/db/schema/migrations/oss/postgres_11_01_test.go index ff3e6bf63..28b129d62 100644 --- a/internal/db/schema/migrations/oss/postgres_11_01_test.go +++ b/internal/db/schema/migrations/oss/postgres_11_01_test.go @@ -38,7 +38,8 @@ type testServer struct { // 4) asserting some bits about the state of the db. // // Tests migration: -// migrations/oss/11/01_server_type_enum.up.sql +// +// migrations/oss/11/01_server_type_enum.up.sql func Test_ServerEnumChanges(t *testing.T) { t.Parallel() require := require.New(t) diff --git a/internal/db/schema/migrations/oss/postgres_12_01_test.go b/internal/db/schema/migrations/oss/postgres_12_01_test.go index 9baf6e55c..0e4d77c41 100644 --- a/internal/db/schema/migrations/oss/postgres_12_01_test.go +++ b/internal/db/schema/migrations/oss/postgres_12_01_test.go @@ -13,7 +13,8 @@ import ( ) // Tests migration: -// migrations/oss/12/01_timestamp_sub_funcs.up.sql +// +// migrations/oss/12/01_timestamp_sub_funcs.up.sql func TestWtSubSeconds(t *testing.T) { t.Parallel() require := require.New(t) diff --git a/internal/db/schema/migrations/oss/postgres_2_10_test.go b/internal/db/schema/migrations/oss/postgres_2_10_test.go index 058ef31b5..1fd6f830a 100644 --- a/internal/db/schema/migrations/oss/postgres_2_10_test.go +++ b/internal/db/schema/migrations/oss/postgres_2_10_test.go @@ -15,7 +15,8 @@ import ( ) // Tests migration: -// migrations/oss/2/10_auth.up.sql +// +// migrations/oss/2/10_auth.up.sql func Test_AuthMethodSubtypes(t *testing.T) { t.Parallel() assert, require := assert.New(t), require.New(t) diff --git a/internal/gen/controller/api/services/auth_method_service.pb.go b/internal/gen/controller/api/services/auth_method_service.pb.go index 7344b398b..2f1adcfed 100644 --- a/internal/gen/controller/api/services/auth_method_service.pb.go +++ b/internal/gen/controller/api/services/auth_method_service.pb.go @@ -599,6 +599,7 @@ type ChangeStateRequest struct { // The mutation will fail if the version does not match the latest known good version. Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *ChangeStateRequest_Attributes // *ChangeStateRequest_OidcChangeStateAttributes Attrs isChangeStateRequest_Attrs `protobuf_oneof:"attrs"` @@ -867,6 +868,7 @@ type AuthenticateRequest struct { // to keep it safe from rogue JS in the browser. Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *AuthenticateRequest_Attributes // *AuthenticateRequest_PasswordLoginAttributes // *AuthenticateRequest_OidcStartAttributes @@ -1025,6 +1027,7 @@ type AuthenticateResponse struct { // The type of the token returned. Either "cookie" or "token". Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *AuthenticateResponse_Attributes // *AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse // *AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse diff --git a/internal/gen/controller/servers/services/credential.pb.go b/internal/gen/controller/servers/services/credential.pb.go index 21135adf4..6edb422ab 100644 --- a/internal/gen/controller/servers/services/credential.pb.go +++ b/internal/gen/controller/servers/services/credential.pb.go @@ -26,6 +26,7 @@ type Credential struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Credential: + // // *Credential_UsernamePassword // *Credential_SshPrivateKey Credential isCredential_Credential `protobuf_oneof:"credential"` diff --git a/internal/gen/controller/servers/services/server_coordination_service.pb.go b/internal/gen/controller/servers/services/server_coordination_service.pb.go index 1e00deb91..3e3973b00 100644 --- a/internal/gen/controller/servers/services/server_coordination_service.pb.go +++ b/internal/gen/controller/servers/services/server_coordination_service.pb.go @@ -396,6 +396,7 @@ type Job struct { Type JOBTYPE `protobuf:"varint,1,opt,name=type,proto3,enum=controller.servers.services.v1.JOBTYPE" json:"type,omitempty"` // Types that are assignable to JobInfo: + // // *Job_SessionInfo JobInfo isJob_JobInfo `protobuf_oneof:"job_info"` } diff --git a/internal/gen/errors/errors.pb.go b/internal/gen/errors/errors.pb.go index ea43244e4..5eb89714e 100644 --- a/internal/gen/errors/errors.pb.go +++ b/internal/gen/errors/errors.pb.go @@ -37,6 +37,7 @@ type Err struct { // wrapped represents an optionally wrapped error // // Types that are assignable to Wrapped: + // // *Err_Err // *Err_StdError // *Err_None diff --git a/internal/gen/testing/attribute/attribute.pb.go b/internal/gen/testing/attribute/attribute.pb.go index 461244994..14adc7053 100644 --- a/internal/gen/testing/attribute/attribute.pb.go +++ b/internal/gen/testing/attribute/attribute.pb.go @@ -34,6 +34,7 @@ type TestResource struct { Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` OtherId string `protobuf:"bytes,3,opt,name=other_id,json=otherId,proto3" json:"other_id,omitempty"` // Types that are assignable to Attrs: + // // *TestResource_Attributes // *TestResource_SubResourceAttributes Attrs isTestResource_Attrs `protobuf_oneof:"attrs"` @@ -302,6 +303,7 @@ type TestCustomTransformation struct { SomeRandomId string `protobuf:"bytes,1,opt,name=some_random_id,json=someRandomId,proto3" json:"some_random_id,omitempty"` SecondaryId string `protobuf:"bytes,2,opt,name=secondary_id,json=secondaryId,proto3" json:"secondary_id,omitempty"` // Types that are assignable to Attrs: + // // *TestCustomTransformation_Attributes // *TestCustomTransformation_SubResourceAttributes Attrs isTestCustomTransformation_Attrs `protobuf_oneof:"attrs"` @@ -968,6 +970,7 @@ type TestNoItemAttributes struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Types that are assignable to Attrs: + // // *TestNoItemAttributes_Attributes // *TestNoItemAttributes_SubResourceAttributes Attrs isTestNoItemAttributes_Attrs `protobuf_oneof:"attrs"` diff --git a/internal/host/plugin/store/host.pb.go b/internal/host/plugin/store/host.pb.go index 541f6443c..157986a19 100644 --- a/internal/host/plugin/store/host.pb.go +++ b/internal/host/plugin/store/host.pb.go @@ -429,7 +429,8 @@ func (x *HostCatalogSecret) GetKeyId() string { } // TODO: Add a field which tracks if the host in cache should be considered -// invalid and fall back to the plugin provided data. +// +// invalid and fall back to the plugin provided data. type Host struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/internal/host/static/doc.go b/internal/host/static/doc.go index 9a405a9b5..d74496083 100644 --- a/internal/host/static/doc.go +++ b/internal/host/static/doc.go @@ -10,25 +10,25 @@ // referenced. A host set can only reference hosts from the host catalog // that owns it. Host addresses must be unique within a host catalog. // -// Repository +// # Repository // // A repository provides methods for creating, updating, retrieving, and // deleting host catalogs, host sets, and hosts. A new repository should be // created for each transaction. For example: // -// var wrapper wrapping.Wrapper -// ... init wrapper... +// var wrapper wrapping.Wrapper +// ... init wrapper... // -// // db implements both the reader and writer interfaces. -// db, _ := db.Open(db.Postgres, url) +// // db implements both the reader and writer interfaces. +// db, _ := db.Open(db.Postgres, url) // -// var repo *static.Repository +// var repo *static.Repository // -// repo, _ = static.NewRepository(db, db, wrapper) -// catalog, _ := repo.LookupCatalog(ctx, catalogId) +// repo, _ = static.NewRepository(db, db, wrapper) +// catalog, _ := repo.LookupCatalog(ctx, catalogId) // -// catalog.Name = "new name" +// catalog.Name = "new name" // -// repo, _ = static.NewRepository(db, db, wrapper) -// catalog, _ := repo.UpdateCatalog(ctx, catalog, []string{"Name"}) +// repo, _ = static.NewRepository(db, db, wrapper) +// catalog, _ := repo.UpdateCatalog(ctx, catalog, []string{"Name"}) package static diff --git a/internal/iam/principal_role.go b/internal/iam/principal_role.go index f5a4a7016..0c7bfb4dd 100644 --- a/internal/iam/principal_role.go +++ b/internal/iam/principal_role.go @@ -139,7 +139,7 @@ func (r *UserRole) SetTableName(n string) { } } -// GroupRole is a group assigned to a role +// GroupRole is a group assigned to a role type GroupRole struct { *store.GroupRole tableName string `gorm:"-"` diff --git a/internal/libs/crypto/derived_reader.go b/internal/libs/crypto/derived_reader.go index 43654de37..a0c03a2d6 100644 --- a/internal/libs/crypto/derived_reader.go +++ b/internal/libs/crypto/derived_reader.go @@ -17,8 +17,9 @@ import ( // be nil. // // Example: +// // reader, _ := NewDerivedReader(wrapper, userId, jobId) -// key := ed25519.GenerateKey(reader) +// key := ed25519.GenerateKey(reader) func NewDerivedReader(ctx context.Context, wrapper wrapping.Wrapper, lenLimit int64, salt, info []byte) (*io.LimitedReader, error) { const op = "crypto.NewDerivedReader" if wrapper == nil { diff --git a/internal/libs/patchstruct/patchstruct.go b/internal/libs/patchstruct/patchstruct.go index 6ed6e1eab..678198a61 100644 --- a/internal/libs/patchstruct/patchstruct.go +++ b/internal/libs/patchstruct/patchstruct.go @@ -15,21 +15,21 @@ import ( // // The following rules apply: // -// * The source (src) map is merged into the destination map (dst). If the -// source map is nil, the destination will be a valid, but empty, map. +// - The source (src) map is merged into the destination map (dst). If the +// source map is nil, the destination will be a valid, but empty, map. // -// * Values are overwritten by the source map if they exist in both. +// - Values are overwritten by the source map if they exist in both. // -// * Values are deleted from the destination if they are set to null in the -// source. +// - Values are deleted from the destination if they are set to null in the +// source. // -// * Maps are recursively applied, meaning that a nested map at key "foo" in -// the destination would be patched with a map at key "foo" in the -// source. +// - Maps are recursively applied, meaning that a nested map at key "foo" in +// the destination would be patched with a map at key "foo" in the +// source. // -// * A map in the destination is overwritten by a non-map in the source, -// and a non-map in the destination is overwritten by a map in the -// source. +// - A map in the destination is overwritten by a non-map in the source, +// and a non-map in the destination is overwritten by a map in the +// source. // // PatchStruct returns the updated map as a copy, dst and src are not altered. func PatchStruct(dst, src *structpb.Struct) *structpb.Struct { diff --git a/internal/oplog/any_operation.pb.go b/internal/oplog/any_operation.pb.go index 2b705a0ea..93374eec0 100644 --- a/internal/oplog/any_operation.pb.go +++ b/internal/oplog/any_operation.pb.go @@ -282,12 +282,14 @@ type WithOnConflict struct { // target defines the on conflict target // // Types that are assignable to Target: + // // *WithOnConflict_Constraint // *WithOnConflict_Columns Target isWithOnConflict_Target `protobuf_oneof:"target"` // action defines the on conflict action // // Types that are assignable to Action: + // // *WithOnConflict_DoNothing // *WithOnConflict_UpdateAll // *WithOnConflict_ColumnValues @@ -478,6 +480,7 @@ type ColumnValue struct { // value of the column // // Types that are assignable to Value: + // // *ColumnValue_Raw // *ColumnValue_ExprValue // *ColumnValue_Column diff --git a/internal/oplog/oplog.go b/internal/oplog/oplog.go index 61a4b6d59..7f2c8c928 100644 --- a/internal/oplog/oplog.go +++ b/internal/oplog/oplog.go @@ -18,6 +18,7 @@ import ( // Version of oplog entries (among other things, it's used to manage upgrade // compatibility when replicating) +// // v1: initial version // v2: adds the new Message.Opts const Version = "v2" @@ -338,7 +339,7 @@ func (e *Entry) WriteEntryWith(ctx context.Context, tx *Writer, ticket *store.Ti } // Write the entry as is with whatever it has for e.Data marshaled into a FIFO QueueBuffer -// Cipherer != nil then the data is authentication encrypted +// If Cipherer != nil then the data is authentication encrypted func (e *Entry) Write(ctx context.Context, tx *Writer, ticket *store.Ticket) error { const op = "oplog.(Entry).Write" if err := e.validate(ctx); err != nil { diff --git a/internal/scheduler/job/doc.go b/internal/scheduler/job/doc.go index 551b5e991..f8ebe3875 100644 --- a/internal/scheduler/job/doc.go +++ b/internal/scheduler/job/doc.go @@ -10,37 +10,37 @@ // running state for a specific job. The private_id (primary key) is generated by the // repository during RunJobs. // -// Repository +// # Repository // // A repository provides methods for creating, updating, retrieving, and // deleting Jobs. It also provides methods to run jobs, update progress of runs // and complete, fail or interrupt runs. // A new repository should be created for each transaction. For example: // -// var wrapper wrapping.Wrapper -// ... init wrapper ... +// var wrapper wrapping.Wrapper +// ... init wrapper ... // -// // db implements both the reader and writer interfaces. -// db, _ := db.Open(db.Postgres, url) +// // db implements both the reader and writer interfaces. +// db, _ := db.Open(db.Postgres, url) // -// var repo *job.Repository -// repo, _ = job.NewRepository(db, db, wrapper) +// var repo *job.Repository +// repo, _ = job.NewRepository(db, db, wrapper) // -// var j *job.Job -// j, _ = repo.UpsertJob(context.Background(), j, "name", "description") +// var j *job.Job +// j, _ = repo.UpsertJob(context.Background(), j, "name", "description") // -// var runs []*Run -// repo, _ = job.NewRepository(db, db, wrapper) -// runs, _ = repo.RunJobs(context.Background(), "serverId") +// var runs []*Run +// repo, _ = job.NewRepository(db, db, wrapper) +// runs, _ = repo.RunJobs(context.Background(), "serverId") // -// ... run job ... +// ... run job ... // -// var run *Run -// repo, _ = job.NewRepository(db, db, wrapper) -// run, _ = repo.UpdateProgress(ctx, run, []string{"TotalCount", "CompletedCount"}) +// var run *Run +// repo, _ = job.NewRepository(db, db, wrapper) +// run, _ = repo.UpdateProgress(ctx, run, []string{"TotalCount", "CompletedCount"}) // -// nextJobRun = time.Now().Add(time.Hour) +// nextJobRun = time.Now().Add(time.Hour) // -// repo, _ = job.NewRepository(db, db, wrapper) -// run, _ = repo.CompleteRun(ctx, run.PrivateId, job.Completed, nextJobRun) +// repo, _ = job.NewRepository(db, db, wrapper) +// run, _ = repo.CompleteRun(ctx, run.PrivateId, job.Completed, nextJobRun) package job diff --git a/internal/session/repository_session.go b/internal/session/repository_session.go index b60fb34fd..a9c0228f2 100644 --- a/internal/session/repository_session.go +++ b/internal/session/repository_session.go @@ -424,9 +424,10 @@ func (r *Repository) CancelSession(ctx context.Context, sessionId string, sessio } // TerminateCompletedSessions will terminate sessions in the repo based on: -// * sessions that have exhausted their connection limit and all their connections are closed. -// * sessions that are expired and all their connections are closed. -// * sessions that are canceling and all their connections are closed +// - sessions that have exhausted their connection limit and all their connections are closed. +// - sessions that are expired and all their connections are closed. +// - sessions that are canceling and all their connections are closed +// // This function should called on a periodic basis a Controllers via it's // "ticker" pattern. func (r *Repository) TerminateCompletedSessions(ctx context.Context) (int, error) { @@ -453,9 +454,9 @@ func (r *Repository) TerminateCompletedSessions(ctx context.Context) (int, error // terminateSessionIfPossible is called on connection close and will attempt to close the connection's // session if the following conditions are met: -// * sessions that have exhausted their connection limit and all their connections are closed. -// * sessions that are expired and all their connections are closed. -// * sessions that are canceling and all their connections are closed +// - sessions that have exhausted their connection limit and all their connections are closed. +// - sessions that are expired and all their connections are closed. +// - sessions that are canceling and all their connections are closed func (r *Repository) terminateSessionIfPossible(ctx context.Context, sessionId string) (int, error) { const op = "session.(Repository).terminateSessionIfPossible" rowsAffected := 0 diff --git a/internal/types/subtypes/attribute_transform.go b/internal/types/subtypes/attribute_transform.go index a63d9955e..42b644103 100644 --- a/internal/types/subtypes/attribute_transform.go +++ b/internal/types/subtypes/attribute_transform.go @@ -99,13 +99,13 @@ func convertAttributesToDefault(msg proto.Message, st Subtype) error { // that there is a structpb.Struct field named "attributes" as part of the // oneof. Thus the message must be like: // -// message Foo { -// // other fields -// oneof attrs { -// google.protobuf.Struct attributes = 100; -// // other attribute fields -// } -// } +// message Foo { +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 100; +// // other attribute fields +// } +// } // // If the message does not conform to this structure, // the original message is returned. diff --git a/internal/types/subtypes/interceptor.go b/internal/types/subtypes/interceptor.go index 182023fe2..2aed2620d 100644 --- a/internal/types/subtypes/interceptor.go +++ b/internal/types/subtypes/interceptor.go @@ -37,60 +37,60 @@ func messageDomain(m proto.Message) string { // The first structure is a message that contains a single "item" that is a // message that has a "type" and an "attrs" oneof for attributes: // -// message CreateFooRequest { -// item Foo = 1; -// } -// message Foo { -// string type = 1; -// // other fields -// oneof attrs { -// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; -// // other subtype attributes types -// } -// } +// message CreateFooRequest { +// item Foo = 1; +// } +// message Foo { +// string type = 1; +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } // // The second structure is similar to the first, but rather then the type field // being provided, an id field is set. Note this is a different id from the // third structure. In this case it is an id for a related resource and the id // is marked with the "subtype_source_id" custom option: // -// message CreateFooRequest { -// item Foo = 1; -// } -// message Foo { -// string bar_id = 1 [(custom_options.v1.subtype_source_id) = true]; -// // other fields -// oneof attrs { -// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; -// // other subtype attributes types -// } -// } +// message CreateFooRequest { +// item Foo = 1; +// } +// message Foo { +// string bar_id = 1 [(custom_options.v1.subtype_source_id) = true]; +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } // // The third structure is a message that contains an id string and an "item" // that is a message that has an "attrs" oneof for attributes: // -// message UpdateFooRequest { -// string id = 1; -// item Foo = 2; -// } -// message Foo { -// // other fields -// oneof attrs { -// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; -// // other subtype attributes types -// } -// } +// message UpdateFooRequest { +// string id = 1; +// item Foo = 2; +// } +// message Foo { +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } // // The forth structure is a message that contains an id string and an "attrs" oneof for // attributes: // -// message FooActionRequest { -// string id = 1; -// oneof attrs { -// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; -// // other subtype attributes types -// } -// } +// message FooActionRequest { +// string id = 1; +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } // // Also note that for any of the id based lookups to function, the file that contains // the proto.Message definition must set the "domain" custom option. @@ -189,28 +189,28 @@ func transformRequest(msg proto.Message) error { // The first structure is a message that contains a single "item" that is a // message that has an "attrs" oneof for attributes: // -// message CreateFooResponse { -// item Foo = 1; -// } -// message Foo { -// oneof attrs { -// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; -// // other subtype attributes types -// } -// } +// message CreateFooResponse { +// item Foo = 1; +// } +// message Foo { +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } // // The second structure is a message that contains a single "items" that is a // slice of item messages that have an "attrs" oneof for attributes: // -// message ListFooResponse { -// items []Foo = 1; -// } -// message Foo { -// oneof attrs { -// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; -// // other subtype attributes types -// } -// } +// message ListFooResponse { +// items []Foo = 1; +// } +// message Foo { +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } func transformResponseAttributes(res proto.Message) error { r := res.ProtoReflect() fields := r.Descriptor().Fields() @@ -257,42 +257,43 @@ func transformResponse(msg proto.Message) error { // // For example with a protobuf message definition like: // -// message Account { -// string id = 1; -// string type = 2; -// oneof attrs { -// google.protobuf.Struct attributes = 10 [(controller.custom_options.v1.subtype) = "default"]; -// PasswordAttributes password_attributes = 20 [(controller.custom_options.v1.subtype) = "password"]; -// } -// } +// message Account { +// string id = 1; +// string type = 2; +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(controller.custom_options.v1.subtype) = "default"]; +// PasswordAttributes password_attributes = 20 [(controller.custom_options.v1.subtype) = "password"]; +// } +// } // -// message PasswordAttributes { -// string login_name = 1; -// } +// message PasswordAttributes { +// string login_name = 1; +// } // -// message AccountCreateRequest { -// Account item = 1; -// } +// message AccountCreateRequest { +// Account item = 1; +// } // -// message AccountCreateResponse { -// Account item = 1; -// } +// message AccountCreateResponse { +// Account item = 1; +// } // // And a create request with JSON request body like: -// { -// "type": "password", -// "attributes": { -// "login_name": "tim" -// } -// } +// +// { +// "type": "password", +// "attributes": { +// "login_name": "tim" +// } +// } // // Will result in a proto request like: // -// type:"password" attributes:{fields:{key:"login_name" value:{string_value:"tim"}}} +// type:"password" attributes:{fields:{key:"login_name" value:{string_value:"tim"}}} // // This request will be transformed into: // -// type:"password" password_attributes:{login_name:"tim"} +// type:"password" password_attributes:{login_name:"tim"} func AttributeTransformerInterceptor(_ context.Context) grpc.UnaryServerInterceptor { const op = "subtypes.AttributeTransformInterceptor" return func(interceptorCtx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { diff --git a/internal/ui/assets.go b/internal/ui/assets.go index 3e3f698c7..85ffa8577 100644 --- a/internal/ui/assets.go +++ b/internal/ui/assets.go @@ -13,6 +13,7 @@ import ( const contentDir = ".tmp/boundary-ui/ui/admin/dist" // content is our static web server content. +// //go:embed .tmp/boundary-ui/ui/admin/dist var content embed.FS diff --git a/plugins/host/assets.go b/plugins/host/assets.go index 83447e592..dd353a47e 100644 --- a/plugins/host/assets.go +++ b/plugins/host/assets.go @@ -8,6 +8,7 @@ import ( const contentDir = "assets" // content is our static web server content. +// //go:embed assets var content embed.FS diff --git a/plugins/kms/assets.go b/plugins/kms/assets.go index 7bdfd6b4a..29d2dc06c 100644 --- a/plugins/kms/assets.go +++ b/plugins/kms/assets.go @@ -8,6 +8,7 @@ import ( const contentDir = "assets" // content is our static web server content. +// //go:embed assets var content embed.FS diff --git a/sdk/go.mod b/sdk/go.mod index dcd5b9096..9f3c808af 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/sdk -go 1.18 +go 1.19 require ( github.com/hashicorp/eventlogger v0.1.1-0.20211106154408-4ff8da3a890c diff --git a/sdk/pbs/controller/api/resources/accounts/account.pb.go b/sdk/pbs/controller/api/resources/accounts/account.pb.go index 1efefef01..3e9d77e8c 100644 --- a/sdk/pbs/controller/api/resources/accounts/account.pb.go +++ b/sdk/pbs/controller/api/resources/accounts/account.pb.go @@ -52,6 +52,7 @@ type Account struct { // The ID of the Auth Method that is associated with this Account. AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *Account_Attributes // *Account_PasswordAccountAttributes // *Account_OidcAccountAttributes diff --git a/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go b/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go index 5bd4d1b04..f385969eb 100644 --- a/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go +++ b/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go @@ -52,6 +52,7 @@ type AuthMethod struct { // The Auth Method type. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *AuthMethod_Attributes // *AuthMethod_PasswordAuthMethodAttributes // *AuthMethod_OidcAuthMethodsAttributes diff --git a/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go b/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go index 9f896e6fb..db9d960b5 100644 --- a/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go +++ b/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go @@ -52,6 +52,7 @@ type CredentialLibrary struct { // The Credential Library type. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *CredentialLibrary_Attributes // *CredentialLibrary_VaultCredentialLibraryAttributes Attrs isCredentialLibrary_Attrs `protobuf_oneof:"attrs"` diff --git a/sdk/pbs/controller/api/resources/credentials/credential.pb.go b/sdk/pbs/controller/api/resources/credentials/credential.pb.go index a5f8cde3f..519349880 100644 --- a/sdk/pbs/controller/api/resources/credentials/credential.pb.go +++ b/sdk/pbs/controller/api/resources/credentials/credential.pb.go @@ -52,6 +52,7 @@ type Credential struct { // The Credential type. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *Credential_Attributes // *Credential_UsernamePasswordAttributes // *Credential_SshPrivateKeyAttributes diff --git a/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go b/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go index d1bc1272e..45da3563a 100644 --- a/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go +++ b/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go @@ -52,6 +52,7 @@ type CredentialStore struct { // The Credential Store type. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *CredentialStore_Attributes // *CredentialStore_VaultCredentialStoreAttributes Attrs isCredentialStore_Attrs `protobuf_oneof:"attrs"` diff --git a/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go index 9cdf13b2c..c489af33c 100644 --- a/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go +++ b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go @@ -56,6 +56,7 @@ type HostCatalog struct { // The type of Host Catalog. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *HostCatalog_Attributes Attrs isHostCatalog_Attrs `protobuf_oneof:"attrs"` // Secrets specific to the catalog type. These are never output. diff --git a/sdk/pbs/controller/api/resources/hosts/host.pb.go b/sdk/pbs/controller/api/resources/hosts/host.pb.go index 9b6fc8206..694acccd0 100644 --- a/sdk/pbs/controller/api/resources/hosts/host.pb.go +++ b/sdk/pbs/controller/api/resources/hosts/host.pb.go @@ -57,6 +57,7 @@ type Host struct { // Output only. A list of Host Sets containing this Host. HostSetIds []string `protobuf:"bytes,100,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *Host_Attributes // *Host_StaticHostAttributes Attrs isHost_Attrs `protobuf_oneof:"attrs"` diff --git a/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go b/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go index 4ea00f88f..d6103b3aa 100644 --- a/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go +++ b/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go @@ -70,6 +70,7 @@ type HostSet struct { // be valid for all plugin types. SyncIntervalSeconds *wrapperspb.Int32Value `protobuf:"bytes,102,opt,name=sync_interval_seconds,proto3" json:"sync_interval_seconds,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *HostSet_Attributes Attrs isHostSet_Attrs `protobuf_oneof:"attrs"` // Output only. The available actions on this resource for this user. diff --git a/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go b/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go index b2f5231e1..19b65e7b9 100644 --- a/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go +++ b/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go @@ -52,6 +52,7 @@ type ManagedGroup struct { // The ID of the Auth Method that is associated with this ManagedGroup. AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: + // // *ManagedGroup_Attributes // *ManagedGroup_OidcManagedGroupAttributes Attrs isManagedGroup_Attrs `protobuf_oneof:"attrs"` diff --git a/sdk/pbs/controller/api/resources/targets/target.pb.go b/sdk/pbs/controller/api/resources/targets/target.pb.go index 3fc57545c..e87187989 100644 --- a/sdk/pbs/controller/api/resources/targets/target.pb.go +++ b/sdk/pbs/controller/api/resources/targets/target.pb.go @@ -418,6 +418,7 @@ type Target struct { // Output only. The injected application credential sources associated with this Target. InjectedApplicationCredentialSources []*CredentialSource `protobuf:"bytes,530,rep,name=injected_application_credential_sources,proto3" json:"injected_application_credential_sources,omitempty"` // Types that are assignable to Attrs: + // // *Target_Attributes // *Target_TcpTargetAttributes // *Target_SshTargetAttributes diff --git a/testing/dbtest/docs.go b/testing/dbtest/docs.go index 546d004b4..300caf8f6 100644 --- a/testing/dbtest/docs.go +++ b/testing/dbtest/docs.go @@ -6,20 +6,20 @@ // To use this package in a test add something like the following in the // beginning of the test: // -// c, u, _, err := dbtest.StartUsingTemplate(dbtest.Postgres) -// require.NoError(t, err) -// t.Cleanup(func() { -// require.NoError(t, c()) -// }) -// // use u to get a connection to the new database -// dBase, err := common.SqlOpen("postgres", u) +// c, u, _, err := dbtest.StartUsingTemplate(dbtest.Postgres) +// require.NoError(t, err) +// t.Cleanup(func() { +// require.NoError(t, c()) +// }) +// // use u to get a connection to the new database +// dBase, err := common.SqlOpen("postgres", u) // // By default this uses a template that already has all of the boundary // migrations run. If a test needs a database without any migrations, like in // the case where the migration code needs to be tested, a different template // can be specified. This should generally be template1: // -// c, u, _, err := dbtest.StartUsingTemplate(dbtest.Postgres, dbtest.WithTemplate(dbtest.Template1)) +// c, u, _, err := dbtest.StartUsingTemplate(dbtest.Postgres, dbtest.WithTemplate(dbtest.Template1)) // // See https://www.postgresql.org/docs/13/manage-ag-templatedbs.html package dbtest diff --git a/testing/dbtest/session_list_benchmarks_dump_generation_test.go b/testing/dbtest/session_list_benchmarks_dump_generation_test.go index f0f1eaab2..6ef81f3ad 100644 --- a/testing/dbtest/session_list_benchmarks_dump_generation_test.go +++ b/testing/dbtest/session_list_benchmarks_dump_generation_test.go @@ -33,9 +33,10 @@ import ( // to predictable files for use in benchmarking. // // Each database dump contains: -// * N number of sessions, with each session having M connections. -// * P users, each owning an even amount of the sessions. All users -// use the password "testpassword" to login. +// - N number of sessions, with each session having M connections. +// - P users, each owning an even amount of the sessions. All users +// use the password "testpassword" to login. +// // It is safe for users of these dumps to assume all of this, for the variables // N, M and P defined in the "scenarios" struct below. func TestGenerateSessionBenchmarkTemplateDumps(t *testing.T) {