Skip to content

Commit

Permalink
feat: use a struct to group validate input function parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
btfhernandez committed Jul 3, 2024
1 parent 335b81a commit ced1c9d
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions TestClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/BeyondTrust/go-client-library-passwordsafe/api/authentication"
logging "github.com/BeyondTrust/go-client-library-passwordsafe/api/logging"
managed_accounts "github.com/BeyondTrust/go-client-library-passwordsafe/api/managed_account"
"github.com/BeyondTrust/go-client-library-passwordsafe/api/secrets"
"github.com/BeyondTrust/go-client-library-passwordsafe/api/utils"

//"os"
Expand All @@ -25,9 +26,9 @@ func main() {
// create a zap logger wrapper
zapLogger := logging.NewZapLogger(logger)

apiUrl := "https://jury2310.ps-dev.beyondtrustcloud.com:443/BeyondTrust/api/public/v3/"
clientId := "6138d050-e266-4b05-9ced-35e7dd5093ae"
clientSecret := "71svdPLh2AR97sPs5gfPjGjpqSUxZTKSPmEvvbMx89o="
apiUrl := "https://example.com:443/BeyondTrust/api/public/v3/"
clientId := ""
clientSecret := ""
separator := "/"
certificate := ""
certificateKey := ""
Expand Down Expand Up @@ -78,29 +79,26 @@ func main() {
return
}

/*
// instantiating secret obj
secretObj, _ := secrets.NewSecretObj(*authenticate, zapLogger, maxFileSecretSizeBytes)
// instantiating secret obj
secretObj, _ := secrets.NewSecretObj(*authenticate, zapLogger, maxFileSecretSizeBytes)

secretPaths := []string{"fake/Client", "fake/test_file_1"}
secretPaths := []string{"fake/Client", "fake/test_file_1"}

gotSecrets, _ := secretObj.GetSecrets(secretPaths, separator)
gotSecrets, _ := secretObj.GetSecrets(secretPaths, separator)

// WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes:
zapLogger.Warn(fmt.Sprintf("%v", gotSecrets))
// getting single secret
gotSecret, _ := secretObj.GetSecret("fake/Test1", separator)
// WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes:
zapLogger.Warn(fmt.Sprintf("%v", gotSecrets))

// WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes:
zapLogger.Warn(fmt.Sprintf("Secret Test: %v", gotSecret))
// getting single secret
gotSecret, _ := secretObj.GetSecret("fake/Test1", separator)

*/
// WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes:
zapLogger.Warn(fmt.Sprintf("Secret Test: %v", gotSecret))

// instantiating managed account obj
manageAccountObj, _ := managed_accounts.NewManagedAccountObj(*authenticate, zapLogger)

newSecretPaths := []string{"system01/managed_account01", "system01/managed_account01"}
newSecretPaths := []string{"fake/account01", "fake/account01"}

//managedAccountList := strings.Split(paths, ",")
gotManagedAccounts, _ := manageAccountObj.GetSecrets(newSecretPaths, separator)
Expand All @@ -109,7 +107,7 @@ func main() {
zapLogger.Warn(fmt.Sprintf("%v", gotManagedAccounts))

// getting single managed account
gotManagedAccount, _ := manageAccountObj.GetSecret("system01/managed_account01", separator)
gotManagedAccount, _ := manageAccountObj.GetSecret("fake/account04", separator)

// WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes:
zapLogger.Warn(fmt.Sprintf("%v", gotManagedAccount))
Expand Down

0 comments on commit ced1c9d

Please sign in to comment.