From 038205f3a62ed0c80ce2421f8717fcbc4df1b759 Mon Sep 17 00:00:00 2001 From: Anton Averchenkov <84287187+averche@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:29:21 -0500 Subject: [PATCH] [HCP Vault Secrets] Add support for Postgres integration CRUDL (#189) * Postgres Integration * changelog --- .changelog/189.txt | 3 + go.mod | 2 +- go.sum | 4 +- .../vaultsecrets/integrations/create.go | 37 +- .../vaultsecrets/integrations/delete.go | 25 +- .../vaultsecrets/integrations/displayer.go | 59 +- .../vaultsecrets/integrations/integrations.go | 1 + .../vaultsecrets/integrations/list.go | 33 +- .../vaultsecrets/integrations/read.go | 13 + .../vaultsecrets/integrations/update.go | 26 +- .../resource_service/mock_ClientService.go | 222 +++++++ .../secret_service/mock_ClientService.go | 592 ++++++++++++++++++ 12 files changed, 987 insertions(+), 30 deletions(-) create mode 100644 .changelog/189.txt diff --git a/.changelog/189.txt b/.changelog/189.txt new file mode 100644 index 00000000..a7fe474e --- /dev/null +++ b/.changelog/189.txt @@ -0,0 +1,3 @@ +```release-note:feature +vault-secrets: Adds support for creating / updating / reading / deleting Postgres integrations. +``` diff --git a/go.mod b/go.mod index 41892654..0b2e4728 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/hcl/v2 v2.22.0 - github.com/hashicorp/hcp-sdk-go v0.117.0 + github.com/hashicorp/hcp-sdk-go v0.121.0 github.com/lithammer/dedent v1.1.0 github.com/manifoldco/promptui v0.9.0 github.com/mitchellh/cli v1.1.5 diff --git a/go.sum b/go.sum index 1b4ab0ac..98052c8d 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,8 @@ github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mO github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul12M= github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= -github.com/hashicorp/hcp-sdk-go v0.117.0 h1:7lJpkinpWdsXtejC+X7MdaE/3zhFMweB9Ym3uJ7qFJw= -github.com/hashicorp/hcp-sdk-go v0.117.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk= +github.com/hashicorp/hcp-sdk-go v0.121.0 h1:fDCB0sexSNontS7LLuhF1RJd7eYx1hmFVBFmY4kXU78= +github.com/hashicorp/hcp-sdk-go v0.121.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= diff --git a/internal/commands/vaultsecrets/integrations/create.go b/internal/commands/vaultsecrets/integrations/create.go index 2757947b..ec12ac5e 100644 --- a/internal/commands/vaultsecrets/integrations/create.go +++ b/internal/commands/vaultsecrets/integrations/create.go @@ -111,10 +111,11 @@ type IntegrationConfig struct { } var ( - TwilioKeys = []string{"account_sid", "api_key_secret", "api_key_sid"} - MongoKeys = []string{"private_key", "public_key"} - AWSKeys = []string{"access_keys", "federated_workload_identity"} - GCPKeys = []string{"service_account_key", "federated_workload_identity"} + TwilioKeys = []string{"account_sid", "api_key_secret", "api_key_sid"} + MongoKeys = []string{"private_key", "public_key"} + AWSKeys = []string{"access_keys", "federated_workload_identity"} + GCPKeys = []string{"service_account_key", "federated_workload_identity"} + PostgresKeys = []string{"connection_string"} ) var providerToRequiredFields = map[string][]string{ @@ -122,6 +123,7 @@ var providerToRequiredFields = map[string][]string{ string(MongoDBAtlas): MongoKeys, string(AWS): AWSKeys, string(GCP): GCPKeys, + string(Postgres): PostgresKeys, } var awsAuthMethodsToReqKeys = map[string][]string{ @@ -201,7 +203,6 @@ func createRun(opts *CreateOpts) error { req.Body.Name = opts.IntegrationName _, err = opts.PreviewClient.CreateMongoDBAtlasIntegration(req, nil) - if err != nil { return fmt.Errorf("failed to create MongoDB Atlas integration: %w", err) } @@ -225,7 +226,6 @@ func createRun(opts *CreateOpts) error { req.Body.Name = opts.IntegrationName _, err = opts.PreviewClient.CreateAwsIntegration(req, nil) - if err != nil { return fmt.Errorf("failed to create AWS integration: %w", err) } @@ -249,11 +249,34 @@ func createRun(opts *CreateOpts) error { req.Body.Name = opts.IntegrationName _, err = opts.PreviewClient.CreateGcpIntegration(req, nil) - if err != nil { return fmt.Errorf("failed to create GCP integration: %w", err) } + case Postgres: + req := preview_secret_service.NewCreatePostgresIntegrationParamsWithContext(opts.Ctx) + req.OrganizationID = opts.Profile.OrganizationID + req.ProjectID = opts.Profile.ProjectID + + detailBytes, err := json.Marshal(internalConfig.Details) + if err != nil { + return fmt.Errorf("error marshaling details config: %w", err) + } + + var body preview_models.SecretServiceCreatePostgresIntegrationBody + err = body.UnmarshalBinary(detailBytes) + if err != nil { + return fmt.Errorf("error marshaling details config: %w", err) + } + + req.Body = &body + req.Body.Name = opts.IntegrationName + + _, err = opts.PreviewClient.CreatePostgresIntegration(req, nil) + if err != nil { + return fmt.Errorf("failed to create MongoDB Atlas integration: %w", err) + } + default: return fmt.Errorf("unsupported integration provider type") } diff --git a/internal/commands/vaultsecrets/integrations/delete.go b/internal/commands/vaultsecrets/integrations/delete.go index 9190bc06..3592d08a 100644 --- a/internal/commands/vaultsecrets/integrations/delete.go +++ b/internal/commands/vaultsecrets/integrations/delete.go @@ -99,9 +99,6 @@ func deleteRun(opts *DeleteOpts) error { return fmt.Errorf("failed to delete integration: %w", err) } - fmt.Fprintf(opts.IO.Err(), "%s Successfully deleted integration with name %q\n", opts.IO.ColorScheme().SuccessIcon(), opts.IntegrationName) - return nil - case MongoDBAtlas: _, err := opts.PreviewClient.DeleteMongoDBAtlasIntegration(&preview_secret_service.DeleteMongoDBAtlasIntegrationParams{ Context: opts.Ctx, @@ -113,9 +110,6 @@ func deleteRun(opts *DeleteOpts) error { return fmt.Errorf("failed to delete integration: %w", err) } - fmt.Fprintf(opts.IO.Err(), "%s Successfully deleted integration with name %q\n", opts.IO.ColorScheme().SuccessIcon(), opts.IntegrationName) - return nil - case AWS: _, err := opts.PreviewClient.DeleteAwsIntegration(&preview_secret_service.DeleteAwsIntegrationParams{ Context: opts.Ctx, @@ -127,9 +121,6 @@ func deleteRun(opts *DeleteOpts) error { return fmt.Errorf("failed to delete integration: %w", err) } - fmt.Fprintf(opts.IO.Err(), "%s Successfully deleted integration with name %q\n", opts.IO.ColorScheme().SuccessIcon(), opts.IntegrationName) - return nil - case GCP: _, err := opts.PreviewClient.DeleteGcpIntegration(&preview_secret_service.DeleteGcpIntegrationParams{ Context: opts.Ctx, @@ -141,10 +132,22 @@ func deleteRun(opts *DeleteOpts) error { return fmt.Errorf("failed to delete integration: %w", err) } - fmt.Fprintf(opts.IO.Err(), "%s Successfully deleted integration with name %q\n", opts.IO.ColorScheme().SuccessIcon(), opts.IntegrationName) - return nil + case Postgres: + _, err := opts.PreviewClient.DeletePostgresIntegration(&preview_secret_service.DeletePostgresIntegrationParams{ + Context: opts.Ctx, + ProjectID: opts.Profile.ProjectID, + OrganizationID: opts.Profile.OrganizationID, + Name: opts.IntegrationName, + }, nil) + if err != nil { + return fmt.Errorf("failed to delete integration: %w", err) + } default: return fmt.Errorf("not a valid integration type") } + + fmt.Fprintf(opts.IO.Err(), "%s Successfully deleted integration with name %q\n", opts.IO.ColorScheme().SuccessIcon(), opts.IntegrationName) + + return nil } diff --git a/internal/commands/vaultsecrets/integrations/displayer.go b/internal/commands/vaultsecrets/integrations/displayer.go index 78287ddf..65932bc5 100644 --- a/internal/commands/vaultsecrets/integrations/displayer.go +++ b/internal/commands/vaultsecrets/integrations/displayer.go @@ -85,7 +85,6 @@ func (m *mongodbDisplayer) DefaultFormat() format.Format { } func (m *mongodbDisplayer) Payload() any { - if m.previewMongoDBIntegrations != nil { return m.previewMongoDBIntegrationsPayload() } @@ -143,7 +142,6 @@ func (a *awsDisplayer) DefaultFormat() format.Format { } func (a *awsDisplayer) Payload() any { - if a.previewAwsIntegrations != nil { return a.previewAwsIntegrationsPayload() } @@ -183,7 +181,6 @@ func (a *awsDisplayer) FieldTemplates() []format.Field { ValueFormat: "{{ .FederatedWorkloadIdentity.RoleArn }}", }, }...) - } else { return append(fields, []format.Field{ { @@ -214,7 +211,6 @@ func (g *gcpDisplayer) DefaultFormat() format.Format { } func (g *gcpDisplayer) Payload() any { - if g.previewGcpIntegrations != nil { return g.previewGcpIntegrationsPayload() } @@ -319,3 +315,58 @@ func (g *genericDisplayer) FieldTemplates() []format.Field { }, } } + +type postgresDisplayer struct { + previewPostgresIntegrations []*preview_models.Secrets20231128PostgresIntegration + + single bool +} + +func newPostgresDisplayer(single bool, integrations ...*preview_models.Secrets20231128PostgresIntegration) *postgresDisplayer { + return &postgresDisplayer{ + previewPostgresIntegrations: integrations, + single: single, + } +} + +func (m *postgresDisplayer) DefaultFormat() format.Format { + return format.Table +} + +func (m *postgresDisplayer) Payload() any { + if m.previewPostgresIntegrations != nil { + return m.previewPostgresIntegrationsPayload() + } + + return nil +} + +func (m *postgresDisplayer) previewPostgresIntegrationsPayload() any { + if m.single { + if len(m.previewPostgresIntegrations) != 1 { + return nil + } + return m.previewPostgresIntegrations[0] + } + return m.previewPostgresIntegrations +} + +func (m *postgresDisplayer) FieldTemplates() []format.Field { + fields := []format.Field{ + { + Name: "Integration Name", + ValueFormat: "{{ .Name }}", + }, + } + + if m.single { + return append(fields, []format.Field{ + { + Name: "Connection String", + ValueFormat: "{{ .StaticCredentialDetails.ConnectionString }}", + }, + }...) + } else { + return fields + } +} diff --git a/internal/commands/vaultsecrets/integrations/integrations.go b/internal/commands/vaultsecrets/integrations/integrations.go index b5814e02..d9a3389d 100644 --- a/internal/commands/vaultsecrets/integrations/integrations.go +++ b/internal/commands/vaultsecrets/integrations/integrations.go @@ -15,6 +15,7 @@ const ( MongoDBAtlas IntegrationType = "mongodb-atlas" AWS IntegrationType = "aws" GCP IntegrationType = "gcp" + Postgres IntegrationType = "postgres" ) func NewCmdIntegrations(ctx *cmd.Context) *cmd.Command { diff --git a/internal/commands/vaultsecrets/integrations/list.go b/internal/commands/vaultsecrets/integrations/list.go index 9faaad6b..dd81c813 100644 --- a/internal/commands/vaultsecrets/integrations/list.go +++ b/internal/commands/vaultsecrets/integrations/list.go @@ -120,7 +120,7 @@ func listRun(opts *ListOpts) error { for { resp, err := opts.PreviewClient.ListTwilioIntegrations(params, nil) if err != nil { - return fmt.Errorf("failed to list twilio integrations: %w", err) + return fmt.Errorf("failed to list Twilio integrations: %w", err) } integrations = append(integrations, resp.Payload.Integrations...) @@ -146,7 +146,7 @@ func listRun(opts *ListOpts) error { for { resp, err := opts.PreviewClient.ListMongoDBAtlasIntegrations(params, nil) if err != nil { - return fmt.Errorf("failed to list mongo integrations: %w", err) + return fmt.Errorf("failed to list MongoDB Atlas integrations: %w", err) } integrations = append(integrations, resp.Payload.Integrations...) @@ -157,6 +157,7 @@ func listRun(opts *ListOpts) error { next := resp.Payload.Pagination.NextPageToken params.PaginationNextPageToken = &next } + return opts.Output.Display(newMongoDBDisplayer(false, integrations...)) case AWS: @@ -182,6 +183,7 @@ func listRun(opts *ListOpts) error { next := resp.Payload.Pagination.NextPageToken params.PaginationNextPageToken = &next } + return opts.Output.Display(newAwsDisplayer(false, false, integrations...)) case GCP: @@ -207,8 +209,35 @@ func listRun(opts *ListOpts) error { next := resp.Payload.Pagination.NextPageToken params.PaginationNextPageToken = &next } + return opts.Output.Display(newGcpDisplayer(false, false, integrations...)) + case Postgres: + var integrations []*preview_models.Secrets20231128PostgresIntegration + + params := &preview_secret_service.ListPostgresIntegrationsParams{ + Context: opts.Ctx, + ProjectID: opts.Profile.ProjectID, + OrganizationID: opts.Profile.OrganizationID, + } + + for { + resp, err := opts.PreviewClient.ListPostgresIntegrations(params, nil) + if err != nil { + return fmt.Errorf("failed to list Postgres integrations: %w", err) + } + + integrations = append(integrations, resp.Payload.Integrations...) + if resp.Payload.Pagination == nil || resp.Payload.Pagination.NextPageToken == "" { + break + } + + next := resp.Payload.Pagination.NextPageToken + params.PaginationNextPageToken = &next + } + + return opts.Output.Display(newPostgresDisplayer(false, integrations...)) + default: return fmt.Errorf("not a valid integration type") } diff --git a/internal/commands/vaultsecrets/integrations/read.go b/internal/commands/vaultsecrets/integrations/read.go index 7f94ed20..3cb532ef 100644 --- a/internal/commands/vaultsecrets/integrations/read.go +++ b/internal/commands/vaultsecrets/integrations/read.go @@ -151,6 +151,19 @@ func readRun(opts *ReadOpts) error { return opts.Output.Display(newGcpDisplayer(true, resp.Payload.Integration.FederatedWorkloadIdentity != nil, resp.Payload.Integration)) + case Postgres: + resp, err := opts.PreviewClient.GetPostgresIntegration(&preview_secret_service.GetPostgresIntegrationParams{ + Context: opts.Ctx, + ProjectID: opts.Profile.ProjectID, + OrganizationID: opts.Profile.OrganizationID, + Name: opts.IntegrationName, + }, nil) + if err != nil { + return fmt.Errorf("failed to read integration: %w", err) + } + + return opts.Output.Display(newPostgresDisplayer(true, resp.Payload.Integration)) + default: return fmt.Errorf("not a valid integration type") } diff --git a/internal/commands/vaultsecrets/integrations/update.go b/internal/commands/vaultsecrets/integrations/update.go index ac799413..1764c8fd 100644 --- a/internal/commands/vaultsecrets/integrations/update.go +++ b/internal/commands/vaultsecrets/integrations/update.go @@ -152,7 +152,6 @@ func updateRun(opts *UpdateOpts) error { req.Body = &mongoDBBody _, err = opts.PreviewClient.UpdateMongoDBAtlasIntegration(req, nil) - if err != nil { return fmt.Errorf("failed to update MongoDB Atlas integration: %w", err) } @@ -176,7 +175,6 @@ func updateRun(opts *UpdateOpts) error { req.Body = &awsBody _, err = opts.PreviewClient.UpdateAwsIntegration(req, nil) - if err != nil { return fmt.Errorf("failed to update AWS integration: %w", err) } @@ -200,10 +198,32 @@ func updateRun(opts *UpdateOpts) error { req.Body = &gcpBody _, err = opts.PreviewClient.UpdateGcpIntegration(req, nil) - if err != nil { return fmt.Errorf("failed to update GCP integration: %w", err) } + + case Postgres: + req := preview_secret_service.NewUpdatePostgresIntegrationParamsWithContext(opts.Ctx) + req.OrganizationID = opts.Profile.OrganizationID + req.ProjectID = opts.Profile.ProjectID + req.Name = opts.IntegrationName + + var body preview_models.SecretServiceUpdatePostgresIntegrationBody + detailBytes, err := json.Marshal(internalConfig.Details) + if err != nil { + return fmt.Errorf("error marshaling details config: %w", err) + } + + err = body.UnmarshalBinary(detailBytes) + if err != nil { + return fmt.Errorf("error marshaling details config: %w", err) + } + req.Body = &body + + _, err = opts.PreviewClient.UpdatePostgresIntegration(req, nil) + if err != nil { + return fmt.Errorf("failed to update MongoDB Atlas integration: %w", err) + } } fmt.Fprintln(opts.IO.Err()) diff --git a/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/resource_service/mock_ClientService.go b/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/resource_service/mock_ClientService.go index 75c0727e..42a5de50 100644 --- a/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/resource_service/mock_ClientService.go +++ b/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/stable/2019-12-10/client/resource_service/mock_ClientService.go @@ -95,6 +95,80 @@ func (_c *MockClientService_ResourceServiceGetIamPolicy_Call) RunAndReturn(run f return _c } +// ResourceServiceGetResource provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) ResourceServiceGetResource(params *resource_service.ResourceServiceGetResourceParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption) (*resource_service.ResourceServiceGetResourceOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for ResourceServiceGetResource") + } + + var r0 *resource_service.ResourceServiceGetResourceOK + var r1 error + if rf, ok := ret.Get(0).(func(*resource_service.ResourceServiceGetResourceParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) (*resource_service.ResourceServiceGetResourceOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*resource_service.ResourceServiceGetResourceParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) *resource_service.ResourceServiceGetResourceOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*resource_service.ResourceServiceGetResourceOK) + } + } + + if rf, ok := ret.Get(1).(func(*resource_service.ResourceServiceGetResourceParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_ResourceServiceGetResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceServiceGetResource' +type MockClientService_ResourceServiceGetResource_Call struct { + *mock.Call +} + +// ResourceServiceGetResource is a helper method to define mock.On call +// - params *resource_service.ResourceServiceGetResourceParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...resource_service.ClientOption +func (_e *MockClientService_Expecter) ResourceServiceGetResource(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_ResourceServiceGetResource_Call { + return &MockClientService_ResourceServiceGetResource_Call{Call: _e.mock.On("ResourceServiceGetResource", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_ResourceServiceGetResource_Call) Run(run func(params *resource_service.ResourceServiceGetResourceParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption)) *MockClientService_ResourceServiceGetResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]resource_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(resource_service.ClientOption) + } + } + run(args[0].(*resource_service.ResourceServiceGetResourceParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_ResourceServiceGetResource_Call) Return(_a0 *resource_service.ResourceServiceGetResourceOK, _a1 error) *MockClientService_ResourceServiceGetResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_ResourceServiceGetResource_Call) RunAndReturn(run func(*resource_service.ResourceServiceGetResourceParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) (*resource_service.ResourceServiceGetResourceOK, error)) *MockClientService_ResourceServiceGetResource_Call { + _c.Call.Return(run) + return _c +} + // ResourceServiceList provides a mock function with given fields: params, authInfo, opts func (_m *MockClientService) ResourceServiceList(params *resource_service.ResourceServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption) (*resource_service.ResourceServiceListOK, error) { _va := make([]interface{}, len(opts)) @@ -169,6 +243,154 @@ func (_c *MockClientService_ResourceServiceList_Call) RunAndReturn(run func(*res return _c } +// ResourceServiceListAccessibleResources provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) ResourceServiceListAccessibleResources(params *resource_service.ResourceServiceListAccessibleResourcesParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption) (*resource_service.ResourceServiceListAccessibleResourcesOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for ResourceServiceListAccessibleResources") + } + + var r0 *resource_service.ResourceServiceListAccessibleResourcesOK + var r1 error + if rf, ok := ret.Get(0).(func(*resource_service.ResourceServiceListAccessibleResourcesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) (*resource_service.ResourceServiceListAccessibleResourcesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*resource_service.ResourceServiceListAccessibleResourcesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) *resource_service.ResourceServiceListAccessibleResourcesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*resource_service.ResourceServiceListAccessibleResourcesOK) + } + } + + if rf, ok := ret.Get(1).(func(*resource_service.ResourceServiceListAccessibleResourcesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_ResourceServiceListAccessibleResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceServiceListAccessibleResources' +type MockClientService_ResourceServiceListAccessibleResources_Call struct { + *mock.Call +} + +// ResourceServiceListAccessibleResources is a helper method to define mock.On call +// - params *resource_service.ResourceServiceListAccessibleResourcesParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...resource_service.ClientOption +func (_e *MockClientService_Expecter) ResourceServiceListAccessibleResources(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_ResourceServiceListAccessibleResources_Call { + return &MockClientService_ResourceServiceListAccessibleResources_Call{Call: _e.mock.On("ResourceServiceListAccessibleResources", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_ResourceServiceListAccessibleResources_Call) Run(run func(params *resource_service.ResourceServiceListAccessibleResourcesParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption)) *MockClientService_ResourceServiceListAccessibleResources_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]resource_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(resource_service.ClientOption) + } + } + run(args[0].(*resource_service.ResourceServiceListAccessibleResourcesParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_ResourceServiceListAccessibleResources_Call) Return(_a0 *resource_service.ResourceServiceListAccessibleResourcesOK, _a1 error) *MockClientService_ResourceServiceListAccessibleResources_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_ResourceServiceListAccessibleResources_Call) RunAndReturn(run func(*resource_service.ResourceServiceListAccessibleResourcesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) (*resource_service.ResourceServiceListAccessibleResourcesOK, error)) *MockClientService_ResourceServiceListAccessibleResources_Call { + _c.Call.Return(run) + return _c +} + +// ResourceServiceListRoles provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) ResourceServiceListRoles(params *resource_service.ResourceServiceListRolesParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption) (*resource_service.ResourceServiceListRolesOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for ResourceServiceListRoles") + } + + var r0 *resource_service.ResourceServiceListRolesOK + var r1 error + if rf, ok := ret.Get(0).(func(*resource_service.ResourceServiceListRolesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) (*resource_service.ResourceServiceListRolesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*resource_service.ResourceServiceListRolesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) *resource_service.ResourceServiceListRolesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*resource_service.ResourceServiceListRolesOK) + } + } + + if rf, ok := ret.Get(1).(func(*resource_service.ResourceServiceListRolesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_ResourceServiceListRoles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceServiceListRoles' +type MockClientService_ResourceServiceListRoles_Call struct { + *mock.Call +} + +// ResourceServiceListRoles is a helper method to define mock.On call +// - params *resource_service.ResourceServiceListRolesParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...resource_service.ClientOption +func (_e *MockClientService_Expecter) ResourceServiceListRoles(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_ResourceServiceListRoles_Call { + return &MockClientService_ResourceServiceListRoles_Call{Call: _e.mock.On("ResourceServiceListRoles", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_ResourceServiceListRoles_Call) Run(run func(params *resource_service.ResourceServiceListRolesParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption)) *MockClientService_ResourceServiceListRoles_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]resource_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(resource_service.ClientOption) + } + } + run(args[0].(*resource_service.ResourceServiceListRolesParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_ResourceServiceListRoles_Call) Return(_a0 *resource_service.ResourceServiceListRolesOK, _a1 error) *MockClientService_ResourceServiceListRoles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_ResourceServiceListRoles_Call) RunAndReturn(run func(*resource_service.ResourceServiceListRolesParams, runtime.ClientAuthInfoWriter, ...resource_service.ClientOption) (*resource_service.ResourceServiceListRolesOK, error)) *MockClientService_ResourceServiceListRoles_Call { + _c.Call.Return(run) + return _c +} + // ResourceServiceSetIamPolicy provides a mock function with given fields: params, authInfo, opts func (_m *MockClientService) ResourceServiceSetIamPolicy(params *resource_service.ResourceServiceSetIamPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...resource_service.ClientOption) (*resource_service.ResourceServiceSetIamPolicyOK, error) { _va := make([]interface{}, len(opts)) diff --git a/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/preview/2023-11-28/client/secret_service/mock_ClientService.go b/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/preview/2023-11-28/client/secret_service/mock_ClientService.go index e8f68651..16254b28 100644 --- a/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/preview/2023-11-28/client/secret_service/mock_ClientService.go +++ b/internal/pkg/api/mocks/github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/preview/2023-11-28/client/secret_service/mock_ClientService.go @@ -1058,6 +1058,154 @@ func (_c *MockClientService_CreateMongoDBAtlasRotatingSecret_Call) RunAndReturn( return _c } +// CreatePostgresIntegration provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) CreatePostgresIntegration(params *secret_service.CreatePostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.CreatePostgresIntegrationOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for CreatePostgresIntegration") + } + + var r0 *secret_service.CreatePostgresIntegrationOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.CreatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.CreatePostgresIntegrationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.CreatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.CreatePostgresIntegrationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.CreatePostgresIntegrationOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.CreatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_CreatePostgresIntegration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreatePostgresIntegration' +type MockClientService_CreatePostgresIntegration_Call struct { + *mock.Call +} + +// CreatePostgresIntegration is a helper method to define mock.On call +// - params *secret_service.CreatePostgresIntegrationParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) CreatePostgresIntegration(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_CreatePostgresIntegration_Call { + return &MockClientService_CreatePostgresIntegration_Call{Call: _e.mock.On("CreatePostgresIntegration", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_CreatePostgresIntegration_Call) Run(run func(params *secret_service.CreatePostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_CreatePostgresIntegration_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.CreatePostgresIntegrationParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_CreatePostgresIntegration_Call) Return(_a0 *secret_service.CreatePostgresIntegrationOK, _a1 error) *MockClientService_CreatePostgresIntegration_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_CreatePostgresIntegration_Call) RunAndReturn(run func(*secret_service.CreatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.CreatePostgresIntegrationOK, error)) *MockClientService_CreatePostgresIntegration_Call { + _c.Call.Return(run) + return _c +} + +// CreatePostgresRotatingSecret provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) CreatePostgresRotatingSecret(params *secret_service.CreatePostgresRotatingSecretParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.CreatePostgresRotatingSecretOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for CreatePostgresRotatingSecret") + } + + var r0 *secret_service.CreatePostgresRotatingSecretOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.CreatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.CreatePostgresRotatingSecretOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.CreatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.CreatePostgresRotatingSecretOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.CreatePostgresRotatingSecretOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.CreatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_CreatePostgresRotatingSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreatePostgresRotatingSecret' +type MockClientService_CreatePostgresRotatingSecret_Call struct { + *mock.Call +} + +// CreatePostgresRotatingSecret is a helper method to define mock.On call +// - params *secret_service.CreatePostgresRotatingSecretParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) CreatePostgresRotatingSecret(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_CreatePostgresRotatingSecret_Call { + return &MockClientService_CreatePostgresRotatingSecret_Call{Call: _e.mock.On("CreatePostgresRotatingSecret", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_CreatePostgresRotatingSecret_Call) Run(run func(params *secret_service.CreatePostgresRotatingSecretParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_CreatePostgresRotatingSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.CreatePostgresRotatingSecretParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_CreatePostgresRotatingSecret_Call) Return(_a0 *secret_service.CreatePostgresRotatingSecretOK, _a1 error) *MockClientService_CreatePostgresRotatingSecret_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_CreatePostgresRotatingSecret_Call) RunAndReturn(run func(*secret_service.CreatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.CreatePostgresRotatingSecretOK, error)) *MockClientService_CreatePostgresRotatingSecret_Call { + _c.Call.Return(run) + return _c +} + // CreateSync provides a mock function with given fields: params, authInfo, opts func (_m *MockClientService) CreateSync(params *secret_service.CreateSyncParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.CreateSyncOK, error) { _va := make([]interface{}, len(opts)) @@ -2094,6 +2242,80 @@ func (_c *MockClientService_DeleteMongoDBAtlasIntegration_Call) RunAndReturn(run return _c } +// DeletePostgresIntegration provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) DeletePostgresIntegration(params *secret_service.DeletePostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.DeletePostgresIntegrationOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for DeletePostgresIntegration") + } + + var r0 *secret_service.DeletePostgresIntegrationOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.DeletePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.DeletePostgresIntegrationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.DeletePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.DeletePostgresIntegrationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.DeletePostgresIntegrationOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.DeletePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_DeletePostgresIntegration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeletePostgresIntegration' +type MockClientService_DeletePostgresIntegration_Call struct { + *mock.Call +} + +// DeletePostgresIntegration is a helper method to define mock.On call +// - params *secret_service.DeletePostgresIntegrationParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) DeletePostgresIntegration(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_DeletePostgresIntegration_Call { + return &MockClientService_DeletePostgresIntegration_Call{Call: _e.mock.On("DeletePostgresIntegration", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_DeletePostgresIntegration_Call) Run(run func(params *secret_service.DeletePostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_DeletePostgresIntegration_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.DeletePostgresIntegrationParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_DeletePostgresIntegration_Call) Return(_a0 *secret_service.DeletePostgresIntegrationOK, _a1 error) *MockClientService_DeletePostgresIntegration_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_DeletePostgresIntegration_Call) RunAndReturn(run func(*secret_service.DeletePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.DeletePostgresIntegrationOK, error)) *MockClientService_DeletePostgresIntegration_Call { + _c.Call.Return(run) + return _c +} + // DeleteSync provides a mock function with given fields: params, authInfo, opts func (_m *MockClientService) DeleteSync(params *secret_service.DeleteSyncParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.DeleteSyncOK, error) { _va := make([]interface{}, len(opts)) @@ -3500,6 +3722,154 @@ func (_c *MockClientService_GetMongoDBAtlasRotatingSecretConfig_Call) RunAndRetu return _c } +// GetPostgresIntegration provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) GetPostgresIntegration(params *secret_service.GetPostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.GetPostgresIntegrationOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for GetPostgresIntegration") + } + + var r0 *secret_service.GetPostgresIntegrationOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.GetPostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.GetPostgresIntegrationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.GetPostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.GetPostgresIntegrationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.GetPostgresIntegrationOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.GetPostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_GetPostgresIntegration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPostgresIntegration' +type MockClientService_GetPostgresIntegration_Call struct { + *mock.Call +} + +// GetPostgresIntegration is a helper method to define mock.On call +// - params *secret_service.GetPostgresIntegrationParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) GetPostgresIntegration(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_GetPostgresIntegration_Call { + return &MockClientService_GetPostgresIntegration_Call{Call: _e.mock.On("GetPostgresIntegration", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_GetPostgresIntegration_Call) Run(run func(params *secret_service.GetPostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_GetPostgresIntegration_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.GetPostgresIntegrationParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_GetPostgresIntegration_Call) Return(_a0 *secret_service.GetPostgresIntegrationOK, _a1 error) *MockClientService_GetPostgresIntegration_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_GetPostgresIntegration_Call) RunAndReturn(run func(*secret_service.GetPostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.GetPostgresIntegrationOK, error)) *MockClientService_GetPostgresIntegration_Call { + _c.Call.Return(run) + return _c +} + +// GetPostgresRotatingSecretConfig provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) GetPostgresRotatingSecretConfig(params *secret_service.GetPostgresRotatingSecretConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.GetPostgresRotatingSecretConfigOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for GetPostgresRotatingSecretConfig") + } + + var r0 *secret_service.GetPostgresRotatingSecretConfigOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.GetPostgresRotatingSecretConfigParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.GetPostgresRotatingSecretConfigOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.GetPostgresRotatingSecretConfigParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.GetPostgresRotatingSecretConfigOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.GetPostgresRotatingSecretConfigOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.GetPostgresRotatingSecretConfigParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_GetPostgresRotatingSecretConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPostgresRotatingSecretConfig' +type MockClientService_GetPostgresRotatingSecretConfig_Call struct { + *mock.Call +} + +// GetPostgresRotatingSecretConfig is a helper method to define mock.On call +// - params *secret_service.GetPostgresRotatingSecretConfigParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) GetPostgresRotatingSecretConfig(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_GetPostgresRotatingSecretConfig_Call { + return &MockClientService_GetPostgresRotatingSecretConfig_Call{Call: _e.mock.On("GetPostgresRotatingSecretConfig", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_GetPostgresRotatingSecretConfig_Call) Run(run func(params *secret_service.GetPostgresRotatingSecretConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_GetPostgresRotatingSecretConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.GetPostgresRotatingSecretConfigParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_GetPostgresRotatingSecretConfig_Call) Return(_a0 *secret_service.GetPostgresRotatingSecretConfigOK, _a1 error) *MockClientService_GetPostgresRotatingSecretConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_GetPostgresRotatingSecretConfig_Call) RunAndReturn(run func(*secret_service.GetPostgresRotatingSecretConfigParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.GetPostgresRotatingSecretConfigOK, error)) *MockClientService_GetPostgresRotatingSecretConfig_Call { + _c.Call.Return(run) + return _c +} + // GetRotatingSecretState provides a mock function with given fields: params, authInfo, opts func (_m *MockClientService) GetRotatingSecretState(params *secret_service.GetRotatingSecretStateParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.GetRotatingSecretStateOK, error) { _va := make([]interface{}, len(opts)) @@ -4980,6 +5350,80 @@ func (_c *MockClientService_ListOpenAppSecretVersions_Call) RunAndReturn(run fun return _c } +// ListPostgresIntegrations provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) ListPostgresIntegrations(params *secret_service.ListPostgresIntegrationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.ListPostgresIntegrationsOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for ListPostgresIntegrations") + } + + var r0 *secret_service.ListPostgresIntegrationsOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.ListPostgresIntegrationsParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.ListPostgresIntegrationsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.ListPostgresIntegrationsParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.ListPostgresIntegrationsOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.ListPostgresIntegrationsOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.ListPostgresIntegrationsParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_ListPostgresIntegrations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPostgresIntegrations' +type MockClientService_ListPostgresIntegrations_Call struct { + *mock.Call +} + +// ListPostgresIntegrations is a helper method to define mock.On call +// - params *secret_service.ListPostgresIntegrationsParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) ListPostgresIntegrations(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_ListPostgresIntegrations_Call { + return &MockClientService_ListPostgresIntegrations_Call{Call: _e.mock.On("ListPostgresIntegrations", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_ListPostgresIntegrations_Call) Run(run func(params *secret_service.ListPostgresIntegrationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_ListPostgresIntegrations_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.ListPostgresIntegrationsParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_ListPostgresIntegrations_Call) Return(_a0 *secret_service.ListPostgresIntegrationsOK, _a1 error) *MockClientService_ListPostgresIntegrations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_ListPostgresIntegrations_Call) RunAndReturn(run func(*secret_service.ListPostgresIntegrationsParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.ListPostgresIntegrationsOK, error)) *MockClientService_ListPostgresIntegrations_Call { + _c.Call.Return(run) + return _c +} + // ListSyncs provides a mock function with given fields: params, authInfo, opts func (_m *MockClientService) ListSyncs(params *secret_service.ListSyncsParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.ListSyncsOK, error) { _va := make([]interface{}, len(opts)) @@ -6567,6 +7011,154 @@ func (_c *MockClientService_UpdateMongoDBAtlasRotatingSecret_Call) RunAndReturn( return _c } +// UpdatePostgresIntegration provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) UpdatePostgresIntegration(params *secret_service.UpdatePostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.UpdatePostgresIntegrationOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for UpdatePostgresIntegration") + } + + var r0 *secret_service.UpdatePostgresIntegrationOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.UpdatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.UpdatePostgresIntegrationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.UpdatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.UpdatePostgresIntegrationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.UpdatePostgresIntegrationOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.UpdatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_UpdatePostgresIntegration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePostgresIntegration' +type MockClientService_UpdatePostgresIntegration_Call struct { + *mock.Call +} + +// UpdatePostgresIntegration is a helper method to define mock.On call +// - params *secret_service.UpdatePostgresIntegrationParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) UpdatePostgresIntegration(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_UpdatePostgresIntegration_Call { + return &MockClientService_UpdatePostgresIntegration_Call{Call: _e.mock.On("UpdatePostgresIntegration", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_UpdatePostgresIntegration_Call) Run(run func(params *secret_service.UpdatePostgresIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_UpdatePostgresIntegration_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.UpdatePostgresIntegrationParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_UpdatePostgresIntegration_Call) Return(_a0 *secret_service.UpdatePostgresIntegrationOK, _a1 error) *MockClientService_UpdatePostgresIntegration_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_UpdatePostgresIntegration_Call) RunAndReturn(run func(*secret_service.UpdatePostgresIntegrationParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.UpdatePostgresIntegrationOK, error)) *MockClientService_UpdatePostgresIntegration_Call { + _c.Call.Return(run) + return _c +} + +// UpdatePostgresRotatingSecret provides a mock function with given fields: params, authInfo, opts +func (_m *MockClientService) UpdatePostgresRotatingSecret(params *secret_service.UpdatePostgresRotatingSecretParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.UpdatePostgresRotatingSecretOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for UpdatePostgresRotatingSecret") + } + + var r0 *secret_service.UpdatePostgresRotatingSecretOK + var r1 error + if rf, ok := ret.Get(0).(func(*secret_service.UpdatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.UpdatePostgresRotatingSecretOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*secret_service.UpdatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) *secret_service.UpdatePostgresRotatingSecretOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*secret_service.UpdatePostgresRotatingSecretOK) + } + } + + if rf, ok := ret.Get(1).(func(*secret_service.UpdatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockClientService_UpdatePostgresRotatingSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePostgresRotatingSecret' +type MockClientService_UpdatePostgresRotatingSecret_Call struct { + *mock.Call +} + +// UpdatePostgresRotatingSecret is a helper method to define mock.On call +// - params *secret_service.UpdatePostgresRotatingSecretParams +// - authInfo runtime.ClientAuthInfoWriter +// - opts ...secret_service.ClientOption +func (_e *MockClientService_Expecter) UpdatePostgresRotatingSecret(params interface{}, authInfo interface{}, opts ...interface{}) *MockClientService_UpdatePostgresRotatingSecret_Call { + return &MockClientService_UpdatePostgresRotatingSecret_Call{Call: _e.mock.On("UpdatePostgresRotatingSecret", + append([]interface{}{params, authInfo}, opts...)...)} +} + +func (_c *MockClientService_UpdatePostgresRotatingSecret_Call) Run(run func(params *secret_service.UpdatePostgresRotatingSecretParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption)) *MockClientService_UpdatePostgresRotatingSecret_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]secret_service.ClientOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(secret_service.ClientOption) + } + } + run(args[0].(*secret_service.UpdatePostgresRotatingSecretParams), args[1].(runtime.ClientAuthInfoWriter), variadicArgs...) + }) + return _c +} + +func (_c *MockClientService_UpdatePostgresRotatingSecret_Call) Return(_a0 *secret_service.UpdatePostgresRotatingSecretOK, _a1 error) *MockClientService_UpdatePostgresRotatingSecret_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockClientService_UpdatePostgresRotatingSecret_Call) RunAndReturn(run func(*secret_service.UpdatePostgresRotatingSecretParams, runtime.ClientAuthInfoWriter, ...secret_service.ClientOption) (*secret_service.UpdatePostgresRotatingSecretOK, error)) *MockClientService_UpdatePostgresRotatingSecret_Call { + _c.Call.Return(run) + return _c +} + // UpdateTwilioIntegration provides a mock function with given fields: params, authInfo, opts func (_m *MockClientService) UpdateTwilioIntegration(params *secret_service.UpdateTwilioIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...secret_service.ClientOption) (*secret_service.UpdateTwilioIntegrationOK, error) { _va := make([]interface{}, len(opts))