From f8237fb945841a8a09cf1b47d5ad6867b88f84df Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Wed, 9 Sep 2020 01:24:25 -0400 Subject: [PATCH] Move some packages into SDK, out of internal --- api/client.go | 4 ++-- internal/auth/auth.go | 2 +- internal/cmd/base/base.go | 2 +- internal/cmd/base/servers.go | 2 +- internal/cmd/commands/accounts/account.go | 2 +- internal/cmd/commands/accounts/password.go | 2 +- internal/cmd/commands/authmethods/authmethod.go | 2 +- internal/cmd/commands/authmethods/password.go | 2 +- internal/cmd/commands/authtokens/authtokens.go | 2 +- internal/cmd/commands/config/encryptdecrypt.go | 2 +- internal/cmd/commands/controller/controller.go | 4 ++-- internal/cmd/commands/groups/group.go | 2 +- internal/cmd/commands/hostcatalogs/hostcatalog.go | 2 +- internal/cmd/commands/hostcatalogs/static.go | 2 +- internal/cmd/commands/hosts/host.go | 2 +- internal/cmd/commands/hosts/static.go | 2 +- internal/cmd/commands/hostsets/hostset.go | 2 +- internal/cmd/commands/hostsets/static.go | 2 +- internal/cmd/commands/roles/role.go | 2 +- internal/cmd/commands/scopes/scope.go | 2 +- internal/cmd/commands/targets/target.go | 2 +- internal/cmd/commands/targets/tcp.go | 2 +- internal/cmd/commands/users/user.go | 2 +- internal/cmd/commands/worker/worker.go | 2 +- internal/servers/controller/handler.go | 2 +- internal/servers/repository_test.go | 2 +- {api/internal => sdk}/parseutil/parseutil.go | 2 +- {recovery => sdk/recovery}/recovery.go | 0 {recovery => sdk/recovery}/recovery_test.go | 0 {api/internal => sdk}/strutil/strutil.go | 0 {api/internal => sdk}/strutil/strutil_test.go | 0 {internal => sdk}/wrapper/wrapper.go | 2 +- 32 files changed, 30 insertions(+), 30 deletions(-) rename {api/internal => sdk}/parseutil/parseutil.go (98%) rename {recovery => sdk/recovery}/recovery.go (100%) rename {recovery => sdk/recovery}/recovery_test.go (100%) rename {api/internal => sdk}/strutil/strutil.go (100%) rename {api/internal => sdk}/strutil/strutil_test.go (100%) rename {internal => sdk}/wrapper/wrapper.go (95%) diff --git a/api/client.go b/api/client.go index adeaeb623e..c002f1e535 100644 --- a/api/client.go +++ b/api/client.go @@ -19,8 +19,8 @@ import ( "time" "unicode" - "github.com/hashicorp/boundary/api/internal/parseutil" - "github.com/hashicorp/boundary/recovery" + "github.com/hashicorp/boundary/sdk/parseutil" + "github.com/hashicorp/boundary/sdk/recovery" cleanhttp "github.com/hashicorp/go-cleanhttp" wrapping "github.com/hashicorp/go-kms-wrapping" retryablehttp "github.com/hashicorp/go-retryablehttp" diff --git a/internal/auth/auth.go b/internal/auth/auth.go index b3da231e1b..3cd2a2232d 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers" "github.com/hashicorp/boundary/internal/types/action" "github.com/hashicorp/boundary/internal/types/scope" - "github.com/hashicorp/boundary/recovery" + "github.com/hashicorp/boundary/sdk/recovery" "github.com/hashicorp/go-hclog" wrapping "github.com/hashicorp/go-kms-wrapping" "github.com/kr/pretty" diff --git a/internal/cmd/base/base.go b/internal/cmd/base/base.go index ece856b424..df4939ea03 100644 --- a/internal/cmd/base/base.go +++ b/internal/cmd/base/base.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/boundary/api" "github.com/hashicorp/boundary/api/authtokens" - "github.com/hashicorp/boundary/internal/wrapper" + "github.com/hashicorp/boundary/sdk/wrapper" "github.com/mitchellh/cli" "github.com/pkg/errors" "github.com/posener/complete" diff --git a/internal/cmd/base/servers.go b/internal/cmd/base/servers.go index cf5490fca9..afb944dd26 100644 --- a/internal/cmd/base/servers.go +++ b/internal/cmd/base/servers.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/boundary/internal/iam" "github.com/hashicorp/boundary/internal/kms" "github.com/hashicorp/boundary/internal/types/scope" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/hashicorp/boundary/version" "github.com/hashicorp/errwrap" "github.com/hashicorp/go-hclog" @@ -32,7 +33,6 @@ import ( "github.com/hashicorp/vault/sdk/helper/base62" "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/helper/mlock" - "github.com/hashicorp/vault/sdk/helper/strutil" "github.com/hashicorp/vault/sdk/logical" "github.com/jinzhu/gorm" "github.com/mitchellh/cli" diff --git a/internal/cmd/commands/accounts/account.go b/internal/cmd/commands/accounts/account.go index 650d9548f5..2453d91bcc 100644 --- a/internal/cmd/commands/accounts/account.go +++ b/internal/cmd/commands/accounts/account.go @@ -10,8 +10,8 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/hashicorp/vault/sdk/helper/password" - "github.com/hashicorp/vault/sdk/helper/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/accounts/password.go b/internal/cmd/commands/accounts/password.go index 9d39c086ed..83fadefb66 100644 --- a/internal/cmd/commands/accounts/password.go +++ b/internal/cmd/commands/accounts/password.go @@ -10,8 +10,8 @@ import ( "github.com/hashicorp/boundary/api/accounts" "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/hashicorp/vault/sdk/helper/password" - "github.com/hashicorp/vault/sdk/helper/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/authmethods/authmethod.go b/internal/cmd/commands/authmethods/authmethod.go index f83593131b..f12ddb08c3 100644 --- a/internal/cmd/commands/authmethods/authmethod.go +++ b/internal/cmd/commands/authmethods/authmethod.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/authmethods/password.go b/internal/cmd/commands/authmethods/password.go index 087edda612..5fc283704f 100644 --- a/internal/cmd/commands/authmethods/password.go +++ b/internal/cmd/commands/authmethods/password.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/boundary/api/authmethods" "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/authtokens/authtokens.go b/internal/cmd/commands/authtokens/authtokens.go index 81995acc4e..ee0966d0ae 100644 --- a/internal/cmd/commands/authtokens/authtokens.go +++ b/internal/cmd/commands/authtokens/authtokens.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/config/encryptdecrypt.go b/internal/cmd/commands/config/encryptdecrypt.go index c275801bda..1370fdc2fa 100644 --- a/internal/cmd/commands/config/encryptdecrypt.go +++ b/internal/cmd/commands/config/encryptdecrypt.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/hashicorp/boundary/internal/cmd/base" - "github.com/hashicorp/boundary/internal/wrapper" + "github.com/hashicorp/boundary/sdk/wrapper" "github.com/hashicorp/shared-secure-libs/configutil" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/controller/controller.go b/internal/cmd/commands/controller/controller.go index e901856c37..4e424c0dd5 100644 --- a/internal/cmd/commands/controller/controller.go +++ b/internal/cmd/commands/controller/controller.go @@ -10,12 +10,12 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/config" "github.com/hashicorp/boundary/internal/servers/controller" - "github.com/hashicorp/boundary/internal/wrapper" + "github.com/hashicorp/boundary/sdk/strutil" + "github.com/hashicorp/boundary/sdk/wrapper" "github.com/hashicorp/go-hclog" wrapping "github.com/hashicorp/go-kms-wrapping" "github.com/hashicorp/go-multierror" "github.com/hashicorp/vault/sdk/helper/mlock" - "github.com/hashicorp/vault/sdk/helper/strutil" "github.com/mitchellh/cli" "github.com/posener/complete" ) diff --git a/internal/cmd/commands/groups/group.go b/internal/cmd/commands/groups/group.go index a6a66367f4..d25f85ac02 100644 --- a/internal/cmd/commands/groups/group.go +++ b/internal/cmd/commands/groups/group.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/boundary/api/groups" "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/hostcatalogs/hostcatalog.go b/internal/cmd/commands/hostcatalogs/hostcatalog.go index b60cd864f0..1a5a142f79 100644 --- a/internal/cmd/commands/hostcatalogs/hostcatalog.go +++ b/internal/cmd/commands/hostcatalogs/hostcatalog.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/hostcatalogs/static.go b/internal/cmd/commands/hostcatalogs/static.go index 77d9c815ce..8ed4f2859d 100644 --- a/internal/cmd/commands/hostcatalogs/static.go +++ b/internal/cmd/commands/hostcatalogs/static.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/api/hostcatalogs" "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/hosts/host.go b/internal/cmd/commands/hosts/host.go index f616f4f4a1..9624a0971d 100644 --- a/internal/cmd/commands/hosts/host.go +++ b/internal/cmd/commands/hosts/host.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/hosts/static.go b/internal/cmd/commands/hosts/static.go index 67dab8ed81..796343be86 100644 --- a/internal/cmd/commands/hosts/static.go +++ b/internal/cmd/commands/hosts/static.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/api/hosts" "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/hostsets/hostset.go b/internal/cmd/commands/hostsets/hostset.go index 1a476b7b6a..d1416038cf 100644 --- a/internal/cmd/commands/hostsets/hostset.go +++ b/internal/cmd/commands/hostsets/hostset.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/hostsets/static.go b/internal/cmd/commands/hostsets/static.go index 77e6bcfd56..a42403f84a 100644 --- a/internal/cmd/commands/hostsets/static.go +++ b/internal/cmd/commands/hostsets/static.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/api/hostsets" "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/roles/role.go b/internal/cmd/commands/roles/role.go index e9f502d499..c775fd9a4b 100644 --- a/internal/cmd/commands/roles/role.go +++ b/internal/cmd/commands/roles/role.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/perms" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/scopes/scope.go b/internal/cmd/commands/scopes/scope.go index ec06e80e53..aa532741c5 100644 --- a/internal/cmd/commands/scopes/scope.go +++ b/internal/cmd/commands/scopes/scope.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/targets/target.go b/internal/cmd/commands/targets/target.go index 1498da3718..3b29832de2 100644 --- a/internal/cmd/commands/targets/target.go +++ b/internal/cmd/commands/targets/target.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/targets/tcp.go b/internal/cmd/commands/targets/tcp.go index d104c82ee8..38b93c46f3 100644 --- a/internal/cmd/commands/targets/tcp.go +++ b/internal/cmd/commands/targets/tcp.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/api/targets" "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/users/user.go b/internal/cmd/commands/users/user.go index 9f9995003f..cb539c6ab0 100644 --- a/internal/cmd/commands/users/user.go +++ b/internal/cmd/commands/users/user.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/common" "github.com/hashicorp/boundary/internal/types/resource" - "github.com/hashicorp/vault/sdk/helper/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/kr/pretty" "github.com/mitchellh/cli" "github.com/posener/complete" diff --git a/internal/cmd/commands/worker/worker.go b/internal/cmd/commands/worker/worker.go index ff8120f809..dbca9a132b 100644 --- a/internal/cmd/commands/worker/worker.go +++ b/internal/cmd/commands/worker/worker.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/boundary/internal/cmd/base" "github.com/hashicorp/boundary/internal/cmd/config" "github.com/hashicorp/boundary/internal/servers/worker" - "github.com/hashicorp/boundary/internal/wrapper" + "github.com/hashicorp/boundary/sdk/wrapper" "github.com/hashicorp/go-hclog" wrapping "github.com/hashicorp/go-kms-wrapping" "github.com/hashicorp/go-multierror" diff --git a/internal/servers/controller/handler.go b/internal/servers/controller/handler.go index 27d79c6598..d413aec095 100644 --- a/internal/servers/controller/handler.go +++ b/internal/servers/controller/handler.go @@ -28,9 +28,9 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers/targets" "github.com/hashicorp/boundary/internal/sessions" "github.com/hashicorp/boundary/internal/types/scope" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/hashicorp/shared-secure-libs/configutil" "github.com/hashicorp/vault/sdk/helper/base62" - "github.com/hashicorp/vault/sdk/helper/strutil" "github.com/hashicorp/boundary/internal/servers/controller/handlers" "github.com/hashicorp/boundary/internal/servers/controller/handlers/authenticate" diff --git a/internal/servers/repository_test.go b/internal/servers/repository_test.go index 6f0f2af443..3dc05d01b6 100644 --- a/internal/servers/repository_test.go +++ b/internal/servers/repository_test.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/boundary/internal/db" "github.com/hashicorp/boundary/internal/servers/controller" "github.com/hashicorp/boundary/internal/types/scope" - "github.com/hashicorp/boundary/recovery" + "github.com/hashicorp/boundary/sdk/recovery" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/api/internal/parseutil/parseutil.go b/sdk/parseutil/parseutil.go similarity index 98% rename from api/internal/parseutil/parseutil.go rename to sdk/parseutil/parseutil.go index 09a28a9d7e..2d5b089948 100644 --- a/api/internal/parseutil/parseutil.go +++ b/sdk/parseutil/parseutil.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/hashicorp/boundary/api/internal/strutil" + "github.com/hashicorp/boundary/sdk/strutil" "github.com/hashicorp/errwrap" sockaddr "github.com/hashicorp/go-sockaddr" "github.com/mitchellh/mapstructure" diff --git a/recovery/recovery.go b/sdk/recovery/recovery.go similarity index 100% rename from recovery/recovery.go rename to sdk/recovery/recovery.go diff --git a/recovery/recovery_test.go b/sdk/recovery/recovery_test.go similarity index 100% rename from recovery/recovery_test.go rename to sdk/recovery/recovery_test.go diff --git a/api/internal/strutil/strutil.go b/sdk/strutil/strutil.go similarity index 100% rename from api/internal/strutil/strutil.go rename to sdk/strutil/strutil.go diff --git a/api/internal/strutil/strutil_test.go b/sdk/strutil/strutil_test.go similarity index 100% rename from api/internal/strutil/strutil_test.go rename to sdk/strutil/strutil_test.go diff --git a/internal/wrapper/wrapper.go b/sdk/wrapper/wrapper.go similarity index 95% rename from internal/wrapper/wrapper.go rename to sdk/wrapper/wrapper.go index 93510bec88..4194167356 100644 --- a/internal/wrapper/wrapper.go +++ b/sdk/wrapper/wrapper.go @@ -3,9 +3,9 @@ package wrapper import ( "fmt" + "github.com/hashicorp/boundary/sdk/strutil" wrapping "github.com/hashicorp/go-kms-wrapping" "github.com/hashicorp/shared-secure-libs/configutil" - "github.com/hashicorp/vault/sdk/helper/strutil" ) func GetWrapperFromPath(path, purpose string) (wrapping.Wrapper, error) {