From f25d76813620379c5fed93d718ff68adc94b4bfa Mon Sep 17 00:00:00 2001 From: Bianca Moreira Date: Mon, 18 Sep 2023 17:20:33 +0200 Subject: [PATCH] Initial Vault HCP Library commit --- Makefile | 7 +- cmd/vault-plugin-scaffolding/main.go | 32 - command.go | 18 + command_test.go | 15 + config.go | 155 ++ config_test.go | 52 + connect.go | 346 ++++ connect_test.go | 651 +++++++ disconnect.go | 41 + disconnect_test.go | 26 + flag.go | 34 + go.mod | 64 +- go.sum | 275 ++- mocks/cluster/ClusterClientService.go | 1519 +++++++++++++++++ .../organization/OrganizationClientService.go | 330 ++++ mocks/project/ProjectClientService.go | 363 ++++ testhelpers.go | 50 + 17 files changed, 3911 insertions(+), 67 deletions(-) delete mode 100644 cmd/vault-plugin-scaffolding/main.go create mode 100644 command.go create mode 100644 command_test.go create mode 100644 config.go create mode 100644 config_test.go create mode 100644 connect.go create mode 100644 connect_test.go create mode 100644 disconnect.go create mode 100644 disconnect_test.go create mode 100644 flag.go create mode 100644 mocks/cluster/ClusterClientService.go create mode 100644 mocks/organization/OrganizationClientService.go create mode 100644 mocks/project/ProjectClientService.go create mode 100644 testhelpers.go diff --git a/Makefile b/Makefile index 13a5261..c5f5d12 100644 --- a/Makefile +++ b/Makefile @@ -36,4 +36,9 @@ fmtcheck: .PHONY: fmt fmt: - gofumpt -l -w . \ No newline at end of file + gofumpt -l -w . + +mocks: + go install github.com/vektra/mockery/v2@v2.34.2 + mockery --srcpkg github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/organization_service --name=ClientService + mockery --srcpkg github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/project_service --name=ClientService diff --git a/cmd/vault-plugin-scaffolding/main.go b/cmd/vault-plugin-scaffolding/main.go deleted file mode 100644 index 8abfb27..0000000 --- a/cmd/vault-plugin-scaffolding/main.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -import ( - "os" - - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/api" - "github.com/hashicorp/vault/sdk/plugin" -) - -func main() { - apiClientMeta := &api.PluginAPIClientMeta{} - flags := apiClientMeta.FlagSet() - flags.Parse(os.Args[1:]) - - tlsConfig := apiClientMeta.GetTLSConfig() - tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig) - - err := plugin.ServeMultiplex(&plugin.ServeOpts{ - // set the TLSProviderFunc so that the plugin maintains backwards - // compatibility with Vault versions that don’t support plugin AutoMTLS - TLSProviderFunc: tlsProviderFunc, - // TODO: Add the plugin's Factory function here, e.g.: - // BackendFactoryFunc: vault-plugin-scaffolding.Factory, - }) - if err != nil { - logger := hclog.New(&hclog.LoggerOptions{}) - - logger.Error("plugin shutting down", "error", err) - os.Exit(1) - } -} diff --git a/command.go b/command.go new file mode 100644 index 0000000..601d3b6 --- /dev/null +++ b/command.go @@ -0,0 +1,18 @@ +package vaulthcplib + +import "github.com/mitchellh/cli" + +func InitHCPCommand(ui cli.Ui) map[string]cli.CommandFactory { + return map[string]cli.CommandFactory{ + "hcp connect": func() (cli.Command, error) { + return &HCPConnectCommand{ + Ui: ui, + }, nil + }, + "hcp disconnect": func() (cli.Command, error) { + return &HCPDisconnectCommand{ + Ui: ui, + }, nil + }, + } +} diff --git a/command_test.go b/command_test.go new file mode 100644 index 0000000..de09e1a --- /dev/null +++ b/command_test.go @@ -0,0 +1,15 @@ +package vaulthcplib + +import ( + "testing" + + "github.com/mitchellh/cli" + "github.com/stretchr/testify/assert" +) + +func Test_InitHCPCommand(t *testing.T) { + cmdMap := InitHCPCommand(&cli.MockUi{}) + + assert.Contains(t, cmdMap, "hcp connect") + assert.Contains(t, cmdMap, "hcp disconnect") +} diff --git a/config.go b/config.go new file mode 100644 index 0000000..1a06360 --- /dev/null +++ b/config.go @@ -0,0 +1,155 @@ +package vaulthcplib + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "time" + + "github.com/hashicorp/hcp-sdk-go/config" +) + +const ( + defaultDirectory = ".config/hcp/hvd" + testDirectory = "hcptest" + fileName = "hvd_proxy_config.json" + directoryPermissions = 0755 + + envVarCacheTestMode = "HCP_CACHE_TEST_MODE" +) + +type HCPToken struct { + AccessToken string `json:"access_token,omitempty"` + AccessTokenExpiry time.Time `json:"access_token_expiry,omitempty"` + ProxyAddr string `json:"proxy_addr,omitempty"` +} + +func GetHCPToken() (*HCPToken, error) { + configCache, err := readConfig() + if err != nil { + return nil, err + } + if configCache == nil { + return nil, nil + } + + // this will either get from a cache file or + opts := []config.HCPConfigOption{ + config.WithoutLogging(), + config.WithoutBrowserLogin(), + config.FromEnv(), + } + if configCache.ClientID != "" && configCache.SecretID != "" { + opts = append(opts, config.WithClientCredentials(configCache.ClientID, configCache.SecretID)) + } + hcp, err := config.NewHCPConfig(opts...) + + tk, err := hcp.Token() + if err != nil { + return nil, fmt.Errorf("failed to retrieve the HCP token: %w", err) + } + + return &HCPToken{ + AccessToken: tk.AccessToken, + AccessTokenExpiry: tk.Expiry, + ProxyAddr: configCache.ProxyAddr, + }, nil +} + +type HCPConfigCache struct { + ClientID string + SecretID string + ProxyAddr string +} + +// Write saves HCP auth data in a common location in the home directory. +func writeConfig(addr string, clientID string, secretID string) error { + credentialPath, credentialDirectory, err := getConfigPaths() + if err != nil { + return fmt.Errorf("failed to retrieve credential path and directory: %v", err) + } + + err = os.MkdirAll(credentialDirectory, directoryPermissions) + if err != nil { + return fmt.Errorf("failed to create credential directory: %v", err) + } + + cache := &HCPConfigCache{ + ClientID: clientID, + SecretID: secretID, + ProxyAddr: addr, + } + cacheJSON, err := json.Marshal(cache) + if err != nil { + return fmt.Errorf("failed to marshal the struct to json: %v", err) + } + + err = os.WriteFile(credentialPath, cacheJSON, directoryPermissions) + if err != nil { + return fmt.Errorf("failed to write config to the cache file: %v", err) + } + + return nil +} + +// readConfig opens the saved HCP auth data and returns the token. +func readConfig() (*HCPConfigCache, error) { + configPath, _, err := getConfigPaths() + if err != nil { + return nil, fmt.Errorf("failed to retrieve config path and directory: %v", err) + } + + var cache HCPConfigCache + if _, err = os.Stat(configPath); os.IsNotExist(err) { + return nil, nil + } + + rawJSON, err := os.ReadFile(configPath) + if err != nil { + return nil, fmt.Errorf("failed to read file from user's config path: %v", err) + } + + err = json.Unmarshal(rawJSON, &cache) + if err != nil { + return nil, err + } + return &cache, nil +} + +func eraseConfig() error { + _, credentialDirectory, err := getConfigPaths() + if err != nil { + return fmt.Errorf("failed to retrieve credential path and directory: %v", err) + } + + err = os.RemoveAll(credentialDirectory) + if err != nil { + return fmt.Errorf("failed to remove config directory: %v", err) + } + + return nil +} + +// getCredentialPaths returns the complete credential path and directory. +func getConfigPaths() (configPath string, configDirectory string, err error) { + // Get the user's home directory. + userHome, err := os.UserHomeDir() + if err != nil { + return "", "", fmt.Errorf("failed to retrieve user's home directory path: %v", err) + } + + directoryName := defaultDirectory + // If in test mode, use test directory. + if testMode, ok := os.LookupEnv(envVarCacheTestMode); ok { + if testMode == "true" { + directoryName = testDirectory + } + } + + // Determine absolute path to config file and directory. + configDirectory = filepath.Join(userHome, directoryName) + configPath = filepath.Join(userHome, directoryName, fileName) + + return configPath, configDirectory, nil +} diff --git a/config_test.go b/config_test.go new file mode 100644 index 0000000..6c87e8c --- /dev/null +++ b/config_test.go @@ -0,0 +1,52 @@ +package vaulthcplib + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +func Test_GetHCPConfiguration(t *testing.T) { + cases := map[string]struct { + Valid bool + }{ + "valid hcp configuration": { + Valid: true, + }, + "empty hcp configuration": { + Valid: false, + }, + } + + for n, tst := range cases { + t.Run(n, func(t *testing.T) { + CacheSetup(t, tst.Valid) + + tk, err := GetHCPToken() + + assert.NoError(t, err) + + if tst.Valid { + assert.Equal(t, "https://hcp-proxy.addr:8200", tk.ProxyAddr) + assert.Contains(t, tk.AccessToken, "Test.Access.Token") + assert.NotEmpty(t, tk.AccessTokenExpiry) + } else { + assert.Nil(t, tk) + assert.Nil(t, err) + } + + }) + } +} + +func Test_GetHCPConfiguration_EraseConfig(t *testing.T) { + err := os.Setenv(envVarCacheTestMode, "true") + assert.NoError(t, err) + + err = eraseConfig() + assert.NoError(t, err) + + _, err = GetHCPToken() + assert.NoError(t, err) +} diff --git a/connect.go b/connect.go new file mode 100644 index 0000000..aa43cec --- /dev/null +++ b/connect.go @@ -0,0 +1,346 @@ +package vaulthcplib + +import ( + "errors" + "flag" + "fmt" + "strings" + + "github.com/hashicorp/hcp-sdk-go/auth" + hcprmo "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/organization_service" + hcprmp "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/project_service" + hcprmm "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/models" + hcpvs "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/client/vault_service" + hcpvsm "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" + "github.com/hashicorp/hcp-sdk-go/config" + "github.com/hashicorp/hcp-sdk-go/httpclient" + "github.com/mitchellh/cli" +) + +var ( + _ cli.Command = (*HCPConnectCommand)(nil) +) + +type HCPConnectCommand struct { + Ui cli.Ui + + flagNonInteractiveMethod bool + flagClientID string + flagSecretID string + flagOrganizationID string + flagProjectID string + flagClusterID string + + // for testing + rmOrgClient hcprmo.ClientService + vsClient hcpvs.ClientService + rmProjClient hcprmp.ClientService + testAuthSession auth.Session +} + +func (c *HCPConnectCommand) Help() string { + helpText := ` +Usage: vault hcp connect [options] + + Authenticates users or machines to HCP using either provided arguments or retrieved token through + browser login. A successful authentication results in an HCP token and an HCP Vault address being + locally cached. + + The default authentication method is an interactive one, redirecting users to the HCP login browser. + If a non-interactive option is supplied, it can be used if provided with a service principal credential + generated through the HCP portal with the necessary capabilities to access the organization, project, and + HCP Vault cluster chosen. + + $ vault hcp connect -non-interactive=true -client-id=client-id-value -secret-id=secret-id-value + + Additionally, the organization identification, project identification, and cluster name can be passed in to + directly connect to a specific HCP Vault cluster without interacting with the CLI. + + $ vault hcp connect -non-interactive=true -client-id=client-id-value -secret-id=secret-id-value -organization-id=org-UUID -project-id=proj-UUID -cluster-id=cluster-name +` + return strings.TrimSpace(helpText) +} + +func (c *HCPConnectCommand) Run(args []string) int { + f := c.Flags() + + if err := f.Parse(args); err != nil { + c.Ui.Error(err.Error()) + return 1 + } + + if err := c.setupClients(); err != nil { + c.Ui.Error(err.Error()) + return 1 + } + + proxyAddr, err := c.getProxyAddr(c.rmOrgClient, c.rmProjClient, c.vsClient) + if err != nil { + c.Ui.Error(err.Error()) + return 1 + } + + err = writeConfig(proxyAddr, c.flagClientID, c.flagSecretID) + if err != nil { + c.Ui.Error(fmt.Sprintf("Failed to connect to HCP Vault Cluster: %s", err)) + return 1 + } + + return 0 +} + +func (c *HCPConnectCommand) setupClients() error { + var opts []config.HCPConfigOption + if c.testAuthSession != nil { + opts = []config.HCPConfigOption{config.WithSession(c.testAuthSession)} + } else { + opts = []config.HCPConfigOption{config.FromEnv()} + if c.flagClientID != "" && c.flagSecretID != "" { + opts = append(opts, config.WithClientCredentials(c.flagClientID, c.flagSecretID)) + opts = append(opts, config.WithoutBrowserLogin()) + } + } + + cfg, err := config.NewHCPConfig(opts...) + if err != nil { + return errors.New(fmt.Sprintf("Failed to connect to HCP: %s", err)) + } + + hcpHttpClient, err := httpclient.New(httpclient.Config{HCPConfig: cfg}) + if err != nil { + return errors.New(fmt.Sprintf("Failed to connect to HCP: %s", err)) + } + + if c.rmOrgClient == nil { + c.rmOrgClient = hcprmo.New(hcpHttpClient, nil) + } + if c.rmProjClient == nil { + c.rmProjClient = hcprmp.New(hcpHttpClient, nil) + } + if c.vsClient == nil { + c.vsClient = hcpvs.New(hcpHttpClient, nil) + } + + return nil +} + +func (c *HCPConnectCommand) getProxyAddr(organizationClient hcprmo.ClientService, projectClient hcprmp.ClientService, clusterClient hcpvs.ClientService) (string, error) { + var err error + + var organizationID string + if c.flagOrganizationID != "" { + organizationID = c.flagOrganizationID + } else { + organizationID, err = c.getOrganization(organizationClient) + if err != nil { + return "", errors.New(fmt.Sprintf("Failed to get HCP organization information: %s", err)) + } + } + + var projectID string + if c.flagProjectID != "" { + projectID = c.flagProjectID + } else { + projectID, err = c.getProject(organizationID, projectClient) + if err != nil { + return "", errors.New(fmt.Sprintf("Failed to get HCP project information: %s", err)) + } + } + + proxyAddr, err := c.getCluster(organizationID, projectID, c.flagClusterID, clusterClient) + if err != nil { + return "", errors.New(fmt.Sprintf("Failed to get HCP Vault Cluster information: %s", err)) + } + return proxyAddr, nil +} + +func (c *HCPConnectCommand) Synopsis() string { + return "Connect to an HCP Vault Cluster" +} + +func (c *HCPConnectCommand) Flags() *flag.FlagSet { + mainSet := flag.NewFlagSet("", flag.ContinueOnError) + + mainSet.BoolVar(&c.flagNonInteractiveMethod, "non-interactive", false, "") + mainSet.StringVar(&c.flagClientID, "client-id", "", "") + mainSet.StringVar(&c.flagSecretID, "secret-id", "", "") + mainSet.StringVar(&c.flagOrganizationID, "organization-id", "", "") + mainSet.StringVar(&c.flagProjectID, "project-id", "", "") + mainSet.StringVar(&c.flagClusterID, "cluster-id", "", "") + + return mainSet +} + +func (c *HCPConnectCommand) getOrganization(rmOrgClient hcprmo.ClientService) (organizationID string, err error) { + organizationsResp, err := rmOrgClient.OrganizationServiceList(hcprmo.NewOrganizationServiceListParams().WithDefaults(), nil) + switch { + case err != nil: + return "", err + case organizationsResp.GetPayload() == nil: + return "", errors.New("payload is nil") + case len(organizationsResp.GetPayload().Organizations) < 1: + return "", errors.New("no organizations available") + case len(organizationsResp.GetPayload().Organizations) > 1: + orgs := make(map[string]*hcprmm.HashicorpCloudResourcemanagerOrganization, len(organizationsResp.GetPayload().Organizations)) + for _, org := range organizationsResp.GetPayload().Organizations { + if *org.State == hcprmm.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE { + c.Ui.Info(fmt.Sprintf("\nHCP Organization Name: %s", org.Name)) + name := strings.ToLower(org.Name) + orgs[name] = org + } + } + userInput, err := c.Ui.Ask(fmt.Sprintf("Choose one organization: ")) + if err != nil { + return "", err + } + chosenOrg, ok := orgs[userInput] + if !ok { + return "", errors.New(fmt.Sprintf("invalid HCP organization: %s", userInput)) + } + // set the org ID + organizationID = chosenOrg.ID + organizationName := chosenOrg.ID + + c.Ui.Info(fmt.Sprintf("HCP Organization: %s", organizationName)) + return organizationID, nil + default: + organization := organizationsResp.GetPayload().Organizations[0] + if *organization.State != hcprmm.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE { + return "", errors.New("organization is not active") + } + organizationID = organization.ID + c.Ui.Info(fmt.Sprintf("HCP Organization: %s", organization.Name)) + return organizationID, nil + } +} + +func (c *HCPConnectCommand) getProject(organizationID string, rmProjClient hcprmp.ClientService) (projectID string, err error) { + scopeType := "ORGANIZATION" + projectListReq := hcprmp. + NewProjectServiceListParams(). + WithDefaults(). + WithScopeType(&scopeType). + WithScopeID(&organizationID) + projectResp, err := rmProjClient.ProjectServiceList(projectListReq, nil) + switch { + case err != nil: + return "", err + case projectResp.GetPayload() == nil: + return "", errors.New("payload is nil") + case len(projectResp.GetPayload().Projects) < 1: + return "", errors.New("no projects available") + case len(projectResp.GetPayload().Projects) > 1: + projs := make(map[string]*hcprmm.HashicorpCloudResourcemanagerProject, len(projectResp.GetPayload().Projects)) + for _, proj := range projectResp.GetPayload().Projects { + if *proj.State == hcprmm.HashicorpCloudResourcemanagerProjectProjectStateACTIVE { + c.Ui.Info(fmt.Sprintf("\nHCP Project Name: %s", proj.Name)) + name := strings.ToLower(proj.Name) + projs[name] = proj + } + } + userInput, err := c.Ui.Ask(fmt.Sprintf("Choose one project: ")) + if err != nil { + return "", err + } + chosenProj, ok := projs[userInput] + if !ok { + return "", errors.New(fmt.Sprintf("invalid HCP project: %s", userInput)) + } + + // set the project ID + projectID = chosenProj.ID + projectName := chosenProj.Name + + c.Ui.Info(fmt.Sprintf("HCP Project: %s", projectName)) + return projectID, nil + default: + project := projectResp.GetPayload().Projects[0] + if *project.State != hcprmm.HashicorpCloudResourcemanagerProjectProjectStateACTIVE { + return "", errors.New("project is not active") + } + projectID = project.ID + c.Ui.Info(fmt.Sprintf("HCP Project: %s", project.Name)) + + return projectID, nil + } +} + +func (c *HCPConnectCommand) getCluster(organizationID string, projectID string, clusterID string, vsClient hcpvs.ClientService) (proxyAddr string, err error) { + if clusterID == "" { + return c.listClusters(organizationID, projectID, vsClient) + } + + clusterGetReq := hcpvs.NewGetParams(). + WithDefaults(). + WithLocationOrganizationID(organizationID). + WithLocationProjectID(projectID). + WithClusterID(clusterID) + clusterResp, err := vsClient.Get(clusterGetReq, nil) + switch { + case err != nil: + return "", err + case clusterResp.GetPayload() == nil: + return "", errors.New("payload is nil") + default: + cluster := clusterResp.GetPayload().Cluster + if *cluster.State != hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING { + return "", errors.New("cluster is not running") + } + c.Ui.Info(fmt.Sprintf("HCP Vault Cluster: %s", cluster.ID)) + + proxyAddr = "https://" + cluster.DNSNames.Proxy + return proxyAddr, nil + } +} + +func (c *HCPConnectCommand) listClusters(organizationID string, projectID string, vsClient hcpvs.ClientService) (proxyAddr string, err error) { + clusterListReq := hcpvs.NewListParams(). + WithDefaults(). + WithLocationOrganizationID(organizationID). + WithLocationProjectID(projectID) + + // Purposely calling List instead of ListAll because we are only interested in HVD clusters. + clustersResp, err := vsClient.List(clusterListReq, nil) + switch { + case err != nil: + return "", err + case clustersResp.GetPayload() == nil: + return "", errors.New("payload is nil") + case len(clustersResp.GetPayload().Clusters) < 1: + return "", errors.New("no clusters available") + case len(clustersResp.GetPayload().Clusters) > 1: + clusters := make(map[string]*hcpvsm.HashicorpCloudVault20201125Cluster, len(clustersResp.GetPayload().Clusters)) + for _, cluster := range clustersResp.GetPayload().Clusters { + if *cluster.State == hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING { + c.Ui.Info(fmt.Sprintf("\nHCP Vault Cluster ID: %s", cluster.ID)) + id := strings.ToLower(cluster.ID) + clusters[id] = cluster + } + } + userInput, err := c.Ui.Ask("\nChoose a Vault cluster:") + if err != nil { + c.Ui.Error(fmt.Sprintf("Failed to get HCP Vault Cluster information: %s", err)) + return "", err + } + + // set the cluster ID + cluster, ok := clusters[userInput] + if !ok { + return "", errors.New(fmt.Sprintf("invalid cluster: %s", userInput)) + } + c.Ui.Info(fmt.Sprintf("\nHCP Vault Cluster: %s", cluster.ID)) + + proxyAddr = "https://" + cluster.DNSNames.Proxy + return proxyAddr, nil + default: + cluster := clustersResp.GetPayload().Clusters[0] + if *cluster.State != hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING { + return "", errors.New("cluster is not running") + } + projectID = cluster.ResourceID + c.Ui.Info(fmt.Sprintf("HCP Vault Cluster: %s", cluster.ID)) + + proxyAddr = "https://" + cluster.DNSNames.Proxy + return proxyAddr, nil + } +} diff --git a/connect_test.go b/connect_test.go new file mode 100644 index 0000000..a0d9e47 --- /dev/null +++ b/connect_test.go @@ -0,0 +1,651 @@ +package vaulthcplib + +import ( + "errors" + "io" + "os" + "testing" + + "github.com/hashicorp/hcp-sdk-go/auth" + "github.com/mitchellh/cli" + + clustermocks "github.com/hashicorp/vault-hcp-lib/mocks/cluster" + + orgmocks "github.com/hashicorp/vault-hcp-lib/mocks/organization" + projmocks "github.com/hashicorp/vault-hcp-lib/mocks/project" + + "github.com/google/uuid" + hcprmo "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/organization_service" + hcprmp "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/project_service" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/models" + hcpvs "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/client/vault_service" + hcpvsm "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +func testHCPConnectCommand() (*cli.MockUi, *HCPConnectCommand) { + ui := cli.NewMockUi() + return ui, &HCPConnectCommand{Ui: ui, testAuthSession: &auth.MockSession{}} +} + +func Test_HCPConnectCommand(t *testing.T) { + err := os.Setenv(envVarCacheTestMode, "true") + if err != nil { + t.Error(err) + } + + _, cmd := testHCPConnectCommand() + + mockRmOrgClient := orgmocks.NewClientService(t) + mockRmOrgClient. + On("OrganizationServiceList", mock.Anything, nil). + Return(&hcprmo.OrganizationServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerOrganizationListResponse{ + Organizations: []*models.HashicorpCloudResourcemanagerOrganization{ + { + ID: uuid.New().String(), + Name: "mock-organization-1", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState( + models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE, + ), + }, + }, + }, + }, nil) + + mockRmProjClient := projmocks.NewClientService(t) + mockRmProjClient. + On("ProjectServiceList", mock.Anything, nil). + Return(&hcprmp.ProjectServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerProjectListResponse{ + Projects: []*models.HashicorpCloudResourcemanagerProject{ + { + ID: uuid.New().String(), + Name: "mock-project-1", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState( + models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE, + ), + }, + }, + }, + }, nil) + + mockVsClient := clustermocks.NewClientService(t) + mockVsClient. + On("Get", mock.Anything, nil). + Return(&hcpvs.GetOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125GetResponse{ + Cluster: &hcpvsm.HashicorpCloudVault20201125Cluster{ + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState( + hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING, + ), + }, + }, + }, nil) + + cmd.rmOrgClient = mockRmOrgClient + cmd.rmProjClient = mockRmProjClient + cmd.vsClient = mockVsClient + + cmd.flagClusterID = "cluster-1" + + result := cmd.Run([]string{}) + assert.Equal(t, 0, result) +} + +func Test_getOrganization(t *testing.T) { + organizationID := uuid.New().String() + organizationIDTwo := uuid.New().String() + organizationIDThree := uuid.New().String() + + tests := map[string]struct { + userInputOrganizationName string + expectedOrganizationID string + + organizationServiceListResponse *hcprmo.OrganizationServiceListOK + + expectedError error + }{ + // Test single organization + // No UI interaction required + "single organization": { + expectedOrganizationID: organizationID, + organizationServiceListResponse: &hcprmo.OrganizationServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerOrganizationListResponse{ + Organizations: []*models.HashicorpCloudResourcemanagerOrganization{ + { + ID: organizationID, + Name: "mock-organization-1", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + }, + }, + }, + }, + + // Test multiple organizations + // UI interaction required + "multiple organizations": { + userInputOrganizationName: "mock-organization-2", + expectedOrganizationID: organizationIDTwo, + organizationServiceListResponse: &hcprmo.OrganizationServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerOrganizationListResponse{ + Organizations: []*models.HashicorpCloudResourcemanagerOrganization{ + { + ID: organizationID, + Name: "mock-organization-1", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + { + ID: organizationIDTwo, + Name: "mock-organization-2", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + { + ID: organizationIDThree, + Name: "mock-organization-3", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + }, + }, + }, + }, + + // Test invalid organization + // UI interaction required + "invalid organization": { + userInputOrganizationName: "mock-organization-4", + organizationServiceListResponse: &hcprmo.OrganizationServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerOrganizationListResponse{ + Organizations: []*models.HashicorpCloudResourcemanagerOrganization{ + { + ID: organizationID, + Name: "mock-organization-1", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + { + ID: organizationIDTwo, + Name: "mock-organization-2", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + { + ID: organizationIDThree, + Name: "mock-organization-3", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + }, + }, + }, + expectedError: errors.New("invalid HCP organization: mock-organization-4"), + }, + + // Test generic expectedError returned + "expectedError": { + expectedError: errors.New("error getting organization"), + }, + } + + for n, tst := range tests { + t.Run(n, func(t *testing.T) { + ui, cmd := testHCPConnectCommand() + stdinR, stdinW := io.Pipe() + go func() { + stdinW.Write([]byte(tst.userInputOrganizationName)) + stdinW.Close() + }() + ui.InputReader = stdinR + + mockRmOrgClient := orgmocks.NewClientService(t) + + mockRmOrgClient. + On("OrganizationServiceList", mock.Anything, nil). + Return(tst.organizationServiceListResponse, tst.expectedError) + + orgID, err := cmd.getOrganization(mockRmOrgClient) + if tst.expectedError != nil { + assert.Error(t, tst.expectedError) + } else { + assert.NoError(t, err) + assert.Equal(t, tst.expectedOrganizationID, orgID) + } + }) + } + +} + +func Test_getProject(t *testing.T) { + projectID := uuid.New().String() + projectIDTwo := uuid.New().String() + projectIDThree := uuid.New().String() + + tests := map[string]struct { + userInputProjectName string + expectedProjectID string + + projectServiceListResponse *hcprmp.ProjectServiceListOK + + expectedError error + }{ + // Test single project + // No UI interaction required + "single project": { + expectedProjectID: projectID, + projectServiceListResponse: &hcprmp.ProjectServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerProjectListResponse{ + Projects: []*models.HashicorpCloudResourcemanagerProject{ + { + ID: projectID, + Name: "mock-project-1", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + }, + }, + }, + }, + + // Test multiple projects + // UI interaction required + "multiple projects": { + userInputProjectName: "mock-project-2", + expectedProjectID: projectIDTwo, + projectServiceListResponse: &hcprmp.ProjectServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerProjectListResponse{ + Projects: []*models.HashicorpCloudResourcemanagerProject{ + { + ID: projectID, + Name: "mock-project-1", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + { + ID: projectIDTwo, + Name: "mock-project-2", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + { + ID: projectIDThree, + Name: "mock-project-3", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + }, + }, + }, + }, + + // Test invalid project + // UI interaction required + "invalid project": { + userInputProjectName: "mock-project-4", + expectedProjectID: projectID, + projectServiceListResponse: &hcprmp.ProjectServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerProjectListResponse{ + Projects: []*models.HashicorpCloudResourcemanagerProject{ + { + ID: projectID, + Name: "mock-project-1", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + { + ID: projectIDTwo, + Name: "mock-project-2", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + { + ID: projectIDThree, + Name: "mock-project-3", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + }, + }, + }, + expectedError: errors.New("invalid HCP project: mock-project-4"), + }, + + // Test generic expectedError returned + "expectedError": { + expectedError: errors.New("error getting project"), + }, + } + + for n, tst := range tests { + t.Run(n, func(t *testing.T) { + ui, cmd := testHCPConnectCommand() + stdinR, stdinW := io.Pipe() + go func() { + stdinW.Write([]byte(tst.userInputProjectName)) + stdinW.Close() + }() + ui.InputReader = stdinR + + mockRmProjClient := projmocks.NewClientService(t) + + mockRmProjClient. + On("ProjectServiceList", mock.Anything, nil). + Return(tst.projectServiceListResponse, tst.expectedError) + + projID, err := cmd.getProject("", mockRmProjClient) + if tst.expectedError != nil { + assert.Error(t, tst.expectedError) + } else { + assert.NoError(t, err) + assert.Equal(t, tst.expectedProjectID, projID) + } + }) + } + +} + +func Test_getCluster(t *testing.T) { + tests := map[string]struct { + expectedProxyAddr string + userParamCluster string + userInputCluster string + + getClusterServiceListResponse *hcpvs.GetOK + listClustersServiceListResponse *hcpvs.ListOK + + expectedError error + }{ + // Test using cluster id received as a parameter + // No UI interaction required + "parameter cluster": { + userParamCluster: "cluster-1", + expectedProxyAddr: "https://hcp-proxy-cluster-1.addr:8200", + getClusterServiceListResponse: &hcpvs.GetOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125GetResponse{ + Cluster: &hcpvsm.HashicorpCloudVault20201125Cluster{ + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + }, + + // Test single project + // No UI interaction required + "single cluster": { + expectedProxyAddr: "https://hcp-proxy-cluster-1.addr:8200", + listClustersServiceListResponse: &hcpvs.ListOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125ListResponse{ + Clusters: []*hcpvsm.HashicorpCloudVault20201125Cluster{ + { + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + }, + }, + + // Test multiple projects + // UI interaction required + "multiple clusters": { + expectedProxyAddr: "https://hcp-proxy-cluster-2.addr:8200", + userInputCluster: "cluster-2", + listClustersServiceListResponse: &hcpvs.ListOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125ListResponse{ + Clusters: []*hcpvsm.HashicorpCloudVault20201125Cluster{ + { + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + { + ID: "cluster-2", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-2.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + { + ID: "cluster-3", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-3.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + }, + }, + + // Test invalid project + // UI interaction required + "invalid cluster": { + userInputCluster: "cluster-4", + listClustersServiceListResponse: &hcpvs.ListOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125ListResponse{ + Clusters: []*hcpvsm.HashicorpCloudVault20201125Cluster{ + { + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + { + ID: "cluster-2", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-2.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + { + ID: "cluster-3", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-3.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + }, + expectedError: errors.New("invalid cluster: cluster-4"), + }, + + // Test generic expectedError returned + "expectedError": { + expectedError: errors.New("error getting cluster"), + }, + } + + for n, tst := range tests { + t.Run(n, func(t *testing.T) { + ui, cmd := testHCPConnectCommand() + stdinR, stdinW := io.Pipe() + go func() { + stdinW.Write([]byte(tst.userInputCluster)) + stdinW.Close() + }() + ui.InputReader = stdinR + + mockVsClient := clustermocks.NewClientService(t) + + // in case user pass in the cluster id, we'll request the cluster details from the Get RPC + // else we'll request a list of clusters and ask to choose one + if tst.userParamCluster != "" { + mockVsClient. + On("Get", mock.Anything, nil). + Return(tst.getClusterServiceListResponse, tst.expectedError) + } else { + mockVsClient. + On("List", mock.Anything, nil). + Return(tst.listClustersServiceListResponse, tst.expectedError) + } + + proxyAddr, err := cmd.getCluster("", "", tst.userParamCluster, mockVsClient) + if tst.expectedError != nil { + assert.Error(t, tst.expectedError) + } else { + assert.NoError(t, err) + assert.Equal(t, tst.expectedProxyAddr, proxyAddr) + } + }) + } +} + +func Test_getProxyAddr(t *testing.T) { + tests := map[string]struct { + expectedProxyAddr string + userParamCluster string + getClusterServiceListResponse *hcpvs.GetOK + + userParamOrgID string + organizationServiceListResponse *hcprmo.OrganizationServiceListOK + + userParamProjID string + projectServiceListResponse *hcprmp.ProjectServiceListOK + + expectedError error + }{ + "success: not parameterized org, not parameterized project": { + userParamCluster: "cluster-1", + expectedProxyAddr: "https://hcp-proxy-cluster-1.addr:8200", + getClusterServiceListResponse: &hcpvs.GetOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125GetResponse{ + Cluster: &hcpvsm.HashicorpCloudVault20201125Cluster{ + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + organizationServiceListResponse: &hcprmo.OrganizationServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerOrganizationListResponse{ + Organizations: []*models.HashicorpCloudResourcemanagerOrganization{ + { + ID: uuid.New().String(), + Name: "mock-organization-1", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + }, + }, + }, + projectServiceListResponse: &hcprmp.ProjectServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerProjectListResponse{ + Projects: []*models.HashicorpCloudResourcemanagerProject{ + { + ID: uuid.New().String(), + Name: "mock-project-1", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + }, + }, + }, + }, + + "success: parameterized org": { + userParamCluster: "cluster-1", + expectedProxyAddr: "https://hcp-proxy-cluster-1.addr:8200", + getClusterServiceListResponse: &hcpvs.GetOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125GetResponse{ + Cluster: &hcpvsm.HashicorpCloudVault20201125Cluster{ + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + userParamOrgID: uuid.New().String(), + projectServiceListResponse: &hcprmp.ProjectServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerProjectListResponse{ + Projects: []*models.HashicorpCloudResourcemanagerProject{ + { + ID: uuid.New().String(), + Name: "mock-project-1", + State: models.NewHashicorpCloudResourcemanagerProjectProjectState(models.HashicorpCloudResourcemanagerProjectProjectStateACTIVE), + }, + }, + }, + }, + }, + + "success: parameterized project": { + userParamCluster: "cluster-1", + expectedProxyAddr: "https://hcp-proxy-cluster-1.addr:8200", + getClusterServiceListResponse: &hcpvs.GetOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125GetResponse{ + Cluster: &hcpvsm.HashicorpCloudVault20201125Cluster{ + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + organizationServiceListResponse: &hcprmo.OrganizationServiceListOK{ + Payload: &models.HashicorpCloudResourcemanagerOrganizationListResponse{ + Organizations: []*models.HashicorpCloudResourcemanagerOrganization{ + { + ID: uuid.New().String(), + Name: "mock-organization-1", + State: models.NewHashicorpCloudResourcemanagerOrganizationOrganizationState(models.HashicorpCloudResourcemanagerOrganizationOrganizationStateACTIVE), + }, + }, + }, + }, + userParamProjID: uuid.New().String(), + }, + + "success: parameterized org and project": { + userParamCluster: "cluster-1", + expectedProxyAddr: "https://hcp-proxy-cluster-1.addr:8200", + getClusterServiceListResponse: &hcpvs.GetOK{ + Payload: &hcpvsm.HashicorpCloudVault20201125GetResponse{ + Cluster: &hcpvsm.HashicorpCloudVault20201125Cluster{ + ID: "cluster-1", + DNSNames: &hcpvsm.HashicorpCloudVault20201125ClusterDNSNames{Proxy: "hcp-proxy-cluster-1.addr:8200"}, + State: hcpvsm.NewHashicorpCloudVault20201125ClusterState(hcpvsm.HashicorpCloudVault20201125ClusterStateRUNNING), + }, + }, + }, + userParamOrgID: uuid.New().String(), + userParamProjID: uuid.New().String(), + }, + + "error: parameterized org and project": { + userParamCluster: "cluster-1", + expectedProxyAddr: "https://hcp-proxy-cluster-1.addr:8200", + userParamOrgID: "invalid-org", + userParamProjID: "invalid-proj", + expectedError: errors.New("error getting cluster"), + }, + } + + for n, tst := range tests { + t.Run(n, func(t *testing.T) { + _, cmd := testHCPConnectCommand() + cmd.flagClusterID = tst.userParamCluster + cmd.flagOrganizationID = tst.userParamOrgID + cmd.flagProjectID = tst.userParamProjID + + mockRmOrgClient := orgmocks.NewClientService(t) + mockRmProjClient := projmocks.NewClientService(t) + mockVsClient := clustermocks.NewClientService(t) + + // mock vault service response + if tst.getClusterServiceListResponse != nil { + mockVsClient. + On("Get", mock.Anything, nil). + Return(tst.getClusterServiceListResponse, nil) + } else { + mockVsClient. + On("Get", mock.Anything, nil). + Return(nil, tst.expectedError) + } + + // mock resource manager service response + if tst.organizationServiceListResponse != nil { + mockRmOrgClient. + On("OrganizationServiceList", mock.Anything, nil). + Return(tst.organizationServiceListResponse, nil) + } + if tst.projectServiceListResponse != nil { + mockRmProjClient. + On("ProjectServiceList", mock.Anything, nil). + Return(tst.projectServiceListResponse, nil) + } + + proxyAddr, err := cmd.getProxyAddr(mockRmOrgClient, mockRmProjClient, mockVsClient) + if tst.expectedError != nil { + assert.Error(t, tst.expectedError) + } else { + assert.NoError(t, err) + assert.Equal(t, tst.expectedProxyAddr, proxyAddr) + } + }) + } +} diff --git a/disconnect.go b/disconnect.go new file mode 100644 index 0000000..28ea5ad --- /dev/null +++ b/disconnect.go @@ -0,0 +1,41 @@ +package vaulthcplib + +import ( + "fmt" + "strings" + + "github.com/mitchellh/cli" +) + +var ( + _ cli.Command = (*HCPDisconnectCommand)(nil) +) + +type HCPDisconnectCommand struct { + Ui cli.Ui +} + +func (c *HCPDisconnectCommand) Help() string { + helpText := ` +Usage: vault hcp disconnect [options] + + Cleans up the cache with the HCP credentials used to connect to a HCP Vault cluster. + + $ vault hcp disconnect +` + return strings.TrimSpace(helpText) +} + +func (c *HCPDisconnectCommand) Run(_ []string) int { + err := eraseConfig() + if err != nil { + c.Ui.Error(fmt.Sprintf("Failed to disconnect from HCP Vault Cluster: %s", err)) + return 1 + } + + return 0 +} + +func (c *HCPDisconnectCommand) Synopsis() string { + return "Disconnect from the HCP Vault Cluster" +} diff --git a/disconnect_test.go b/disconnect_test.go new file mode 100644 index 0000000..20c1f9a --- /dev/null +++ b/disconnect_test.go @@ -0,0 +1,26 @@ +package vaulthcplib + +import ( + "os" + "testing" + + "github.com/mitchellh/cli" + "github.com/stretchr/testify/assert" +) + +func testHCPDisconnectCommand() (*cli.MockUi, *HCPDisconnectCommand) { + ui := cli.NewMockUi() + return ui, &HCPDisconnectCommand{Ui: ui} +} + +func Test_HCPDisconnectCommand(t *testing.T) { + err := os.Setenv(envVarCacheTestMode, "true") + if err != nil { + t.Error(err) + } + + _, cmd := testHCPDisconnectCommand() + + result := cmd.Run([]string{}) + assert.Equal(t, 0, result) +} diff --git a/flag.go b/flag.go new file mode 100644 index 0000000..30848e1 --- /dev/null +++ b/flag.go @@ -0,0 +1,34 @@ +package vaulthcplib + +import "strconv" + +type boolValue struct { + target *bool +} + +func (v *boolValue) String() string { + return strconv.FormatBool(*v.target) +} + +func (v *boolValue) Set(s string) error { + value, err := strconv.ParseBool(s) + if err != nil { + return err + } + + *v.target = value + return nil +} + +type stringValue struct { + target *string +} + +func (v *stringValue) String() string { + return *v.target +} + +func (v *stringValue) Set(s string) error { + *v.target = s + return nil +} diff --git a/go.mod b/go.mod index f572a32..15c8bb2 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,17 @@ module github.com/hashicorp/vault-hcp-lib -go 1.20 +go 1.21 require ( - github.com/hashicorp/go-hclog v1.5.0 - github.com/hashicorp/vault/api v1.9.2 - github.com/hashicorp/vault/sdk v0.9.1 + github.com/go-openapi/runtime v0.25.0 + github.com/google/uuid v1.3.0 + github.com/hashicorp/hcp-sdk-go v0.70.1-0.20231027171745-aa8cd4ca3fa0 + github.com/mitchellh/cli v1.0.0 + github.com/stretchr/testify v1.8.4 + golang.org/x/oauth2 v0.12.0 ) require ( - github.com/armon/go-metrics v0.4.1 // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/fatih/color v1.13.0 // indirect @@ -17,28 +19,30 @@ require ( github.com/go-jose/go-jose/v3 v3.0.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fatih/color v1.14.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/analysis v0.21.4 // indirect + github.com/go-openapi/errors v0.20.3 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.20.0 // indirect + github.com/go-openapi/loads v0.21.2 // indirect + github.com/go-openapi/spec v0.20.8 // indirect + github.com/go-openapi/strfmt v0.21.3 // indirect + github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/validate v0.22.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-kms-wrapping/v2 v2.0.8 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.4.8 // indirect - github.com/hashicorp/go-retryablehttp v0.7.1 // indirect - github.com/hashicorp/go-rootcerts v1.0.2 // indirect - github.com/hashicorp/go-secure-stdlib/mlock v0.1.2 // indirect - github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect - github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect - github.com/hashicorp/go-sockaddr v1.0.2 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/hcl v1.0.1-vault-5 // indirect - github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.1.0 // indirect @@ -53,4 +57,20 @@ require ( google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect google.golang.org/grpc v1.53.0 // indirect google.golang.org/protobuf v1.28.1 // indirect + github.com/oklog/ulid v1.3.1 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/posener/complete v1.1.1 // indirect + github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + go.mongodb.org/mongo-driver v1.11.0 // indirect + go.opentelemetry.io/otel v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/sys v0.12.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 68f4dc9..d8e4393 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +<<<<<<< HEAD github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -5,21 +6,31 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= +======= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +<<<<<<< HEAD github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +======= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +<<<<<<< HEAD github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -52,13 +63,93 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +======= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= +github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc= +github.com/go-openapi/analysis v0.21.4/go.mod h1:4zQ35W4neeZTqh3ol0rv/O8JBbka9QyAgQRPp9y3pfo= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc= +github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= +github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= +github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= +github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= +github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= +github.com/go-openapi/runtime v0.25.0 h1:7yQTCdRbWhX8vnIjdzU8S00tBYf7Sg71EBeorlPHvhc= +github.com/go-openapi/runtime v0.25.0/go.mod h1:Ux6fikcHXyyob6LNWxtE96hWwjBPYF0DXgVFuMTneOs= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/spec v0.20.8 h1:ubHmXNY3FCIOinT8RNrrPfGc9t7I1qhPtdOGoG2AxRU= +github.com/go-openapi/spec v0.20.8/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= +github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= +github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/validate v0.22.1 h1:G+c2ub6q47kfX1sOBLwIQwzBVt8qmOAARyo/9Fqs9NU= +github.com/go-openapi/validate v0.22.1/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= +github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= +github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= +github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= +github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= +github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= +github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= +github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= +github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= +github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= +github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= +github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= +github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +<<<<<<< HEAD github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= @@ -107,16 +198,46 @@ github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +======= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/hcp-sdk-go v0.68.1-0.20231016143855-002a6534585b h1:2fZmFVGmuqos08i+KI9nRrZaMV5KCEnFpsSby01nuB8= +github.com/hashicorp/hcp-sdk-go v0.68.1-0.20231016143855-002a6534585b/go.mod h1:xP7wmWAmdMxs/7+ovH3jZn+MCDhHRj50Rn+m7JIY3Ck= +github.com/hashicorp/hcp-sdk-go v0.70.0 h1:w8PFXNtTlRTdTzNj1KSS/QBdsmLbAi0risGvZKoVNMw= +github.com/hashicorp/hcp-sdk-go v0.70.0/go.mod h1:xP7wmWAmdMxs/7+ovH3jZn+MCDhHRj50Rn+m7JIY3Ck= +github.com/hashicorp/hcp-sdk-go v0.70.1-0.20231027171745-aa8cd4ca3fa0 h1:3WhH3y7kfs4nEL7tO4qNKKkNMt+fzhj7oQaadPk3OqI= +github.com/hashicorp/hcp-sdk-go v0.70.1-0.20231027171745-aa8cd4ca3fa0/go.mod h1:xP7wmWAmdMxs/7+ovH3jZn+MCDhHRj50Rn+m7JIY3Ck= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +<<<<<<< HEAD github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +======= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +<<<<<<< HEAD github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -124,11 +245,17 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +======= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/cli v1.0.0 h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +<<<<<<< HEAD github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -175,9 +302,41 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +======= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= +github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +<<<<<<< HEAD github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -201,13 +360,70 @@ golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +======= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= +go.mongodb.org/mongo-driver v1.11.0 h1:FZKhBSTydeuffHj9CBjXlR8vQLee1cQyTWYPA6/tqiE= +go.mongodb.org/mongo-driver v1.11.0/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8= +go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= +go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= +go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs= +go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOlithYrdktys= +go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= +go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +<<<<<<< HEAD +======= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +<<<<<<< HEAD golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -227,19 +443,54 @@ google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +======= +golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +<<<<<<< HEAD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +======= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +>>>>>>> 2330ab4 (Initial Vault HCP Library commit) gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/mocks/cluster/ClusterClientService.go b/mocks/cluster/ClusterClientService.go new file mode 100644 index 0000000..b11335d --- /dev/null +++ b/mocks/cluster/ClusterClientService.go @@ -0,0 +1,1519 @@ +// Code generated by mockery v2.34.2. DO NOT EDIT. + +package clustermocks + +import ( + runtime "github.com/go-openapi/runtime" + mock "github.com/stretchr/testify/mock" + + vault_service "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/client/vault_service" +) + +// ClientService is an autogenerated mock type for the ClientService type +type ClientService struct { + mock.Mock +} + +// AddPlugin provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) AddPlugin(params *vault_service.AddPluginParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.AddPluginOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.AddPluginOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.AddPluginParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.AddPluginOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.AddPluginParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.AddPluginOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.AddPluginOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.AddPluginParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Create provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Create(params *vault_service.CreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.CreateOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.CreateOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.CreateParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.CreateOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.CreateParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.CreateOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.CreateOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.CreateParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateSnapshot provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) CreateSnapshot(params *vault_service.CreateSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.CreateSnapshotOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.CreateSnapshotOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.CreateSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.CreateSnapshotOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.CreateSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.CreateSnapshotOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.CreateSnapshotOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.CreateSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Delete provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Delete(params *vault_service.DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.DeleteOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.DeleteOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.DeleteParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.DeleteOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.DeleteParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.DeleteOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.DeleteOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.DeleteParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeletePathsFilter provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeletePathsFilter(params *vault_service.DeletePathsFilterParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.DeletePathsFilterOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.DeletePathsFilterOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.DeletePathsFilterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.DeletePathsFilterOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.DeletePathsFilterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.DeletePathsFilterOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.DeletePathsFilterOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.DeletePathsFilterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeletePlugin provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeletePlugin(params *vault_service.DeletePluginParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.DeletePluginOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.DeletePluginOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.DeletePluginParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.DeletePluginOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.DeletePluginParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.DeletePluginOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.DeletePluginOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.DeletePluginParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteSentinelPolicy provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeleteSentinelPolicy(params *vault_service.DeleteSentinelPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.DeleteSentinelPolicyOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.DeleteSentinelPolicyOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.DeleteSentinelPolicyParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.DeleteSentinelPolicyOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.DeleteSentinelPolicyParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.DeleteSentinelPolicyOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.DeleteSentinelPolicyOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.DeleteSentinelPolicyParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteSnapshot provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeleteSnapshot(params *vault_service.DeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.DeleteSnapshotOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.DeleteSnapshotOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.DeleteSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.DeleteSnapshotOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.DeleteSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.DeleteSnapshotOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.DeleteSnapshotOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.DeleteSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeregisterLinkedCluster provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeregisterLinkedCluster(params *vault_service.DeregisterLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.DeregisterLinkedClusterOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.DeregisterLinkedClusterOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.DeregisterLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.DeregisterLinkedClusterOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.DeregisterLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.DeregisterLinkedClusterOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.DeregisterLinkedClusterOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.DeregisterLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DisableCORS provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DisableCORS(params *vault_service.DisableCORSParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.DisableCORSOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.DisableCORSOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.DisableCORSParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.DisableCORSOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.DisableCORSParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.DisableCORSOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.DisableCORSOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.DisableCORSParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// FetchAuditLog provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) FetchAuditLog(params *vault_service.FetchAuditLogParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.FetchAuditLogOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.FetchAuditLogOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.FetchAuditLogParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.FetchAuditLogOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.FetchAuditLogParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.FetchAuditLogOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.FetchAuditLogOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.FetchAuditLogParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Get provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Get(params *vault_service.GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetAdminToken provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetAdminToken(params *vault_service.GetAdminTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetAdminTokenOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetAdminTokenOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetAdminTokenParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetAdminTokenOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetAdminTokenParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetAdminTokenOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetAdminTokenOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetAdminTokenParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetAuditLogStatus provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetAuditLogStatus(params *vault_service.GetAuditLogStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetAuditLogStatusOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetAuditLogStatusOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetAuditLogStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetAuditLogStatusOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetAuditLogStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetAuditLogStatusOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetAuditLogStatusOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetAuditLogStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetAvailableProviders provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetAvailableProviders(params *vault_service.GetAvailableProvidersParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetAvailableProvidersOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetAvailableProvidersOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetAvailableProvidersParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetAvailableProvidersOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetAvailableProvidersParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetAvailableProvidersOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetAvailableProvidersOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetAvailableProvidersParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetAvailableTemplates provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetAvailableTemplates(params *vault_service.GetAvailableTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetAvailableTemplatesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetAvailableTemplatesOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetAvailableTemplatesParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetAvailableTemplatesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetAvailableTemplatesParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetAvailableTemplatesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetAvailableTemplatesOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetAvailableTemplatesParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetCORSConfig provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetCORSConfig(params *vault_service.GetCORSConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetCORSConfigOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetCORSConfigOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetCORSConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetCORSConfigOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetCORSConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetCORSConfigOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetCORSConfigOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetCORSConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetClientCounts provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetClientCounts(params *vault_service.GetClientCountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetClientCountsOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetClientCountsOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetClientCountsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetClientCountsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetClientCountsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetClientCountsOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetClientCountsOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetClientCountsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetCurrentMilestone provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetCurrentMilestone(params *vault_service.GetCurrentMilestoneParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetCurrentMilestoneOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetCurrentMilestoneOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetCurrentMilestoneParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetCurrentMilestoneOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetCurrentMilestoneParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetCurrentMilestoneOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetCurrentMilestoneOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetCurrentMilestoneParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetLinkedCluster provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetLinkedCluster(params *vault_service.GetLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetLinkedClusterOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetLinkedClusterOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetLinkedClusterOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetLinkedClusterOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetLinkedClusterOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetReplicationStatus provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetReplicationStatus(params *vault_service.GetReplicationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetReplicationStatusOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetReplicationStatusOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetReplicationStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetReplicationStatusOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetReplicationStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetReplicationStatusOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetReplicationStatusOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetReplicationStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetSnapshot provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetSnapshot(params *vault_service.GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetSnapshotOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetSnapshotOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetSnapshotOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetSnapshotOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetSnapshotOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetUtilization provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetUtilization(params *vault_service.GetUtilizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.GetUtilizationOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.GetUtilizationOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.GetUtilizationParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.GetUtilizationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.GetUtilizationParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.GetUtilizationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.GetUtilizationOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.GetUtilizationParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// IsVaultPluginRegistered provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) IsVaultPluginRegistered(params *vault_service.IsVaultPluginRegisteredParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.IsVaultPluginRegisteredOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.IsVaultPluginRegisteredOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.IsVaultPluginRegisteredParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.IsVaultPluginRegisteredOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.IsVaultPluginRegisteredParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.IsVaultPluginRegisteredOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.IsVaultPluginRegisteredOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.IsVaultPluginRegisteredParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// List provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) List(params *vault_service.ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.ListOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.ListOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.ListParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.ListOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.ListParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.ListOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.ListOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.ListParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListAllClusters provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ListAllClusters(params *vault_service.ListAllClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.ListAllClustersOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.ListAllClustersOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.ListAllClustersParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.ListAllClustersOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.ListAllClustersParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.ListAllClustersOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.ListAllClustersOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.ListAllClustersParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListPerformanceReplicationSecondaries provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ListPerformanceReplicationSecondaries(params *vault_service.ListPerformanceReplicationSecondariesParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.ListPerformanceReplicationSecondariesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.ListPerformanceReplicationSecondariesOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.ListPerformanceReplicationSecondariesParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.ListPerformanceReplicationSecondariesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.ListPerformanceReplicationSecondariesParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.ListPerformanceReplicationSecondariesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.ListPerformanceReplicationSecondariesOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.ListPerformanceReplicationSecondariesParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListSnapshots provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ListSnapshots(params *vault_service.ListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.ListSnapshotsOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.ListSnapshotsOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.ListSnapshotsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.ListSnapshotsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.ListSnapshotsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.ListSnapshotsOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.ListSnapshotsOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.ListSnapshotsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Lock provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Lock(params *vault_service.LockParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.LockOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.LockOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.LockParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.LockOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.LockParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.LockOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.LockOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.LockParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// PluginRegistrationStatus provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) PluginRegistrationStatus(params *vault_service.PluginRegistrationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.PluginRegistrationStatusOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.PluginRegistrationStatusOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.PluginRegistrationStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.PluginRegistrationStatusOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.PluginRegistrationStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.PluginRegistrationStatusOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.PluginRegistrationStatusOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.PluginRegistrationStatusParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RecreateFromSnapshot provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) RecreateFromSnapshot(params *vault_service.RecreateFromSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.RecreateFromSnapshotOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.RecreateFromSnapshotOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.RecreateFromSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.RecreateFromSnapshotOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.RecreateFromSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.RecreateFromSnapshotOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.RecreateFromSnapshotOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.RecreateFromSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RegisterLinkedCluster provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) RegisterLinkedCluster(params *vault_service.RegisterLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.RegisterLinkedClusterOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.RegisterLinkedClusterOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.RegisterLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.RegisterLinkedClusterOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.RegisterLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.RegisterLinkedClusterOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.RegisterLinkedClusterOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.RegisterLinkedClusterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RestoreSnapshot provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) RestoreSnapshot(params *vault_service.RestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.RestoreSnapshotOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.RestoreSnapshotOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.RestoreSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.RestoreSnapshotOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.RestoreSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.RestoreSnapshotOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.RestoreSnapshotOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.RestoreSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RevokeAdminTokens provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) RevokeAdminTokens(params *vault_service.RevokeAdminTokensParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.RevokeAdminTokensOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.RevokeAdminTokensOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.RevokeAdminTokensParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.RevokeAdminTokensOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.RevokeAdminTokensParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.RevokeAdminTokensOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.RevokeAdminTokensOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.RevokeAdminTokensParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Seal provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Seal(params *vault_service.SealParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.SealOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.SealOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.SealParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.SealOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.SealParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.SealOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.SealOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.SealParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SetTransport provides a mock function with given fields: transport +func (_m *ClientService) SetTransport(transport runtime.ClientTransport) { + _m.Called(transport) +} + +// Unlock provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Unlock(params *vault_service.UnlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UnlockOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UnlockOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UnlockParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UnlockOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UnlockParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UnlockOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UnlockOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UnlockParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Unseal provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Unseal(params *vault_service.UnsealParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UnsealOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UnsealOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UnsealParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UnsealOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UnsealParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UnsealOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UnsealOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UnsealParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Update provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Update(params *vault_service.UpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpdateOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpdateOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpdateParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpdateOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpdateParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpdateOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpdateOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpdateParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateCORSConfig provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpdateCORSConfig(params *vault_service.UpdateCORSConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpdateCORSConfigOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpdateCORSConfigOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpdateCORSConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpdateCORSConfigOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpdateCORSConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpdateCORSConfigOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpdateCORSConfigOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpdateCORSConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateMajorVersionUpgradeConfig provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpdateMajorVersionUpgradeConfig(params *vault_service.UpdateMajorVersionUpgradeConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpdateMajorVersionUpgradeConfigOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpdateMajorVersionUpgradeConfigOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpdateMajorVersionUpgradeConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpdateMajorVersionUpgradeConfigOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpdateMajorVersionUpgradeConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpdateMajorVersionUpgradeConfigOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpdateMajorVersionUpgradeConfigOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpdateMajorVersionUpgradeConfigParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdatePathsFilter provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpdatePathsFilter(params *vault_service.UpdatePathsFilterParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpdatePathsFilterOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpdatePathsFilterOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpdatePathsFilterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpdatePathsFilterOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpdatePathsFilterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpdatePathsFilterOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpdatePathsFilterOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpdatePathsFilterParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdatePublicIps provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpdatePublicIps(params *vault_service.UpdatePublicIpsParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpdatePublicIpsOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpdatePublicIpsOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpdatePublicIpsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpdatePublicIpsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpdatePublicIpsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpdatePublicIpsOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpdatePublicIpsOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpdatePublicIpsParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateSnapshot provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpdateSnapshot(params *vault_service.UpdateSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpdateSnapshotOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpdateSnapshotOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpdateSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpdateSnapshotOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpdateSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpdateSnapshotOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpdateSnapshotOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpdateSnapshotParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateVersion provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpdateVersion(params *vault_service.UpdateVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpdateVersionOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpdateVersionOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpdateVersionParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpdateVersionOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpdateVersionParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpdateVersionOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpdateVersionOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpdateVersionParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpgradeMajorVersion provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpgradeMajorVersion(params *vault_service.UpgradeMajorVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...vault_service.ClientOption) (*vault_service.UpgradeMajorVersionOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *vault_service.UpgradeMajorVersionOK + var r1 error + if rf, ok := ret.Get(0).(func(*vault_service.UpgradeMajorVersionParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) (*vault_service.UpgradeMajorVersionOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*vault_service.UpgradeMajorVersionParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) *vault_service.UpgradeMajorVersionOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vault_service.UpgradeMajorVersionOK) + } + } + + if rf, ok := ret.Get(1).(func(*vault_service.UpgradeMajorVersionParams, runtime.ClientAuthInfoWriter, ...vault_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// NewClientService creates a new instance of ClientService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewClientService(t interface { + mock.TestingT + Cleanup(func()) +}) *ClientService { + mock := &ClientService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/organization/OrganizationClientService.go b/mocks/organization/OrganizationClientService.go new file mode 100644 index 0000000..7a871ed --- /dev/null +++ b/mocks/organization/OrganizationClientService.go @@ -0,0 +1,330 @@ +// Code generated by mockery v2.34.2. DO NOT EDIT. + +package orgmocks + +import ( + runtime "github.com/go-openapi/runtime" + organization_service "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/organization_service" + mock "github.com/stretchr/testify/mock" +) + +// ClientService is an autogenerated mock type for the ClientService type +type ClientService struct { + mock.Mock +} + +// OrganizationServiceCreate provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceCreate(params *organization_service.OrganizationServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceCreateOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceCreateOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceCreateParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceCreateOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceCreateParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceCreateOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceCreateOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceCreateParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceGet provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceGet(params *organization_service.OrganizationServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceGetOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceGetOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceGetParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceGetOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceGetParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceGetOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceGetOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceGetParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceGetIamPolicy provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceGetIamPolicy(params *organization_service.OrganizationServiceGetIamPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceGetIamPolicyOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceGetIamPolicyOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceGetIamPolicyParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceGetIamPolicyOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceGetIamPolicyParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceGetIamPolicyOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceGetIamPolicyOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceGetIamPolicyParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceGetRole provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceGetRole(params *organization_service.OrganizationServiceGetRoleParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceGetRoleOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceGetRoleOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceGetRoleParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceGetRoleOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceGetRoleParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceGetRoleOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceGetRoleOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceGetRoleParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceList provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceList(params *organization_service.OrganizationServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceListOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceListOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceListParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceListOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceListParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceListOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceListOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceListParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceListRoles provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceListRoles(params *organization_service.OrganizationServiceListRolesParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceListRolesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceListRolesOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceListRolesParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceListRolesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceListRolesParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceListRolesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceListRolesOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceListRolesParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceSetIamPolicy provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceSetIamPolicy(params *organization_service.OrganizationServiceSetIamPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceSetIamPolicyOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceSetIamPolicyOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceSetIamPolicyParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceSetIamPolicyOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceSetIamPolicyParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceSetIamPolicyOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceSetIamPolicyOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceSetIamPolicyParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceSetName provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceSetName(params *organization_service.OrganizationServiceSetNameParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceSetNameOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceSetNameOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceSetNameParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceSetNameOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceSetNameParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceSetNameOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceSetNameOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceSetNameParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrganizationServiceTestIamPermissions provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) OrganizationServiceTestIamPermissions(params *organization_service.OrganizationServiceTestIamPermissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...organization_service.ClientOption) (*organization_service.OrganizationServiceTestIamPermissionsOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *organization_service.OrganizationServiceTestIamPermissionsOK + var r1 error + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceTestIamPermissionsParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) (*organization_service.OrganizationServiceTestIamPermissionsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*organization_service.OrganizationServiceTestIamPermissionsParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) *organization_service.OrganizationServiceTestIamPermissionsOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*organization_service.OrganizationServiceTestIamPermissionsOK) + } + } + + if rf, ok := ret.Get(1).(func(*organization_service.OrganizationServiceTestIamPermissionsParams, runtime.ClientAuthInfoWriter, ...organization_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SetTransport provides a mock function with given fields: transport +func (_m *ClientService) SetTransport(transport runtime.ClientTransport) { + _m.Called(transport) +} + +// NewClientService creates a new instance of ClientService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewClientService(t interface { + mock.TestingT + Cleanup(func()) +}) *ClientService { + mock := &ClientService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/project/ProjectClientService.go b/mocks/project/ProjectClientService.go new file mode 100644 index 0000000..b8fb5f4 --- /dev/null +++ b/mocks/project/ProjectClientService.go @@ -0,0 +1,363 @@ +// Code generated by mockery v2.34.2. DO NOT EDIT. + +package projmocks + +import ( + runtime "github.com/go-openapi/runtime" + project_service "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/project_service" + mock "github.com/stretchr/testify/mock" +) + +// ClientService is an autogenerated mock type for the ClientService type +type ClientService struct { + mock.Mock +} + +// ProjectServiceCreate provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceCreate(params *project_service.ProjectServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceCreateOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceCreateOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceCreateParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceCreateOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceCreateParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceCreateOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceCreateOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceCreateParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceDelete provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceDelete(params *project_service.ProjectServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceDeleteOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceDeleteOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceDeleteParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceDeleteOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceDeleteParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceDeleteOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceDeleteOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceDeleteParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceGet provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceGet(params *project_service.ProjectServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceGetOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceGetOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceGetParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceGetOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceGetParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceGetOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceGetOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceGetParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceGetIamPolicy provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceGetIamPolicy(params *project_service.ProjectServiceGetIamPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceGetIamPolicyOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceGetIamPolicyOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceGetIamPolicyParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceGetIamPolicyOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceGetIamPolicyParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceGetIamPolicyOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceGetIamPolicyOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceGetIamPolicyParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceGetProjectsCount provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceGetProjectsCount(params *project_service.ProjectServiceGetProjectsCountParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceGetProjectsCountOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceGetProjectsCountOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceGetProjectsCountParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceGetProjectsCountOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceGetProjectsCountParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceGetProjectsCountOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceGetProjectsCountOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceGetProjectsCountParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceList provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceList(params *project_service.ProjectServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceListOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceListOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceListParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceListOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceListParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceListOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceListOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceListParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceSetDescription provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceSetDescription(params *project_service.ProjectServiceSetDescriptionParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceSetDescriptionOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceSetDescriptionOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceSetDescriptionParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceSetDescriptionOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceSetDescriptionParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceSetDescriptionOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceSetDescriptionOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceSetDescriptionParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceSetIamPolicy provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceSetIamPolicy(params *project_service.ProjectServiceSetIamPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceSetIamPolicyOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceSetIamPolicyOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceSetIamPolicyParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceSetIamPolicyOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceSetIamPolicyParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceSetIamPolicyOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceSetIamPolicyOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceSetIamPolicyParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceSetName provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceSetName(params *project_service.ProjectServiceSetNameParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceSetNameOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceSetNameOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceSetNameParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceSetNameOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceSetNameParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceSetNameOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceSetNameOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceSetNameParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProjectServiceTestIamPermissions provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ProjectServiceTestIamPermissions(params *project_service.ProjectServiceTestIamPermissionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...project_service.ClientOption) (*project_service.ProjectServiceTestIamPermissionsOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *project_service.ProjectServiceTestIamPermissionsOK + var r1 error + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceTestIamPermissionsParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) (*project_service.ProjectServiceTestIamPermissionsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*project_service.ProjectServiceTestIamPermissionsParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) *project_service.ProjectServiceTestIamPermissionsOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*project_service.ProjectServiceTestIamPermissionsOK) + } + } + + if rf, ok := ret.Get(1).(func(*project_service.ProjectServiceTestIamPermissionsParams, runtime.ClientAuthInfoWriter, ...project_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SetTransport provides a mock function with given fields: transport +func (_m *ClientService) SetTransport(transport runtime.ClientTransport) { + _m.Called(transport) +} + +// NewClientService creates a new instance of ClientService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewClientService(t interface { + mock.TestingT + Cleanup(func()) +}) *ClientService { + mock := &ClientService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/testhelpers.go b/testhelpers.go new file mode 100644 index 0000000..14d3488 --- /dev/null +++ b/testhelpers.go @@ -0,0 +1,50 @@ +package vaulthcplib + +import ( + "github.com/hashicorp/hcp-sdk-go/auth" + "os" + "path/filepath" + "testing" + "time" +) + +func CacheSetup(t *testing.T, validCache bool) { + err := os.Setenv(envVarCacheTestMode, "true") + if err != nil { + t.Error(err) + return + } + + userHome, err := os.UserHomeDir() + if err != nil { + t.Error(err) + return + } + credentialDir := filepath.Join(userHome, testDirectory) + err = os.RemoveAll(credentialDir) + if err != nil { + t.Error(err) + return + } + + if validCache { + now := time.Now() + cache := auth.Cache{ + AccessToken: "Test.Access.Token", + RefreshToken: "TestRefreshToken", + AccessTokenExpiry: now.Add(time.Hour * 2), + SessionExpiry: time.Now().Add(time.Hour * 24), + } + err = auth.Write(cache) + if err != nil { + t.Error(err) + } + + err = writeConfig("https://hcp-proxy.addr:8200", "", "") + if err != nil { + t.Error(err) + } + } + + return +}