diff --git a/Makefile b/Makefile index 5bc84a0..d4566b6 100644 --- a/Makefile +++ b/Makefile @@ -38,13 +38,13 @@ generate: @make format generate-mocks: - @mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/siren/v1beta1/sirenv1beta1grpc --name=SirenServiceClient - @mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/shield/v1beta1/shieldv1beta1grpc --name=ShieldServiceClient - @mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/optimus/core/v1beta1/corev1beta1grpc --name=JobSpecificationServiceClient - @mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/entropy/v1beta1/entropyv1beta1grpc --name=ResourceServiceClient - @mockery --srcpkg=./internal/server/gcs --name=BlobStorageClient - @mockery --srcpkg=./internal/server/gcs --name=BlobObjectClient - @mockery --srcpkg=./internal/server/gcs --name=ObjectIterator + @mockery --with-expecter --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/siren/v1beta1/sirenv1beta1grpc --name=SirenServiceClient + @mockery --with-expecter --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/shield/v1beta1/shieldv1beta1grpc --name=ShieldServiceClient + @mockery --with-expecter --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/optimus/core/v1beta1/corev1beta1grpc --name=JobSpecificationServiceClient + @mockery --with-expecter --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/entropy/v1beta1/entropyv1beta1grpc --name=ResourceServiceClient + @mockery --with-expecter --srcpkg=./internal/server/gcs --name=BlobStorageClient + @mockery --with-expecter --srcpkg=./internal/server/gcs --name=BlobObjectClient + @mockery --with-expecter --srcpkg=./internal/server/gcs --name=ObjectIterator clean: tidy @echo "Cleaning up build directories..." diff --git a/cli/server/configs.go b/cli/server/configs.go index 64a5c1f..ef9d335 100644 --- a/cli/server/configs.go +++ b/cli/server/configs.go @@ -24,6 +24,11 @@ type serverConfig struct { Optimus optimusConfig `mapstructure:"optimus"` StencilAddr string `mapstructure:"stencil_addr"` Dlq dlqConfig `mapstructure:"dlq"` + Warden wardenConfig `mapstructure:"warden"` +} + +type wardenConfig struct { + Addr string `mapstructure:"addr"` } type odinConfig struct { diff --git a/cli/server/server.go b/cli/server/server.go index 8b29d8c..32fb113 100644 --- a/cli/server/server.go +++ b/cli/server/server.go @@ -20,6 +20,7 @@ import ( "github.com/goto/dex/internal/server/v1/optimus" "github.com/goto/dex/pkg/logger" "github.com/goto/dex/pkg/telemetry" + "github.com/goto/dex/warden" ) func Commands() *cobra.Command { @@ -102,6 +103,7 @@ func runServer(baseCtx context.Context, nrApp *newrelic.Application, zapLog *zap return err } + wardenClient := warden.NewClient(cfg.Warden.Addr) dlqConfig := &dlq.DlqJobConfig{ // TODO: map cfg.Dlq\ DlqJobImage: cfg.Dlq.DlqJobImage, @@ -117,6 +119,7 @@ func runServer(baseCtx context.Context, nrApp *newrelic.Application, zapLog *zap &gcs.Client{StorageClient: gcsClient}, cfg.Odin.Addr, cfg.StencilAddr, + wardenClient, dlqConfig, ) } diff --git a/dex b/dex new file mode 160000 index 0000000..7860372 --- /dev/null +++ b/dex @@ -0,0 +1 @@ +Subproject commit 7860372df8965eee6a27d0bb0877d9e2ff08dace diff --git a/internal/server/server.go b/internal/server/server.go index 06cd49a..d8276a7 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -20,9 +20,11 @@ import ( alertsv1 "github.com/goto/dex/internal/server/v1/alert" dlqv1 "github.com/goto/dex/internal/server/v1/dlq" firehosev1 "github.com/goto/dex/internal/server/v1/firehose" + iamv1 "github.com/goto/dex/internal/server/v1/iam" kubernetesv1 "github.com/goto/dex/internal/server/v1/kubernetes" optimusv1 "github.com/goto/dex/internal/server/v1/optimus" projectsv1 "github.com/goto/dex/internal/server/v1/project" + "github.com/goto/dex/warden" ) // Serve initialises all the HTTP API routes, starts listening for requests at addr, and blocks until @@ -37,6 +39,7 @@ func Serve(ctx context.Context, addr string, gcsClient gcs.BlobStorageClient, odinAddr string, stencilAddr string, + wardenClient *warden.Client, dlqConfig *dlqv1.DlqJobConfig, ) error { alertSvc := alertsv1.NewService(sirenClient) @@ -66,6 +69,7 @@ func Serve(ctx context.Context, addr string, r.Route("/dlq", dlqv1.Routes(entropyClient, gcsClient, dlqConfig)) r.Route("/firehoses", firehosev1.Routes(entropyClient, shieldClient, alertSvc, compassClient, odinAddr, stencilAddr)) r.Route("/kubernetes", kubernetesv1.Routes(entropyClient)) + r.Route("/iam", iamv1.Routes(shieldClient, wardenClient)) }) logger.Info("starting server", zap.String("addr", addr)) diff --git a/internal/server/v1/iam/handler.go b/internal/server/v1/iam/handler.go new file mode 100644 index 0000000..d92e165 --- /dev/null +++ b/internal/server/v1/iam/handler.go @@ -0,0 +1,61 @@ +package iam + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + + "github.com/goto/dex/internal/server/reqctx" + "github.com/goto/dex/internal/server/utils" +) + +type handler struct { + service *Service +} + +func NewHandler(service *Service) *handler { + return &handler{service: service} +} + +func (h *handler) listUserWardenTeams(w http.ResponseWriter, r *http.Request) { + reqCtx := reqctx.From(r.Context()) + const errEmailMissedInHeader = "user email not in header" + + if reqCtx.UserEmail == "" { + utils.WriteErrMsg(w, http.StatusUnauthorized, errEmailMissedInHeader) + return + } + + teamListResp, err := h.service.UserWardenTeamList(r.Context(), reqCtx.UserEmail) + if err != nil { + utils.WriteErr(w, err) + return + } + + utils.WriteJSON(w, http.StatusOK, map[string]any{ + "teams": teamListResp, + }) +} + +func (h *handler) linkGroupToWarden(w http.ResponseWriter, r *http.Request) { + groupID := chi.URLParam(r, "group_id") + + var body struct { + WardenTeamID string `json:"warden_team_id"` + } + if err := utils.ReadJSON(r, &body); err != nil { + utils.WriteErr(w, err) + return + } else if body.WardenTeamID == "" { + utils.WriteErrMsg(w, http.StatusBadRequest, "missing warden_team_id") + return + } + + resShield, err := h.service.LinkGroupToWarden(r.Context(), groupID, body.WardenTeamID) + if err != nil { + utils.WriteErr(w, err) + return + } + + utils.WriteJSON(w, http.StatusOK, resShield) +} diff --git a/internal/server/v1/iam/handler_test.go b/internal/server/v1/iam/handler_test.go new file mode 100644 index 0000000..a2741c3 --- /dev/null +++ b/internal/server/v1/iam/handler_test.go @@ -0,0 +1,331 @@ +package iam_test + +import ( + "bytes" + "context" + "net/http" + "net/http/httptest" + "testing" + "time" + + shieldv1beta1 "buf.build/gen/go/gotocompany/proton/protocolbuffers/go/gotocompany/shield/v1beta1" + "github.com/go-chi/chi/v5" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/structpb" + + "github.com/goto/dex/internal/server/reqctx" + "github.com/goto/dex/internal/server/v1/iam" + "github.com/goto/dex/internal/server/v1/iam/mocks" + shareMocks "github.com/goto/dex/mocks" + "github.com/goto/dex/pkg/errors" + "github.com/goto/dex/warden" +) + +func TestHandlerTeamList(t *testing.T) { + t.Run("Success", func(t *testing.T) { + dexTeamListResonses := `{ + "teams": [ + { + "name": "data_fabric", + "created_at": "2023-10-13T09:12:58Z", + "updated_at": "2023-10-13T09:12:58Z", + "owner_id": 433, + "parent_team_identifier": "2079834a-05c4-420d-bfc8-44b934adea9f", + "identifier": "b5aea046-dab3-4dac-b1ea-e1eef423226b", + "product_group_name": "data_engineering", + "product_group_id": "2079834a-05c4-420d-bfc8-44b934adea9f", + "labels": null, + "short_code": "T394" + } + ]}` + wardenClient := mocks.NewWardenClient(t) + frozenTime := time.Unix(1697188378, 0).UTC() + wardenClient.EXPECT().ListUserTeams(mock.Anything, warden.TeamListRequest{ + Email: "test@domain.com", + }).Return([]warden.Team{ + { + Name: "data_fabric", + CreatedAt: frozenTime, + UpdatedAt: frozenTime, + OwnerID: 433, + ParentTeamIdentifier: "2079834a-05c4-420d-bfc8-44b934adea9f", + Identifier: "b5aea046-dab3-4dac-b1ea-e1eef423226b", + ProductGroupName: "data_engineering", + ProductGroupID: "2079834a-05c4-420d-bfc8-44b934adea9f", + Labels: nil, + ShortCode: "T394", + }, + }, nil) + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodGet, "/users/me/warden_teams", nil) + require.NoError(t, err) + req.Header.Add("X-Auth-Email", "test@domain.com") + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(nil, wardenClient)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusOK, resp.Code) + assert.JSONEq(t, dexTeamListResonses, resp.Body.String()) + }) + + t.Run("EmailNotFound", func(t *testing.T) { + wardenClient := mocks.NewWardenClient(t) + wardenClient.EXPECT().ListUserTeams(mock.Anything, warden.TeamListRequest{ + Email: "test@domain.com", + }).Return(nil, errors.ErrNotFound) + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodGet, "/users/me/warden_teams", nil) + require.NoError(t, err) + req.Header.Add("X-Auth-Email", "test@domain.com") + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(nil, wardenClient)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusNotFound, resp.Code) + assert.JSONEq(t, `{"code":"not_found", "message":"Requested entity not found", "op":"", "status":404}`, resp.Body.String()) + }) + + t.Run("WardenClientFailure", func(t *testing.T) { + wardenClient := mocks.NewWardenClient(t) + wardenClient.EXPECT().ListUserTeams(mock.Anything, warden.TeamListRequest{ + Email: "test@domain.com", + }).Return(nil, errors.ErrInternal) + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodGet, "/users/me/warden_teams", nil) + require.NoError(t, err) + req.Header.Add("X-Auth-Email", "test@domain.com") + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(nil, wardenClient)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusInternalServerError, resp.Code) + assert.JSONEq(t, `{"code":"internal_error", "message":"Some unexpected error occurred", "op":"", "status":500}`, resp.Body.String()) + }) + + t.Run("MissingEmail", func(t *testing.T) { + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodGet, "/users/me/warden_teams", nil) + require.NoError(t, err) + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(nil, nil)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusUnauthorized, resp.Code) + }) +} + +func TestHandlerUpdateGroup(t *testing.T) { + t.Run("Success", func(t *testing.T) { + dexGroupMetadataResponse := `{ + "privacy": "public", + "product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f", + "team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b", + "team-name": "data_fabric", + "product-group-name": "data_engineering" + }` + groupID := "e38527ee-a8cd-40f9-98a7-1f0bbd20909f" + metaData, _ := structpb.NewStruct(map[string]any{ + "privacy": "public", + }) + + updatedMetaData, _ := structpb.NewStruct(map[string]any{ + "privacy": "public", + "team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b", + "team-name": "data_fabric", + "product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f", + "product-group-name": "data_engineering", + }) + + wardenClient := mocks.NewWardenClient(t) + frozenTime := time.Unix(1697188378, 0).UTC() + wardenClient.EXPECT().TeamByUUID(mock.Anything, warden.TeamByUUIDRequest{ + TeamUUID: "123", + }).Return(&warden.Team{ + Name: "data_fabric", + CreatedAt: frozenTime, + UpdatedAt: frozenTime, + OwnerID: 433, + ParentTeamIdentifier: "2079834a-05c4-420d-bfc8-44b934adea9f", + Identifier: "b5aea046-dab3-4dac-b1ea-e1eef423226b", + ProductGroupName: "data_engineering", + ProductGroupID: "2079834a-05c4-420d-bfc8-44b934adea9f", + Labels: nil, + ShortCode: "T394", + }, nil) + + shieldClient := shareMocks.NewShieldServiceClient(t) + shieldClient.EXPECT().GetGroup(mock.Anything, &shieldv1beta1.GetGroupRequest{ + Id: groupID, + }).Return(&shieldv1beta1.GetGroupResponse{ + Group: &shieldv1beta1.Group{ + Id: groupID, Name: "test", Slug: "testSlug", OrgId: "123", Metadata: metaData, + }, + }, nil) + + shieldClient.EXPECT().UpdateGroup(mock.Anything, &shieldv1beta1.UpdateGroupRequest{ + Id: groupID, Body: &shieldv1beta1.GroupRequestBody{ + Metadata: updatedMetaData, Name: "test", Slug: "testSlug", OrgId: "123", + }, + }).Return(&shieldv1beta1.UpdateGroupResponse{Group: &shieldv1beta1.Group{ + Id: groupID, Name: "test", Slug: "testSlug", OrgId: "123", Metadata: updatedMetaData, + }}, nil) + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodPut, "/groups/e38527ee-a8cd-40f9-98a7-1f0bbd20909f/metadata/warden", bytes.NewBufferString(`{"warden_team_id": "123"}`)) + require.NoError(t, err) + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(shieldClient, wardenClient)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusOK, resp.Code) + assert.JSONEq(t, dexGroupMetadataResponse, resp.Body.String()) + }) + + t.Run("MissingWardenTeamID", func(t *testing.T) { + // response return by handler + dexGroupMetadataResponse := `{"code":"", "message":"missing warden_team_id", "op":"", "status":400}` + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodPut, "/groups/e38527ee-a8cd-40f9-98a7-1f0bbd20909f/metadata/warden", bytes.NewBufferString(`{}`)) + require.NoError(t, err) + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(nil, nil)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusBadRequest, resp.Code) + assert.JSONEq(t, dexGroupMetadataResponse, resp.Body.String()) + }) + + t.Run("WardenIdNotFound", func(t *testing.T) { + // response returned by warden client + dexGroupMetadataResponse := `{"code":"not_found", "message":"Requested entity not found", "op":"", "status":404}` + + wardenClient := mocks.NewWardenClient(t) + wardenClient.EXPECT().TeamByUUID(mock.Anything, warden.TeamByUUIDRequest{ + TeamUUID: "123", + }).Return(nil, errors.ErrNotFound) + + shieldClient := shareMocks.NewShieldServiceClient(t) + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodPut, "/groups/e38527ee-a8cd-40f9-98a7-1f0bbd20909f/metadata/warden", bytes.NewBufferString(`{"warden_team_id": "123"}`)) + require.NoError(t, err) + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(shieldClient, wardenClient)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusNotFound, resp.Code) + assert.JSONEq(t, dexGroupMetadataResponse, resp.Body.String()) + }) + + t.Run("ShieldGetGroupFailure", func(t *testing.T) { + // response returned by shield client + dexGroupMetadataResponse := `{"code":"internal_error", "message":"Some unexpected error occurred", "op":"", "status":500}` + groupID := "e38527ee-a8cd-40f9-98a7-1f0bbd20909f" + + wardenClient := mocks.NewWardenClient(t) + frozenTime := time.Unix(1697188378, 0).UTC() + wardenClient.EXPECT().TeamByUUID(mock.Anything, warden.TeamByUUIDRequest{ + TeamUUID: "123", + }).Return(&warden.Team{ + Name: "data_fabric", + CreatedAt: frozenTime, + UpdatedAt: frozenTime, + OwnerID: 433, + ParentTeamIdentifier: "2079834a-05c4-420d-bfc8-44b934adea9f", + Identifier: "b5aea046-dab3-4dac-b1ea-e1eef423226b", + ProductGroupName: "data_engineering", + ProductGroupID: "2079834a-05c4-420d-bfc8-44b934adea9f", + Labels: nil, + ShortCode: "T394", + }, nil) + + shieldClient := shareMocks.NewShieldServiceClient(t) + shieldClient.EXPECT().GetGroup(mock.Anything, &shieldv1beta1.GetGroupRequest{ + Id: groupID, + }).Return(nil, errors.ErrInternal) + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodPut, "/groups/e38527ee-a8cd-40f9-98a7-1f0bbd20909f/metadata/warden", bytes.NewBufferString(`{"warden_team_id": "123"}`)) + require.NoError(t, err) + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(shieldClient, wardenClient)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusInternalServerError, resp.Code) + assert.JSONEq(t, dexGroupMetadataResponse, resp.Body.String()) + }) + + t.Run("ShieldUpdateGroupFailure", func(t *testing.T) { + // response returned by shield client + dexGroupMetadataResponse := `{"code":"internal_error", "message":"Some unexpected error occurred", "op":"", "status":500}` + groupID := "e38527ee-a8cd-40f9-98a7-1f0bbd20909f" + metaData, _ := structpb.NewStruct(map[string]any{ + "privacy": "public", + }) + + updatedMetaData, _ := structpb.NewStruct(map[string]any{ + "privacy": "public", + "team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b", + "team-name": "data_fabric", + "product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f", + "product-group-name": "data_engineering", + }) + + wardenClient := mocks.NewWardenClient(t) + frozenTime := time.Unix(1697188378, 0).UTC() + wardenClient.EXPECT().TeamByUUID(mock.Anything, warden.TeamByUUIDRequest{ + TeamUUID: "123", + }).Return(&warden.Team{ + Name: "data_fabric", + CreatedAt: frozenTime, + UpdatedAt: frozenTime, + OwnerID: 433, + ParentTeamIdentifier: "2079834a-05c4-420d-bfc8-44b934adea9f", + Identifier: "b5aea046-dab3-4dac-b1ea-e1eef423226b", + ProductGroupName: "data_engineering", + ProductGroupID: "2079834a-05c4-420d-bfc8-44b934adea9f", + Labels: nil, + ShortCode: "T394", + }, nil) + + shieldClient := shareMocks.NewShieldServiceClient(t) + shieldClient.EXPECT().GetGroup(mock.Anything, &shieldv1beta1.GetGroupRequest{ + Id: groupID, + }).Return(&shieldv1beta1.GetGroupResponse{ + Group: &shieldv1beta1.Group{ + Id: groupID, Name: "test", Slug: "testSlug", OrgId: "123", Metadata: metaData, + }, + }, nil) + + shieldClient.EXPECT().UpdateGroup(mock.Anything, &shieldv1beta1.UpdateGroupRequest{ + Id: groupID, Body: &shieldv1beta1.GroupRequestBody{ + Metadata: updatedMetaData, Name: "test", Slug: "testSlug", OrgId: "123", + }, + }).Return(nil, errors.ErrInternal) + + resp := httptest.NewRecorder() + req, err := http.NewRequestWithContext(context.TODO(), http.MethodPut, "/groups/e38527ee-a8cd-40f9-98a7-1f0bbd20909f/metadata/warden", bytes.NewBufferString(`{"warden_team_id": "123"}`)) + require.NoError(t, err) + router := chi.NewRouter() + router.Use(reqctx.WithRequestCtx()) + iam.Routes(shieldClient, wardenClient)(router) + router.ServeHTTP(resp, req) + + assert.Equal(t, http.StatusInternalServerError, resp.Code) + assert.JSONEq(t, dexGroupMetadataResponse, resp.Body.String()) + }) +} diff --git a/internal/server/v1/iam/mocks/warden_client.go b/internal/server/v1/iam/mocks/warden_client.go new file mode 100644 index 0000000..4434286 --- /dev/null +++ b/internal/server/v1/iam/mocks/warden_client.go @@ -0,0 +1,148 @@ +// Code generated by mockery v2.30.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + warden "github.com/goto/dex/warden" +) + +// WardenClient is an autogenerated mock type for the WardenClient type +type WardenClient struct { + mock.Mock +} + +type WardenClient_Expecter struct { + mock *mock.Mock +} + +func (_m *WardenClient) EXPECT() *WardenClient_Expecter { + return &WardenClient_Expecter{mock: &_m.Mock} +} + +// ListUserTeams provides a mock function with given fields: ctx, req +func (_m *WardenClient) ListUserTeams(ctx context.Context, req warden.TeamListRequest) ([]warden.Team, error) { + ret := _m.Called(ctx, req) + + var r0 []warden.Team + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, warden.TeamListRequest) ([]warden.Team, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, warden.TeamListRequest) []warden.Team); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]warden.Team) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, warden.TeamListRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WardenClient_ListUserTeams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUserTeams' +type WardenClient_ListUserTeams_Call struct { + *mock.Call +} + +// ListUserTeams is a helper method to define mock.On call +// - ctx context.Context +// - req warden.TeamListRequest +func (_e *WardenClient_Expecter) ListUserTeams(ctx interface{}, req interface{}) *WardenClient_ListUserTeams_Call { + return &WardenClient_ListUserTeams_Call{Call: _e.mock.On("ListUserTeams", ctx, req)} +} + +func (_c *WardenClient_ListUserTeams_Call) Run(run func(ctx context.Context, req warden.TeamListRequest)) *WardenClient_ListUserTeams_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(warden.TeamListRequest)) + }) + return _c +} + +func (_c *WardenClient_ListUserTeams_Call) Return(_a0 []warden.Team, _a1 error) *WardenClient_ListUserTeams_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WardenClient_ListUserTeams_Call) RunAndReturn(run func(context.Context, warden.TeamListRequest) ([]warden.Team, error)) *WardenClient_ListUserTeams_Call { + _c.Call.Return(run) + return _c +} + +// TeamByUUID provides a mock function with given fields: ctx, req +func (_m *WardenClient) TeamByUUID(ctx context.Context, req warden.TeamByUUIDRequest) (*warden.Team, error) { + ret := _m.Called(ctx, req) + + var r0 *warden.Team + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, warden.TeamByUUIDRequest) (*warden.Team, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, warden.TeamByUUIDRequest) *warden.Team); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*warden.Team) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, warden.TeamByUUIDRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WardenClient_TeamByUUID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TeamByUUID' +type WardenClient_TeamByUUID_Call struct { + *mock.Call +} + +// TeamByUUID is a helper method to define mock.On call +// - ctx context.Context +// - req warden.TeamByUUIDRequest +func (_e *WardenClient_Expecter) TeamByUUID(ctx interface{}, req interface{}) *WardenClient_TeamByUUID_Call { + return &WardenClient_TeamByUUID_Call{Call: _e.mock.On("TeamByUUID", ctx, req)} +} + +func (_c *WardenClient_TeamByUUID_Call) Run(run func(ctx context.Context, req warden.TeamByUUIDRequest)) *WardenClient_TeamByUUID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(warden.TeamByUUIDRequest)) + }) + return _c +} + +func (_c *WardenClient_TeamByUUID_Call) Return(_a0 *warden.Team, _a1 error) *WardenClient_TeamByUUID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WardenClient_TeamByUUID_Call) RunAndReturn(run func(context.Context, warden.TeamByUUIDRequest) (*warden.Team, error)) *WardenClient_TeamByUUID_Call { + _c.Call.Return(run) + return _c +} + +// NewWardenClient creates a new instance of WardenClient. 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 NewWardenClient(t interface { + mock.TestingT + Cleanup(func()) +}) *WardenClient { + mock := &WardenClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/server/v1/iam/routes.go b/internal/server/v1/iam/routes.go new file mode 100644 index 0000000..38cf301 --- /dev/null +++ b/internal/server/v1/iam/routes.go @@ -0,0 +1,16 @@ +package iam + +import ( + shieldv1beta1rpc "buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/shield/v1beta1/shieldv1beta1grpc" + chiv5 "github.com/go-chi/chi/v5" +) + +func Routes(shieldClient shieldv1beta1rpc.ShieldServiceClient, wardenClient WardenClient) func(r chiv5.Router) { + service := NewService(shieldClient, wardenClient) + handler := NewHandler(service) + return func(r chiv5.Router) { + r.Get("/users/me/warden_teams", handler.listUserWardenTeams) + + r.Put("/groups/{group_id}/metadata/warden", handler.linkGroupToWarden) + } +} diff --git a/internal/server/v1/iam/service.go b/internal/server/v1/iam/service.go new file mode 100644 index 0000000..3327329 --- /dev/null +++ b/internal/server/v1/iam/service.go @@ -0,0 +1,90 @@ +package iam + +import ( + "context" + "fmt" + + shieldv1beta1rpc "buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/shield/v1beta1/shieldv1beta1grpc" + shieldv1beta1 "buf.build/gen/go/gotocompany/proton/protocolbuffers/go/gotocompany/shield/v1beta1" + "google.golang.org/protobuf/types/known/structpb" + + "github.com/goto/dex/warden" +) + +//go:generate mockery --with-expecter --keeptree --case snake --name WardenClient + +type Service struct { + shieldClient shieldv1beta1rpc.ShieldServiceClient + wardenClient WardenClient +} + +type WardenClient interface { + ListUserTeams(ctx context.Context, req warden.TeamListRequest) ([]warden.Team, error) + TeamByUUID(ctx context.Context, req warden.TeamByUUIDRequest) (*warden.Team, error) +} + +func NewService(shieldClient shieldv1beta1rpc.ShieldServiceClient, wardenClient WardenClient) *Service { + return &Service{ + shieldClient: shieldClient, + wardenClient: wardenClient, + } +} + +func (svc *Service) UserWardenTeamList(ctx context.Context, userEmail string) ([]warden.Team, error) { + teams, err := svc.wardenClient.ListUserTeams(ctx, warden.TeamListRequest{ + Email: userEmail, + }) + if err != nil { + return nil, fmt.Errorf("error listing user teams: %w", err) + } + + return teams, nil +} + +func (svc *Service) LinkGroupToWarden(ctx context.Context, groupID, wardenTeamID string) (map[string]any, error) { + team, err := svc.wardenClient.TeamByUUID(ctx, warden.TeamByUUIDRequest{ + TeamUUID: wardenTeamID, + }) + if err != nil { + return nil, fmt.Errorf("error getting warden team: %w", err) + } + + getGroupRes, err := svc.shieldClient.GetGroup(ctx, &shieldv1beta1.GetGroupRequest{ + Id: groupID, + }) + if err != nil { + return nil, fmt.Errorf("error getting shield group: %w", err) + } + + group := getGroupRes.Group + + metaData := group.Metadata.AsMap() + if metaData == nil { + metaData = make(map[string]any) + } + + metaData["team-id"] = team.Identifier + metaData["team-name"] = team.Name + metaData["product-group-id"] = team.ProductGroupID + metaData["product-group-name"] = team.ProductGroupName + + updatedMetaData, err := structpb.NewStruct(metaData) + if err != nil { + return nil, fmt.Errorf("error creating metadata struct: %w", err) + } + + updatedGroupRes, err := svc.shieldClient.UpdateGroup(ctx, &shieldv1beta1.UpdateGroupRequest{ + Id: groupID, + Body: &shieldv1beta1.GroupRequestBody{ + Metadata: updatedMetaData, + Name: group.Name, + Slug: group.Slug, + OrgId: group.OrgId, + }, + }) + if err != nil { + return nil, fmt.Errorf("error updating group: %w", err) + } + + return updatedGroupRes.Group.Metadata.AsMap(), nil +} diff --git a/mocks/BlobObjectClient.go b/mocks/BlobObjectClient.go index de9353f..ec3b04f 100644 --- a/mocks/BlobObjectClient.go +++ b/mocks/BlobObjectClient.go @@ -16,6 +16,14 @@ type BlobObjectClient struct { mock.Mock } +type BlobObjectClient_Expecter struct { + mock *mock.Mock +} + +func (_m *BlobObjectClient) EXPECT() *BlobObjectClient_Expecter { + return &BlobObjectClient_Expecter{mock: &_m.Mock} +} + // Objects provides a mock function with given fields: ctx, bucket, query func (_m *BlobObjectClient) Objects(ctx context.Context, bucket string, query *storage.Query) gcs.ObjectIterator { ret := _m.Called(ctx, bucket, query) @@ -32,6 +40,36 @@ func (_m *BlobObjectClient) Objects(ctx context.Context, bucket string, query *s return r0 } +// BlobObjectClient_Objects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Objects' +type BlobObjectClient_Objects_Call struct { + *mock.Call +} + +// Objects is a helper method to define mock.On call +// - ctx context.Context +// - bucket string +// - query *storage.Query +func (_e *BlobObjectClient_Expecter) Objects(ctx interface{}, bucket interface{}, query interface{}) *BlobObjectClient_Objects_Call { + return &BlobObjectClient_Objects_Call{Call: _e.mock.On("Objects", ctx, bucket, query)} +} + +func (_c *BlobObjectClient_Objects_Call) Run(run func(ctx context.Context, bucket string, query *storage.Query)) *BlobObjectClient_Objects_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(*storage.Query)) + }) + return _c +} + +func (_c *BlobObjectClient_Objects_Call) Return(_a0 gcs.ObjectIterator) *BlobObjectClient_Objects_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BlobObjectClient_Objects_Call) RunAndReturn(run func(context.Context, string, *storage.Query) gcs.ObjectIterator) *BlobObjectClient_Objects_Call { + _c.Call.Return(run) + return _c +} + // NewBlobObjectClient creates a new instance of BlobObjectClient. 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 NewBlobObjectClient(t interface { diff --git a/mocks/BlobStorageClient.go b/mocks/BlobStorageClient.go index 40dd970..cd99c85 100644 --- a/mocks/BlobStorageClient.go +++ b/mocks/BlobStorageClient.go @@ -14,6 +14,14 @@ type BlobStorageClient struct { mock.Mock } +type BlobStorageClient_Expecter struct { + mock *mock.Mock +} + +func (_m *BlobStorageClient) EXPECT() *BlobStorageClient_Expecter { + return &BlobStorageClient_Expecter{mock: &_m.Mock} +} + // ListDlqMetadata provides a mock function with given fields: bucketInfo func (_m *BlobStorageClient) ListDlqMetadata(bucketInfo gcs.BucketInfo) ([]models.DlqMetadata, error) { ret := _m.Called(bucketInfo) @@ -40,6 +48,34 @@ func (_m *BlobStorageClient) ListDlqMetadata(bucketInfo gcs.BucketInfo) ([]model return r0, r1 } +// BlobStorageClient_ListDlqMetadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDlqMetadata' +type BlobStorageClient_ListDlqMetadata_Call struct { + *mock.Call +} + +// ListDlqMetadata is a helper method to define mock.On call +// - bucketInfo gcs.BucketInfo +func (_e *BlobStorageClient_Expecter) ListDlqMetadata(bucketInfo interface{}) *BlobStorageClient_ListDlqMetadata_Call { + return &BlobStorageClient_ListDlqMetadata_Call{Call: _e.mock.On("ListDlqMetadata", bucketInfo)} +} + +func (_c *BlobStorageClient_ListDlqMetadata_Call) Run(run func(bucketInfo gcs.BucketInfo)) *BlobStorageClient_ListDlqMetadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(gcs.BucketInfo)) + }) + return _c +} + +func (_c *BlobStorageClient_ListDlqMetadata_Call) Return(_a0 []models.DlqMetadata, _a1 error) *BlobStorageClient_ListDlqMetadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *BlobStorageClient_ListDlqMetadata_Call) RunAndReturn(run func(gcs.BucketInfo) ([]models.DlqMetadata, error)) *BlobStorageClient_ListDlqMetadata_Call { + _c.Call.Return(run) + return _c +} + // NewBlobStorageClient creates a new instance of BlobStorageClient. 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 NewBlobStorageClient(t interface { diff --git a/mocks/JobSpecificationServiceClient.go b/mocks/JobSpecificationServiceClient.go index b22d610..1963c7b 100644 --- a/mocks/JobSpecificationServiceClient.go +++ b/mocks/JobSpecificationServiceClient.go @@ -18,6 +18,14 @@ type JobSpecificationServiceClient struct { mock.Mock } +type JobSpecificationServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *JobSpecificationServiceClient) EXPECT() *JobSpecificationServiceClient_Expecter { + return &JobSpecificationServiceClient_Expecter{mock: &_m.Mock} +} + // AddJobSpecifications provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) AddJobSpecifications(ctx context.Context, in *corev1beta1.AddJobSpecificationsRequest, opts ...grpc.CallOption) (*corev1beta1.AddJobSpecificationsResponse, error) { _va := make([]interface{}, len(opts)) @@ -51,6 +59,43 @@ func (_m *JobSpecificationServiceClient) AddJobSpecifications(ctx context.Contex return r0, r1 } +// JobSpecificationServiceClient_AddJobSpecifications_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddJobSpecifications' +type JobSpecificationServiceClient_AddJobSpecifications_Call struct { + *mock.Call +} + +// AddJobSpecifications is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.AddJobSpecificationsRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) AddJobSpecifications(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_AddJobSpecifications_Call { + return &JobSpecificationServiceClient_AddJobSpecifications_Call{Call: _e.mock.On("AddJobSpecifications", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_AddJobSpecifications_Call) Run(run func(ctx context.Context, in *corev1beta1.AddJobSpecificationsRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_AddJobSpecifications_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.AddJobSpecificationsRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_AddJobSpecifications_Call) Return(_a0 *corev1beta1.AddJobSpecificationsResponse, _a1 error) *JobSpecificationServiceClient_AddJobSpecifications_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_AddJobSpecifications_Call) RunAndReturn(run func(context.Context, *corev1beta1.AddJobSpecificationsRequest, ...grpc.CallOption) (*corev1beta1.AddJobSpecificationsResponse, error)) *JobSpecificationServiceClient_AddJobSpecifications_Call { + _c.Call.Return(run) + return _c +} + // ChangeJobNamespace provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) ChangeJobNamespace(ctx context.Context, in *corev1beta1.ChangeJobNamespaceRequest, opts ...grpc.CallOption) (*corev1beta1.ChangeJobNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -84,6 +129,43 @@ func (_m *JobSpecificationServiceClient) ChangeJobNamespace(ctx context.Context, return r0, r1 } +// JobSpecificationServiceClient_ChangeJobNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeJobNamespace' +type JobSpecificationServiceClient_ChangeJobNamespace_Call struct { + *mock.Call +} + +// ChangeJobNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.ChangeJobNamespaceRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) ChangeJobNamespace(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_ChangeJobNamespace_Call { + return &JobSpecificationServiceClient_ChangeJobNamespace_Call{Call: _e.mock.On("ChangeJobNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_ChangeJobNamespace_Call) Run(run func(ctx context.Context, in *corev1beta1.ChangeJobNamespaceRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_ChangeJobNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.ChangeJobNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_ChangeJobNamespace_Call) Return(_a0 *corev1beta1.ChangeJobNamespaceResponse, _a1 error) *JobSpecificationServiceClient_ChangeJobNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_ChangeJobNamespace_Call) RunAndReturn(run func(context.Context, *corev1beta1.ChangeJobNamespaceRequest, ...grpc.CallOption) (*corev1beta1.ChangeJobNamespaceResponse, error)) *JobSpecificationServiceClient_ChangeJobNamespace_Call { + _c.Call.Return(run) + return _c +} + // CheckJobSpecification provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) CheckJobSpecification(ctx context.Context, in *corev1beta1.CheckJobSpecificationRequest, opts ...grpc.CallOption) (*corev1beta1.CheckJobSpecificationResponse, error) { _va := make([]interface{}, len(opts)) @@ -117,6 +199,43 @@ func (_m *JobSpecificationServiceClient) CheckJobSpecification(ctx context.Conte return r0, r1 } +// JobSpecificationServiceClient_CheckJobSpecification_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckJobSpecification' +type JobSpecificationServiceClient_CheckJobSpecification_Call struct { + *mock.Call +} + +// CheckJobSpecification is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.CheckJobSpecificationRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) CheckJobSpecification(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_CheckJobSpecification_Call { + return &JobSpecificationServiceClient_CheckJobSpecification_Call{Call: _e.mock.On("CheckJobSpecification", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_CheckJobSpecification_Call) Run(run func(ctx context.Context, in *corev1beta1.CheckJobSpecificationRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_CheckJobSpecification_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.CheckJobSpecificationRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_CheckJobSpecification_Call) Return(_a0 *corev1beta1.CheckJobSpecificationResponse, _a1 error) *JobSpecificationServiceClient_CheckJobSpecification_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_CheckJobSpecification_Call) RunAndReturn(run func(context.Context, *corev1beta1.CheckJobSpecificationRequest, ...grpc.CallOption) (*corev1beta1.CheckJobSpecificationResponse, error)) *JobSpecificationServiceClient_CheckJobSpecification_Call { + _c.Call.Return(run) + return _c +} + // CheckJobSpecifications provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) CheckJobSpecifications(ctx context.Context, in *corev1beta1.CheckJobSpecificationsRequest, opts ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_CheckJobSpecificationsClient, error) { _va := make([]interface{}, len(opts)) @@ -150,6 +269,43 @@ func (_m *JobSpecificationServiceClient) CheckJobSpecifications(ctx context.Cont return r0, r1 } +// JobSpecificationServiceClient_CheckJobSpecifications_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckJobSpecifications' +type JobSpecificationServiceClient_CheckJobSpecifications_Call struct { + *mock.Call +} + +// CheckJobSpecifications is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.CheckJobSpecificationsRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) CheckJobSpecifications(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_CheckJobSpecifications_Call { + return &JobSpecificationServiceClient_CheckJobSpecifications_Call{Call: _e.mock.On("CheckJobSpecifications", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_CheckJobSpecifications_Call) Run(run func(ctx context.Context, in *corev1beta1.CheckJobSpecificationsRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_CheckJobSpecifications_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.CheckJobSpecificationsRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_CheckJobSpecifications_Call) Return(_a0 corev1beta1grpc.JobSpecificationService_CheckJobSpecificationsClient, _a1 error) *JobSpecificationServiceClient_CheckJobSpecifications_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_CheckJobSpecifications_Call) RunAndReturn(run func(context.Context, *corev1beta1.CheckJobSpecificationsRequest, ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_CheckJobSpecificationsClient, error)) *JobSpecificationServiceClient_CheckJobSpecifications_Call { + _c.Call.Return(run) + return _c +} + // CreateJobSpecification provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) CreateJobSpecification(ctx context.Context, in *corev1beta1.CreateJobSpecificationRequest, opts ...grpc.CallOption) (*corev1beta1.CreateJobSpecificationResponse, error) { _va := make([]interface{}, len(opts)) @@ -183,6 +339,43 @@ func (_m *JobSpecificationServiceClient) CreateJobSpecification(ctx context.Cont return r0, r1 } +// JobSpecificationServiceClient_CreateJobSpecification_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateJobSpecification' +type JobSpecificationServiceClient_CreateJobSpecification_Call struct { + *mock.Call +} + +// CreateJobSpecification is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.CreateJobSpecificationRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) CreateJobSpecification(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_CreateJobSpecification_Call { + return &JobSpecificationServiceClient_CreateJobSpecification_Call{Call: _e.mock.On("CreateJobSpecification", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_CreateJobSpecification_Call) Run(run func(ctx context.Context, in *corev1beta1.CreateJobSpecificationRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_CreateJobSpecification_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.CreateJobSpecificationRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_CreateJobSpecification_Call) Return(_a0 *corev1beta1.CreateJobSpecificationResponse, _a1 error) *JobSpecificationServiceClient_CreateJobSpecification_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_CreateJobSpecification_Call) RunAndReturn(run func(context.Context, *corev1beta1.CreateJobSpecificationRequest, ...grpc.CallOption) (*corev1beta1.CreateJobSpecificationResponse, error)) *JobSpecificationServiceClient_CreateJobSpecification_Call { + _c.Call.Return(run) + return _c +} + // DeleteJobSpecification provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) DeleteJobSpecification(ctx context.Context, in *corev1beta1.DeleteJobSpecificationRequest, opts ...grpc.CallOption) (*corev1beta1.DeleteJobSpecificationResponse, error) { _va := make([]interface{}, len(opts)) @@ -216,6 +409,43 @@ func (_m *JobSpecificationServiceClient) DeleteJobSpecification(ctx context.Cont return r0, r1 } +// JobSpecificationServiceClient_DeleteJobSpecification_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteJobSpecification' +type JobSpecificationServiceClient_DeleteJobSpecification_Call struct { + *mock.Call +} + +// DeleteJobSpecification is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.DeleteJobSpecificationRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) DeleteJobSpecification(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_DeleteJobSpecification_Call { + return &JobSpecificationServiceClient_DeleteJobSpecification_Call{Call: _e.mock.On("DeleteJobSpecification", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_DeleteJobSpecification_Call) Run(run func(ctx context.Context, in *corev1beta1.DeleteJobSpecificationRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_DeleteJobSpecification_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.DeleteJobSpecificationRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_DeleteJobSpecification_Call) Return(_a0 *corev1beta1.DeleteJobSpecificationResponse, _a1 error) *JobSpecificationServiceClient_DeleteJobSpecification_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_DeleteJobSpecification_Call) RunAndReturn(run func(context.Context, *corev1beta1.DeleteJobSpecificationRequest, ...grpc.CallOption) (*corev1beta1.DeleteJobSpecificationResponse, error)) *JobSpecificationServiceClient_DeleteJobSpecification_Call { + _c.Call.Return(run) + return _c +} + // DeployJobSpecification provides a mock function with given fields: ctx, opts func (_m *JobSpecificationServiceClient) DeployJobSpecification(ctx context.Context, opts ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_DeployJobSpecificationClient, error) { _va := make([]interface{}, len(opts)) @@ -249,6 +479,42 @@ func (_m *JobSpecificationServiceClient) DeployJobSpecification(ctx context.Cont return r0, r1 } +// JobSpecificationServiceClient_DeployJobSpecification_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeployJobSpecification' +type JobSpecificationServiceClient_DeployJobSpecification_Call struct { + *mock.Call +} + +// DeployJobSpecification is a helper method to define mock.On call +// - ctx context.Context +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) DeployJobSpecification(ctx interface{}, opts ...interface{}) *JobSpecificationServiceClient_DeployJobSpecification_Call { + return &JobSpecificationServiceClient_DeployJobSpecification_Call{Call: _e.mock.On("DeployJobSpecification", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_DeployJobSpecification_Call) Run(run func(ctx context.Context, opts ...grpc.CallOption)) *JobSpecificationServiceClient_DeployJobSpecification_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_DeployJobSpecification_Call) Return(_a0 corev1beta1grpc.JobSpecificationService_DeployJobSpecificationClient, _a1 error) *JobSpecificationServiceClient_DeployJobSpecification_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_DeployJobSpecification_Call) RunAndReturn(run func(context.Context, ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_DeployJobSpecificationClient, error)) *JobSpecificationServiceClient_DeployJobSpecification_Call { + _c.Call.Return(run) + return _c +} + // GetDeployJobsStatus provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) GetDeployJobsStatus(ctx context.Context, in *corev1beta1.GetDeployJobsStatusRequest, opts ...grpc.CallOption) (*corev1beta1.GetDeployJobsStatusResponse, error) { _va := make([]interface{}, len(opts)) @@ -282,6 +548,43 @@ func (_m *JobSpecificationServiceClient) GetDeployJobsStatus(ctx context.Context return r0, r1 } +// JobSpecificationServiceClient_GetDeployJobsStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDeployJobsStatus' +type JobSpecificationServiceClient_GetDeployJobsStatus_Call struct { + *mock.Call +} + +// GetDeployJobsStatus is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.GetDeployJobsStatusRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) GetDeployJobsStatus(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_GetDeployJobsStatus_Call { + return &JobSpecificationServiceClient_GetDeployJobsStatus_Call{Call: _e.mock.On("GetDeployJobsStatus", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_GetDeployJobsStatus_Call) Run(run func(ctx context.Context, in *corev1beta1.GetDeployJobsStatusRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_GetDeployJobsStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.GetDeployJobsStatusRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_GetDeployJobsStatus_Call) Return(_a0 *corev1beta1.GetDeployJobsStatusResponse, _a1 error) *JobSpecificationServiceClient_GetDeployJobsStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_GetDeployJobsStatus_Call) RunAndReturn(run func(context.Context, *corev1beta1.GetDeployJobsStatusRequest, ...grpc.CallOption) (*corev1beta1.GetDeployJobsStatusResponse, error)) *JobSpecificationServiceClient_GetDeployJobsStatus_Call { + _c.Call.Return(run) + return _c +} + // GetJobSpecification provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) GetJobSpecification(ctx context.Context, in *corev1beta1.GetJobSpecificationRequest, opts ...grpc.CallOption) (*corev1beta1.GetJobSpecificationResponse, error) { _va := make([]interface{}, len(opts)) @@ -315,6 +618,43 @@ func (_m *JobSpecificationServiceClient) GetJobSpecification(ctx context.Context return r0, r1 } +// JobSpecificationServiceClient_GetJobSpecification_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobSpecification' +type JobSpecificationServiceClient_GetJobSpecification_Call struct { + *mock.Call +} + +// GetJobSpecification is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.GetJobSpecificationRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) GetJobSpecification(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_GetJobSpecification_Call { + return &JobSpecificationServiceClient_GetJobSpecification_Call{Call: _e.mock.On("GetJobSpecification", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_GetJobSpecification_Call) Run(run func(ctx context.Context, in *corev1beta1.GetJobSpecificationRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_GetJobSpecification_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.GetJobSpecificationRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_GetJobSpecification_Call) Return(_a0 *corev1beta1.GetJobSpecificationResponse, _a1 error) *JobSpecificationServiceClient_GetJobSpecification_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_GetJobSpecification_Call) RunAndReturn(run func(context.Context, *corev1beta1.GetJobSpecificationRequest, ...grpc.CallOption) (*corev1beta1.GetJobSpecificationResponse, error)) *JobSpecificationServiceClient_GetJobSpecification_Call { + _c.Call.Return(run) + return _c +} + // GetJobSpecifications provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) GetJobSpecifications(ctx context.Context, in *corev1beta1.GetJobSpecificationsRequest, opts ...grpc.CallOption) (*corev1beta1.GetJobSpecificationsResponse, error) { _va := make([]interface{}, len(opts)) @@ -348,6 +688,43 @@ func (_m *JobSpecificationServiceClient) GetJobSpecifications(ctx context.Contex return r0, r1 } +// JobSpecificationServiceClient_GetJobSpecifications_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobSpecifications' +type JobSpecificationServiceClient_GetJobSpecifications_Call struct { + *mock.Call +} + +// GetJobSpecifications is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.GetJobSpecificationsRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) GetJobSpecifications(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_GetJobSpecifications_Call { + return &JobSpecificationServiceClient_GetJobSpecifications_Call{Call: _e.mock.On("GetJobSpecifications", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_GetJobSpecifications_Call) Run(run func(ctx context.Context, in *corev1beta1.GetJobSpecificationsRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_GetJobSpecifications_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.GetJobSpecificationsRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_GetJobSpecifications_Call) Return(_a0 *corev1beta1.GetJobSpecificationsResponse, _a1 error) *JobSpecificationServiceClient_GetJobSpecifications_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_GetJobSpecifications_Call) RunAndReturn(run func(context.Context, *corev1beta1.GetJobSpecificationsRequest, ...grpc.CallOption) (*corev1beta1.GetJobSpecificationsResponse, error)) *JobSpecificationServiceClient_GetJobSpecifications_Call { + _c.Call.Return(run) + return _c +} + // GetJobTask provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) GetJobTask(ctx context.Context, in *corev1beta1.GetJobTaskRequest, opts ...grpc.CallOption) (*corev1beta1.GetJobTaskResponse, error) { _va := make([]interface{}, len(opts)) @@ -381,6 +758,43 @@ func (_m *JobSpecificationServiceClient) GetJobTask(ctx context.Context, in *cor return r0, r1 } +// JobSpecificationServiceClient_GetJobTask_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobTask' +type JobSpecificationServiceClient_GetJobTask_Call struct { + *mock.Call +} + +// GetJobTask is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.GetJobTaskRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) GetJobTask(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_GetJobTask_Call { + return &JobSpecificationServiceClient_GetJobTask_Call{Call: _e.mock.On("GetJobTask", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_GetJobTask_Call) Run(run func(ctx context.Context, in *corev1beta1.GetJobTaskRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_GetJobTask_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.GetJobTaskRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_GetJobTask_Call) Return(_a0 *corev1beta1.GetJobTaskResponse, _a1 error) *JobSpecificationServiceClient_GetJobTask_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_GetJobTask_Call) RunAndReturn(run func(context.Context, *corev1beta1.GetJobTaskRequest, ...grpc.CallOption) (*corev1beta1.GetJobTaskResponse, error)) *JobSpecificationServiceClient_GetJobTask_Call { + _c.Call.Return(run) + return _c +} + // GetWindow provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) GetWindow(ctx context.Context, in *corev1beta1.GetWindowRequest, opts ...grpc.CallOption) (*corev1beta1.GetWindowResponse, error) { _va := make([]interface{}, len(opts)) @@ -414,6 +828,43 @@ func (_m *JobSpecificationServiceClient) GetWindow(ctx context.Context, in *core return r0, r1 } +// JobSpecificationServiceClient_GetWindow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWindow' +type JobSpecificationServiceClient_GetWindow_Call struct { + *mock.Call +} + +// GetWindow is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.GetWindowRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) GetWindow(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_GetWindow_Call { + return &JobSpecificationServiceClient_GetWindow_Call{Call: _e.mock.On("GetWindow", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_GetWindow_Call) Run(run func(ctx context.Context, in *corev1beta1.GetWindowRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_GetWindow_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.GetWindowRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_GetWindow_Call) Return(_a0 *corev1beta1.GetWindowResponse, _a1 error) *JobSpecificationServiceClient_GetWindow_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_GetWindow_Call) RunAndReturn(run func(context.Context, *corev1beta1.GetWindowRequest, ...grpc.CallOption) (*corev1beta1.GetWindowResponse, error)) *JobSpecificationServiceClient_GetWindow_Call { + _c.Call.Return(run) + return _c +} + // JobInspect provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) JobInspect(ctx context.Context, in *corev1beta1.JobInspectRequest, opts ...grpc.CallOption) (*corev1beta1.JobInspectResponse, error) { _va := make([]interface{}, len(opts)) @@ -447,6 +898,43 @@ func (_m *JobSpecificationServiceClient) JobInspect(ctx context.Context, in *cor return r0, r1 } +// JobSpecificationServiceClient_JobInspect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'JobInspect' +type JobSpecificationServiceClient_JobInspect_Call struct { + *mock.Call +} + +// JobInspect is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.JobInspectRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) JobInspect(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_JobInspect_Call { + return &JobSpecificationServiceClient_JobInspect_Call{Call: _e.mock.On("JobInspect", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_JobInspect_Call) Run(run func(ctx context.Context, in *corev1beta1.JobInspectRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_JobInspect_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.JobInspectRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_JobInspect_Call) Return(_a0 *corev1beta1.JobInspectResponse, _a1 error) *JobSpecificationServiceClient_JobInspect_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_JobInspect_Call) RunAndReturn(run func(context.Context, *corev1beta1.JobInspectRequest, ...grpc.CallOption) (*corev1beta1.JobInspectResponse, error)) *JobSpecificationServiceClient_JobInspect_Call { + _c.Call.Return(run) + return _c +} + // ListJobSpecification provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) ListJobSpecification(ctx context.Context, in *corev1beta1.ListJobSpecificationRequest, opts ...grpc.CallOption) (*corev1beta1.ListJobSpecificationResponse, error) { _va := make([]interface{}, len(opts)) @@ -480,6 +968,43 @@ func (_m *JobSpecificationServiceClient) ListJobSpecification(ctx context.Contex return r0, r1 } +// JobSpecificationServiceClient_ListJobSpecification_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListJobSpecification' +type JobSpecificationServiceClient_ListJobSpecification_Call struct { + *mock.Call +} + +// ListJobSpecification is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.ListJobSpecificationRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) ListJobSpecification(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_ListJobSpecification_Call { + return &JobSpecificationServiceClient_ListJobSpecification_Call{Call: _e.mock.On("ListJobSpecification", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_ListJobSpecification_Call) Run(run func(ctx context.Context, in *corev1beta1.ListJobSpecificationRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_ListJobSpecification_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.ListJobSpecificationRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_ListJobSpecification_Call) Return(_a0 *corev1beta1.ListJobSpecificationResponse, _a1 error) *JobSpecificationServiceClient_ListJobSpecification_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_ListJobSpecification_Call) RunAndReturn(run func(context.Context, *corev1beta1.ListJobSpecificationRequest, ...grpc.CallOption) (*corev1beta1.ListJobSpecificationResponse, error)) *JobSpecificationServiceClient_ListJobSpecification_Call { + _c.Call.Return(run) + return _c +} + // RefreshJobs provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) RefreshJobs(ctx context.Context, in *corev1beta1.RefreshJobsRequest, opts ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_RefreshJobsClient, error) { _va := make([]interface{}, len(opts)) @@ -513,6 +1038,43 @@ func (_m *JobSpecificationServiceClient) RefreshJobs(ctx context.Context, in *co return r0, r1 } +// JobSpecificationServiceClient_RefreshJobs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshJobs' +type JobSpecificationServiceClient_RefreshJobs_Call struct { + *mock.Call +} + +// RefreshJobs is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.RefreshJobsRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) RefreshJobs(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_RefreshJobs_Call { + return &JobSpecificationServiceClient_RefreshJobs_Call{Call: _e.mock.On("RefreshJobs", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_RefreshJobs_Call) Run(run func(ctx context.Context, in *corev1beta1.RefreshJobsRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_RefreshJobs_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.RefreshJobsRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_RefreshJobs_Call) Return(_a0 corev1beta1grpc.JobSpecificationService_RefreshJobsClient, _a1 error) *JobSpecificationServiceClient_RefreshJobs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_RefreshJobs_Call) RunAndReturn(run func(context.Context, *corev1beta1.RefreshJobsRequest, ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_RefreshJobsClient, error)) *JobSpecificationServiceClient_RefreshJobs_Call { + _c.Call.Return(run) + return _c +} + // ReplaceAllJobSpecifications provides a mock function with given fields: ctx, opts func (_m *JobSpecificationServiceClient) ReplaceAllJobSpecifications(ctx context.Context, opts ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_ReplaceAllJobSpecificationsClient, error) { _va := make([]interface{}, len(opts)) @@ -546,6 +1108,42 @@ func (_m *JobSpecificationServiceClient) ReplaceAllJobSpecifications(ctx context return r0, r1 } +// JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReplaceAllJobSpecifications' +type JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call struct { + *mock.Call +} + +// ReplaceAllJobSpecifications is a helper method to define mock.On call +// - ctx context.Context +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) ReplaceAllJobSpecifications(ctx interface{}, opts ...interface{}) *JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call { + return &JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call{Call: _e.mock.On("ReplaceAllJobSpecifications", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call) Run(run func(ctx context.Context, opts ...grpc.CallOption)) *JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call) Return(_a0 corev1beta1grpc.JobSpecificationService_ReplaceAllJobSpecificationsClient, _a1 error) *JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call) RunAndReturn(run func(context.Context, ...grpc.CallOption) (corev1beta1grpc.JobSpecificationService_ReplaceAllJobSpecificationsClient, error)) *JobSpecificationServiceClient_ReplaceAllJobSpecifications_Call { + _c.Call.Return(run) + return _c +} + // SyncJobsState provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) SyncJobsState(ctx context.Context, in *corev1beta1.SyncJobsStateRequest, opts ...grpc.CallOption) (*corev1beta1.SyncJobsStateResponse, error) { _va := make([]interface{}, len(opts)) @@ -579,6 +1177,43 @@ func (_m *JobSpecificationServiceClient) SyncJobsState(ctx context.Context, in * return r0, r1 } +// JobSpecificationServiceClient_SyncJobsState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncJobsState' +type JobSpecificationServiceClient_SyncJobsState_Call struct { + *mock.Call +} + +// SyncJobsState is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.SyncJobsStateRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) SyncJobsState(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_SyncJobsState_Call { + return &JobSpecificationServiceClient_SyncJobsState_Call{Call: _e.mock.On("SyncJobsState", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_SyncJobsState_Call) Run(run func(ctx context.Context, in *corev1beta1.SyncJobsStateRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_SyncJobsState_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.SyncJobsStateRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_SyncJobsState_Call) Return(_a0 *corev1beta1.SyncJobsStateResponse, _a1 error) *JobSpecificationServiceClient_SyncJobsState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_SyncJobsState_Call) RunAndReturn(run func(context.Context, *corev1beta1.SyncJobsStateRequest, ...grpc.CallOption) (*corev1beta1.SyncJobsStateResponse, error)) *JobSpecificationServiceClient_SyncJobsState_Call { + _c.Call.Return(run) + return _c +} + // UpdateJobSpecifications provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) UpdateJobSpecifications(ctx context.Context, in *corev1beta1.UpdateJobSpecificationsRequest, opts ...grpc.CallOption) (*corev1beta1.UpdateJobSpecificationsResponse, error) { _va := make([]interface{}, len(opts)) @@ -612,6 +1247,43 @@ func (_m *JobSpecificationServiceClient) UpdateJobSpecifications(ctx context.Con return r0, r1 } +// JobSpecificationServiceClient_UpdateJobSpecifications_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateJobSpecifications' +type JobSpecificationServiceClient_UpdateJobSpecifications_Call struct { + *mock.Call +} + +// UpdateJobSpecifications is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.UpdateJobSpecificationsRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) UpdateJobSpecifications(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_UpdateJobSpecifications_Call { + return &JobSpecificationServiceClient_UpdateJobSpecifications_Call{Call: _e.mock.On("UpdateJobSpecifications", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_UpdateJobSpecifications_Call) Run(run func(ctx context.Context, in *corev1beta1.UpdateJobSpecificationsRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_UpdateJobSpecifications_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.UpdateJobSpecificationsRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_UpdateJobSpecifications_Call) Return(_a0 *corev1beta1.UpdateJobSpecificationsResponse, _a1 error) *JobSpecificationServiceClient_UpdateJobSpecifications_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_UpdateJobSpecifications_Call) RunAndReturn(run func(context.Context, *corev1beta1.UpdateJobSpecificationsRequest, ...grpc.CallOption) (*corev1beta1.UpdateJobSpecificationsResponse, error)) *JobSpecificationServiceClient_UpdateJobSpecifications_Call { + _c.Call.Return(run) + return _c +} + // UpdateJobsState provides a mock function with given fields: ctx, in, opts func (_m *JobSpecificationServiceClient) UpdateJobsState(ctx context.Context, in *corev1beta1.UpdateJobsStateRequest, opts ...grpc.CallOption) (*corev1beta1.UpdateJobsStateResponse, error) { _va := make([]interface{}, len(opts)) @@ -645,6 +1317,43 @@ func (_m *JobSpecificationServiceClient) UpdateJobsState(ctx context.Context, in return r0, r1 } +// JobSpecificationServiceClient_UpdateJobsState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateJobsState' +type JobSpecificationServiceClient_UpdateJobsState_Call struct { + *mock.Call +} + +// UpdateJobsState is a helper method to define mock.On call +// - ctx context.Context +// - in *corev1beta1.UpdateJobsStateRequest +// - opts ...grpc.CallOption +func (_e *JobSpecificationServiceClient_Expecter) UpdateJobsState(ctx interface{}, in interface{}, opts ...interface{}) *JobSpecificationServiceClient_UpdateJobsState_Call { + return &JobSpecificationServiceClient_UpdateJobsState_Call{Call: _e.mock.On("UpdateJobsState", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *JobSpecificationServiceClient_UpdateJobsState_Call) Run(run func(ctx context.Context, in *corev1beta1.UpdateJobsStateRequest, opts ...grpc.CallOption)) *JobSpecificationServiceClient_UpdateJobsState_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*corev1beta1.UpdateJobsStateRequest), variadicArgs...) + }) + return _c +} + +func (_c *JobSpecificationServiceClient_UpdateJobsState_Call) Return(_a0 *corev1beta1.UpdateJobsStateResponse, _a1 error) *JobSpecificationServiceClient_UpdateJobsState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *JobSpecificationServiceClient_UpdateJobsState_Call) RunAndReturn(run func(context.Context, *corev1beta1.UpdateJobsStateRequest, ...grpc.CallOption) (*corev1beta1.UpdateJobsStateResponse, error)) *JobSpecificationServiceClient_UpdateJobsState_Call { + _c.Call.Return(run) + return _c +} + // NewJobSpecificationServiceClient creates a new instance of JobSpecificationServiceClient. 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 NewJobSpecificationServiceClient(t interface { diff --git a/mocks/ObjectIterator.go b/mocks/ObjectIterator.go index 431e90a..34ae7e4 100644 --- a/mocks/ObjectIterator.go +++ b/mocks/ObjectIterator.go @@ -12,6 +12,14 @@ type ObjectIterator struct { mock.Mock } +type ObjectIterator_Expecter struct { + mock *mock.Mock +} + +func (_m *ObjectIterator) EXPECT() *ObjectIterator_Expecter { + return &ObjectIterator_Expecter{mock: &_m.Mock} +} + // Next provides a mock function with given fields: func (_m *ObjectIterator) Next() (*storage.ObjectAttrs, error) { ret := _m.Called() @@ -38,6 +46,33 @@ func (_m *ObjectIterator) Next() (*storage.ObjectAttrs, error) { return r0, r1 } +// ObjectIterator_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next' +type ObjectIterator_Next_Call struct { + *mock.Call +} + +// Next is a helper method to define mock.On call +func (_e *ObjectIterator_Expecter) Next() *ObjectIterator_Next_Call { + return &ObjectIterator_Next_Call{Call: _e.mock.On("Next")} +} + +func (_c *ObjectIterator_Next_Call) Run(run func()) *ObjectIterator_Next_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ObjectIterator_Next_Call) Return(_a0 *storage.ObjectAttrs, _a1 error) *ObjectIterator_Next_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ObjectIterator_Next_Call) RunAndReturn(run func() (*storage.ObjectAttrs, error)) *ObjectIterator_Next_Call { + _c.Call.Return(run) + return _c +} + // NewObjectIterator creates a new instance of ObjectIterator. 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 NewObjectIterator(t interface { diff --git a/mocks/ResourceServiceClient.go b/mocks/ResourceServiceClient.go index 32bf703..909fd41 100644 --- a/mocks/ResourceServiceClient.go +++ b/mocks/ResourceServiceClient.go @@ -18,6 +18,14 @@ type ResourceServiceClient struct { mock.Mock } +type ResourceServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *ResourceServiceClient) EXPECT() *ResourceServiceClient_Expecter { + return &ResourceServiceClient_Expecter{mock: &_m.Mock} +} + // ApplyAction provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) ApplyAction(ctx context.Context, in *entropyv1beta1.ApplyActionRequest, opts ...grpc.CallOption) (*entropyv1beta1.ApplyActionResponse, error) { _va := make([]interface{}, len(opts)) @@ -51,6 +59,43 @@ func (_m *ResourceServiceClient) ApplyAction(ctx context.Context, in *entropyv1b return r0, r1 } +// ResourceServiceClient_ApplyAction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyAction' +type ResourceServiceClient_ApplyAction_Call struct { + *mock.Call +} + +// ApplyAction is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.ApplyActionRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) ApplyAction(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_ApplyAction_Call { + return &ResourceServiceClient_ApplyAction_Call{Call: _e.mock.On("ApplyAction", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_ApplyAction_Call) Run(run func(ctx context.Context, in *entropyv1beta1.ApplyActionRequest, opts ...grpc.CallOption)) *ResourceServiceClient_ApplyAction_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.ApplyActionRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_ApplyAction_Call) Return(_a0 *entropyv1beta1.ApplyActionResponse, _a1 error) *ResourceServiceClient_ApplyAction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_ApplyAction_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.ApplyActionRequest, ...grpc.CallOption) (*entropyv1beta1.ApplyActionResponse, error)) *ResourceServiceClient_ApplyAction_Call { + _c.Call.Return(run) + return _c +} + // CreateResource provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) CreateResource(ctx context.Context, in *entropyv1beta1.CreateResourceRequest, opts ...grpc.CallOption) (*entropyv1beta1.CreateResourceResponse, error) { _va := make([]interface{}, len(opts)) @@ -84,6 +129,43 @@ func (_m *ResourceServiceClient) CreateResource(ctx context.Context, in *entropy return r0, r1 } +// ResourceServiceClient_CreateResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateResource' +type ResourceServiceClient_CreateResource_Call struct { + *mock.Call +} + +// CreateResource is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.CreateResourceRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) CreateResource(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_CreateResource_Call { + return &ResourceServiceClient_CreateResource_Call{Call: _e.mock.On("CreateResource", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_CreateResource_Call) Run(run func(ctx context.Context, in *entropyv1beta1.CreateResourceRequest, opts ...grpc.CallOption)) *ResourceServiceClient_CreateResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.CreateResourceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_CreateResource_Call) Return(_a0 *entropyv1beta1.CreateResourceResponse, _a1 error) *ResourceServiceClient_CreateResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_CreateResource_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.CreateResourceRequest, ...grpc.CallOption) (*entropyv1beta1.CreateResourceResponse, error)) *ResourceServiceClient_CreateResource_Call { + _c.Call.Return(run) + return _c +} + // DeleteResource provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) DeleteResource(ctx context.Context, in *entropyv1beta1.DeleteResourceRequest, opts ...grpc.CallOption) (*entropyv1beta1.DeleteResourceResponse, error) { _va := make([]interface{}, len(opts)) @@ -117,6 +199,43 @@ func (_m *ResourceServiceClient) DeleteResource(ctx context.Context, in *entropy return r0, r1 } +// ResourceServiceClient_DeleteResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteResource' +type ResourceServiceClient_DeleteResource_Call struct { + *mock.Call +} + +// DeleteResource is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.DeleteResourceRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) DeleteResource(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_DeleteResource_Call { + return &ResourceServiceClient_DeleteResource_Call{Call: _e.mock.On("DeleteResource", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_DeleteResource_Call) Run(run func(ctx context.Context, in *entropyv1beta1.DeleteResourceRequest, opts ...grpc.CallOption)) *ResourceServiceClient_DeleteResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.DeleteResourceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_DeleteResource_Call) Return(_a0 *entropyv1beta1.DeleteResourceResponse, _a1 error) *ResourceServiceClient_DeleteResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_DeleteResource_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.DeleteResourceRequest, ...grpc.CallOption) (*entropyv1beta1.DeleteResourceResponse, error)) *ResourceServiceClient_DeleteResource_Call { + _c.Call.Return(run) + return _c +} + // GetLog provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) GetLog(ctx context.Context, in *entropyv1beta1.GetLogRequest, opts ...grpc.CallOption) (entropyv1beta1grpc.ResourceService_GetLogClient, error) { _va := make([]interface{}, len(opts)) @@ -150,6 +269,43 @@ func (_m *ResourceServiceClient) GetLog(ctx context.Context, in *entropyv1beta1. return r0, r1 } +// ResourceServiceClient_GetLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLog' +type ResourceServiceClient_GetLog_Call struct { + *mock.Call +} + +// GetLog is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.GetLogRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) GetLog(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_GetLog_Call { + return &ResourceServiceClient_GetLog_Call{Call: _e.mock.On("GetLog", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_GetLog_Call) Run(run func(ctx context.Context, in *entropyv1beta1.GetLogRequest, opts ...grpc.CallOption)) *ResourceServiceClient_GetLog_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.GetLogRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_GetLog_Call) Return(_a0 entropyv1beta1grpc.ResourceService_GetLogClient, _a1 error) *ResourceServiceClient_GetLog_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_GetLog_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.GetLogRequest, ...grpc.CallOption) (entropyv1beta1grpc.ResourceService_GetLogClient, error)) *ResourceServiceClient_GetLog_Call { + _c.Call.Return(run) + return _c +} + // GetResource provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) GetResource(ctx context.Context, in *entropyv1beta1.GetResourceRequest, opts ...grpc.CallOption) (*entropyv1beta1.GetResourceResponse, error) { _va := make([]interface{}, len(opts)) @@ -183,6 +339,43 @@ func (_m *ResourceServiceClient) GetResource(ctx context.Context, in *entropyv1b return r0, r1 } +// ResourceServiceClient_GetResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResource' +type ResourceServiceClient_GetResource_Call struct { + *mock.Call +} + +// GetResource is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.GetResourceRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) GetResource(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_GetResource_Call { + return &ResourceServiceClient_GetResource_Call{Call: _e.mock.On("GetResource", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_GetResource_Call) Run(run func(ctx context.Context, in *entropyv1beta1.GetResourceRequest, opts ...grpc.CallOption)) *ResourceServiceClient_GetResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.GetResourceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_GetResource_Call) Return(_a0 *entropyv1beta1.GetResourceResponse, _a1 error) *ResourceServiceClient_GetResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_GetResource_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.GetResourceRequest, ...grpc.CallOption) (*entropyv1beta1.GetResourceResponse, error)) *ResourceServiceClient_GetResource_Call { + _c.Call.Return(run) + return _c +} + // GetResourceRevisions provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) GetResourceRevisions(ctx context.Context, in *entropyv1beta1.GetResourceRevisionsRequest, opts ...grpc.CallOption) (*entropyv1beta1.GetResourceRevisionsResponse, error) { _va := make([]interface{}, len(opts)) @@ -216,6 +409,43 @@ func (_m *ResourceServiceClient) GetResourceRevisions(ctx context.Context, in *e return r0, r1 } +// ResourceServiceClient_GetResourceRevisions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResourceRevisions' +type ResourceServiceClient_GetResourceRevisions_Call struct { + *mock.Call +} + +// GetResourceRevisions is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.GetResourceRevisionsRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) GetResourceRevisions(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_GetResourceRevisions_Call { + return &ResourceServiceClient_GetResourceRevisions_Call{Call: _e.mock.On("GetResourceRevisions", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_GetResourceRevisions_Call) Run(run func(ctx context.Context, in *entropyv1beta1.GetResourceRevisionsRequest, opts ...grpc.CallOption)) *ResourceServiceClient_GetResourceRevisions_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.GetResourceRevisionsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_GetResourceRevisions_Call) Return(_a0 *entropyv1beta1.GetResourceRevisionsResponse, _a1 error) *ResourceServiceClient_GetResourceRevisions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_GetResourceRevisions_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.GetResourceRevisionsRequest, ...grpc.CallOption) (*entropyv1beta1.GetResourceRevisionsResponse, error)) *ResourceServiceClient_GetResourceRevisions_Call { + _c.Call.Return(run) + return _c +} + // ListResources provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) ListResources(ctx context.Context, in *entropyv1beta1.ListResourcesRequest, opts ...grpc.CallOption) (*entropyv1beta1.ListResourcesResponse, error) { _va := make([]interface{}, len(opts)) @@ -249,6 +479,43 @@ func (_m *ResourceServiceClient) ListResources(ctx context.Context, in *entropyv return r0, r1 } +// ResourceServiceClient_ListResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListResources' +type ResourceServiceClient_ListResources_Call struct { + *mock.Call +} + +// ListResources is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.ListResourcesRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) ListResources(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_ListResources_Call { + return &ResourceServiceClient_ListResources_Call{Call: _e.mock.On("ListResources", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_ListResources_Call) Run(run func(ctx context.Context, in *entropyv1beta1.ListResourcesRequest, opts ...grpc.CallOption)) *ResourceServiceClient_ListResources_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.ListResourcesRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_ListResources_Call) Return(_a0 *entropyv1beta1.ListResourcesResponse, _a1 error) *ResourceServiceClient_ListResources_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_ListResources_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.ListResourcesRequest, ...grpc.CallOption) (*entropyv1beta1.ListResourcesResponse, error)) *ResourceServiceClient_ListResources_Call { + _c.Call.Return(run) + return _c +} + // UpdateResource provides a mock function with given fields: ctx, in, opts func (_m *ResourceServiceClient) UpdateResource(ctx context.Context, in *entropyv1beta1.UpdateResourceRequest, opts ...grpc.CallOption) (*entropyv1beta1.UpdateResourceResponse, error) { _va := make([]interface{}, len(opts)) @@ -282,6 +549,43 @@ func (_m *ResourceServiceClient) UpdateResource(ctx context.Context, in *entropy return r0, r1 } +// ResourceServiceClient_UpdateResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateResource' +type ResourceServiceClient_UpdateResource_Call struct { + *mock.Call +} + +// UpdateResource is a helper method to define mock.On call +// - ctx context.Context +// - in *entropyv1beta1.UpdateResourceRequest +// - opts ...grpc.CallOption +func (_e *ResourceServiceClient_Expecter) UpdateResource(ctx interface{}, in interface{}, opts ...interface{}) *ResourceServiceClient_UpdateResource_Call { + return &ResourceServiceClient_UpdateResource_Call{Call: _e.mock.On("UpdateResource", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ResourceServiceClient_UpdateResource_Call) Run(run func(ctx context.Context, in *entropyv1beta1.UpdateResourceRequest, opts ...grpc.CallOption)) *ResourceServiceClient_UpdateResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*entropyv1beta1.UpdateResourceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ResourceServiceClient_UpdateResource_Call) Return(_a0 *entropyv1beta1.UpdateResourceResponse, _a1 error) *ResourceServiceClient_UpdateResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ResourceServiceClient_UpdateResource_Call) RunAndReturn(run func(context.Context, *entropyv1beta1.UpdateResourceRequest, ...grpc.CallOption) (*entropyv1beta1.UpdateResourceResponse, error)) *ResourceServiceClient_UpdateResource_Call { + _c.Call.Return(run) + return _c +} + // NewResourceServiceClient creates a new instance of ResourceServiceClient. 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 NewResourceServiceClient(t interface { diff --git a/mocks/ShieldServiceClient.go b/mocks/ShieldServiceClient.go index 67fc2ea..89e325c 100644 --- a/mocks/ShieldServiceClient.go +++ b/mocks/ShieldServiceClient.go @@ -17,6 +17,14 @@ type ShieldServiceClient struct { mock.Mock } +type ShieldServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *ShieldServiceClient) EXPECT() *ShieldServiceClient_Expecter { + return &ShieldServiceClient_Expecter{mock: &_m.Mock} +} + // CheckResourcePermission provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CheckResourcePermission(ctx context.Context, in *shieldv1beta1.CheckResourcePermissionRequest, opts ...grpc.CallOption) (*shieldv1beta1.CheckResourcePermissionResponse, error) { _va := make([]interface{}, len(opts)) @@ -50,6 +58,43 @@ func (_m *ShieldServiceClient) CheckResourcePermission(ctx context.Context, in * return r0, r1 } +// ShieldServiceClient_CheckResourcePermission_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckResourcePermission' +type ShieldServiceClient_CheckResourcePermission_Call struct { + *mock.Call +} + +// CheckResourcePermission is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CheckResourcePermissionRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CheckResourcePermission(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CheckResourcePermission_Call { + return &ShieldServiceClient_CheckResourcePermission_Call{Call: _e.mock.On("CheckResourcePermission", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CheckResourcePermission_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CheckResourcePermissionRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CheckResourcePermission_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CheckResourcePermissionRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CheckResourcePermission_Call) Return(_a0 *shieldv1beta1.CheckResourcePermissionResponse, _a1 error) *ShieldServiceClient_CheckResourcePermission_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CheckResourcePermission_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CheckResourcePermissionRequest, ...grpc.CallOption) (*shieldv1beta1.CheckResourcePermissionResponse, error)) *ShieldServiceClient_CheckResourcePermission_Call { + _c.Call.Return(run) + return _c +} + // CreateAction provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateAction(ctx context.Context, in *shieldv1beta1.CreateActionRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateActionResponse, error) { _va := make([]interface{}, len(opts)) @@ -83,6 +128,43 @@ func (_m *ShieldServiceClient) CreateAction(ctx context.Context, in *shieldv1bet return r0, r1 } +// ShieldServiceClient_CreateAction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAction' +type ShieldServiceClient_CreateAction_Call struct { + *mock.Call +} + +// CreateAction is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateActionRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateAction(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateAction_Call { + return &ShieldServiceClient_CreateAction_Call{Call: _e.mock.On("CreateAction", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateAction_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateActionRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateAction_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateActionRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateAction_Call) Return(_a0 *shieldv1beta1.CreateActionResponse, _a1 error) *ShieldServiceClient_CreateAction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateAction_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateActionRequest, ...grpc.CallOption) (*shieldv1beta1.CreateActionResponse, error)) *ShieldServiceClient_CreateAction_Call { + _c.Call.Return(run) + return _c +} + // CreateGroup provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateGroup(ctx context.Context, in *shieldv1beta1.CreateGroupRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateGroupResponse, error) { _va := make([]interface{}, len(opts)) @@ -116,6 +198,43 @@ func (_m *ShieldServiceClient) CreateGroup(ctx context.Context, in *shieldv1beta return r0, r1 } +// ShieldServiceClient_CreateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroup' +type ShieldServiceClient_CreateGroup_Call struct { + *mock.Call +} + +// CreateGroup is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateGroupRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateGroup(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateGroup_Call { + return &ShieldServiceClient_CreateGroup_Call{Call: _e.mock.On("CreateGroup", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateGroup_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateGroupRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateGroupRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateGroup_Call) Return(_a0 *shieldv1beta1.CreateGroupResponse, _a1 error) *ShieldServiceClient_CreateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateGroup_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateGroupRequest, ...grpc.CallOption) (*shieldv1beta1.CreateGroupResponse, error)) *ShieldServiceClient_CreateGroup_Call { + _c.Call.Return(run) + return _c +} + // CreateMetadataKey provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateMetadataKey(ctx context.Context, in *shieldv1beta1.CreateMetadataKeyRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateMetadataKeyResponse, error) { _va := make([]interface{}, len(opts)) @@ -149,6 +268,43 @@ func (_m *ShieldServiceClient) CreateMetadataKey(ctx context.Context, in *shield return r0, r1 } +// ShieldServiceClient_CreateMetadataKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateMetadataKey' +type ShieldServiceClient_CreateMetadataKey_Call struct { + *mock.Call +} + +// CreateMetadataKey is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateMetadataKeyRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateMetadataKey(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateMetadataKey_Call { + return &ShieldServiceClient_CreateMetadataKey_Call{Call: _e.mock.On("CreateMetadataKey", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateMetadataKey_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateMetadataKeyRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateMetadataKey_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateMetadataKeyRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateMetadataKey_Call) Return(_a0 *shieldv1beta1.CreateMetadataKeyResponse, _a1 error) *ShieldServiceClient_CreateMetadataKey_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateMetadataKey_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateMetadataKeyRequest, ...grpc.CallOption) (*shieldv1beta1.CreateMetadataKeyResponse, error)) *ShieldServiceClient_CreateMetadataKey_Call { + _c.Call.Return(run) + return _c +} + // CreateNamespace provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateNamespace(ctx context.Context, in *shieldv1beta1.CreateNamespaceRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -182,6 +338,43 @@ func (_m *ShieldServiceClient) CreateNamespace(ctx context.Context, in *shieldv1 return r0, r1 } +// ShieldServiceClient_CreateNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateNamespace' +type ShieldServiceClient_CreateNamespace_Call struct { + *mock.Call +} + +// CreateNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateNamespaceRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateNamespace(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateNamespace_Call { + return &ShieldServiceClient_CreateNamespace_Call{Call: _e.mock.On("CreateNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateNamespace_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateNamespaceRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateNamespace_Call) Return(_a0 *shieldv1beta1.CreateNamespaceResponse, _a1 error) *ShieldServiceClient_CreateNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateNamespace_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateNamespaceRequest, ...grpc.CallOption) (*shieldv1beta1.CreateNamespaceResponse, error)) *ShieldServiceClient_CreateNamespace_Call { + _c.Call.Return(run) + return _c +} + // CreateOrganization provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateOrganization(ctx context.Context, in *shieldv1beta1.CreateOrganizationRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateOrganizationResponse, error) { _va := make([]interface{}, len(opts)) @@ -215,6 +408,43 @@ func (_m *ShieldServiceClient) CreateOrganization(ctx context.Context, in *shiel return r0, r1 } +// ShieldServiceClient_CreateOrganization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateOrganization' +type ShieldServiceClient_CreateOrganization_Call struct { + *mock.Call +} + +// CreateOrganization is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateOrganizationRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateOrganization(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateOrganization_Call { + return &ShieldServiceClient_CreateOrganization_Call{Call: _e.mock.On("CreateOrganization", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateOrganization_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateOrganizationRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateOrganization_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateOrganizationRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateOrganization_Call) Return(_a0 *shieldv1beta1.CreateOrganizationResponse, _a1 error) *ShieldServiceClient_CreateOrganization_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateOrganization_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateOrganizationRequest, ...grpc.CallOption) (*shieldv1beta1.CreateOrganizationResponse, error)) *ShieldServiceClient_CreateOrganization_Call { + _c.Call.Return(run) + return _c +} + // CreatePolicy provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreatePolicy(ctx context.Context, in *shieldv1beta1.CreatePolicyRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreatePolicyResponse, error) { _va := make([]interface{}, len(opts)) @@ -248,6 +478,43 @@ func (_m *ShieldServiceClient) CreatePolicy(ctx context.Context, in *shieldv1bet return r0, r1 } +// ShieldServiceClient_CreatePolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreatePolicy' +type ShieldServiceClient_CreatePolicy_Call struct { + *mock.Call +} + +// CreatePolicy is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreatePolicyRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreatePolicy(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreatePolicy_Call { + return &ShieldServiceClient_CreatePolicy_Call{Call: _e.mock.On("CreatePolicy", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreatePolicy_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreatePolicyRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreatePolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreatePolicyRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreatePolicy_Call) Return(_a0 *shieldv1beta1.CreatePolicyResponse, _a1 error) *ShieldServiceClient_CreatePolicy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreatePolicy_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreatePolicyRequest, ...grpc.CallOption) (*shieldv1beta1.CreatePolicyResponse, error)) *ShieldServiceClient_CreatePolicy_Call { + _c.Call.Return(run) + return _c +} + // CreateProject provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateProject(ctx context.Context, in *shieldv1beta1.CreateProjectRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateProjectResponse, error) { _va := make([]interface{}, len(opts)) @@ -281,6 +548,43 @@ func (_m *ShieldServiceClient) CreateProject(ctx context.Context, in *shieldv1be return r0, r1 } +// ShieldServiceClient_CreateProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateProject' +type ShieldServiceClient_CreateProject_Call struct { + *mock.Call +} + +// CreateProject is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateProjectRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateProject(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateProject_Call { + return &ShieldServiceClient_CreateProject_Call{Call: _e.mock.On("CreateProject", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateProject_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateProjectRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateProject_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateProjectRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateProject_Call) Return(_a0 *shieldv1beta1.CreateProjectResponse, _a1 error) *ShieldServiceClient_CreateProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateProject_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateProjectRequest, ...grpc.CallOption) (*shieldv1beta1.CreateProjectResponse, error)) *ShieldServiceClient_CreateProject_Call { + _c.Call.Return(run) + return _c +} + // CreateRelation provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateRelation(ctx context.Context, in *shieldv1beta1.CreateRelationRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateRelationResponse, error) { _va := make([]interface{}, len(opts)) @@ -314,6 +618,43 @@ func (_m *ShieldServiceClient) CreateRelation(ctx context.Context, in *shieldv1b return r0, r1 } +// ShieldServiceClient_CreateRelation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRelation' +type ShieldServiceClient_CreateRelation_Call struct { + *mock.Call +} + +// CreateRelation is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateRelationRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateRelation(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateRelation_Call { + return &ShieldServiceClient_CreateRelation_Call{Call: _e.mock.On("CreateRelation", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateRelation_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateRelationRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateRelation_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateRelationRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateRelation_Call) Return(_a0 *shieldv1beta1.CreateRelationResponse, _a1 error) *ShieldServiceClient_CreateRelation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateRelation_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateRelationRequest, ...grpc.CallOption) (*shieldv1beta1.CreateRelationResponse, error)) *ShieldServiceClient_CreateRelation_Call { + _c.Call.Return(run) + return _c +} + // CreateResource provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateResource(ctx context.Context, in *shieldv1beta1.CreateResourceRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateResourceResponse, error) { _va := make([]interface{}, len(opts)) @@ -347,6 +688,43 @@ func (_m *ShieldServiceClient) CreateResource(ctx context.Context, in *shieldv1b return r0, r1 } +// ShieldServiceClient_CreateResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateResource' +type ShieldServiceClient_CreateResource_Call struct { + *mock.Call +} + +// CreateResource is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateResourceRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateResource(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateResource_Call { + return &ShieldServiceClient_CreateResource_Call{Call: _e.mock.On("CreateResource", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateResource_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateResourceRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateResourceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateResource_Call) Return(_a0 *shieldv1beta1.CreateResourceResponse, _a1 error) *ShieldServiceClient_CreateResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateResource_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateResourceRequest, ...grpc.CallOption) (*shieldv1beta1.CreateResourceResponse, error)) *ShieldServiceClient_CreateResource_Call { + _c.Call.Return(run) + return _c +} + // CreateRole provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateRole(ctx context.Context, in *shieldv1beta1.CreateRoleRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateRoleResponse, error) { _va := make([]interface{}, len(opts)) @@ -380,6 +758,43 @@ func (_m *ShieldServiceClient) CreateRole(ctx context.Context, in *shieldv1beta1 return r0, r1 } +// ShieldServiceClient_CreateRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRole' +type ShieldServiceClient_CreateRole_Call struct { + *mock.Call +} + +// CreateRole is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateRoleRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateRole(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateRole_Call { + return &ShieldServiceClient_CreateRole_Call{Call: _e.mock.On("CreateRole", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateRole_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateRoleRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateRole_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateRoleRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateRole_Call) Return(_a0 *shieldv1beta1.CreateRoleResponse, _a1 error) *ShieldServiceClient_CreateRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateRole_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateRoleRequest, ...grpc.CallOption) (*shieldv1beta1.CreateRoleResponse, error)) *ShieldServiceClient_CreateRole_Call { + _c.Call.Return(run) + return _c +} + // CreateUser provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) CreateUser(ctx context.Context, in *shieldv1beta1.CreateUserRequest, opts ...grpc.CallOption) (*shieldv1beta1.CreateUserResponse, error) { _va := make([]interface{}, len(opts)) @@ -413,6 +828,43 @@ func (_m *ShieldServiceClient) CreateUser(ctx context.Context, in *shieldv1beta1 return r0, r1 } +// ShieldServiceClient_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser' +type ShieldServiceClient_CreateUser_Call struct { + *mock.Call +} + +// CreateUser is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.CreateUserRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) CreateUser(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_CreateUser_Call { + return &ShieldServiceClient_CreateUser_Call{Call: _e.mock.On("CreateUser", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_CreateUser_Call) Run(run func(ctx context.Context, in *shieldv1beta1.CreateUserRequest, opts ...grpc.CallOption)) *ShieldServiceClient_CreateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.CreateUserRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_CreateUser_Call) Return(_a0 *shieldv1beta1.CreateUserResponse, _a1 error) *ShieldServiceClient_CreateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_CreateUser_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.CreateUserRequest, ...grpc.CallOption) (*shieldv1beta1.CreateUserResponse, error)) *ShieldServiceClient_CreateUser_Call { + _c.Call.Return(run) + return _c +} + // DeleteRelation provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) DeleteRelation(ctx context.Context, in *shieldv1beta1.DeleteRelationRequest, opts ...grpc.CallOption) (*shieldv1beta1.DeleteRelationResponse, error) { _va := make([]interface{}, len(opts)) @@ -446,6 +898,43 @@ func (_m *ShieldServiceClient) DeleteRelation(ctx context.Context, in *shieldv1b return r0, r1 } +// ShieldServiceClient_DeleteRelation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRelation' +type ShieldServiceClient_DeleteRelation_Call struct { + *mock.Call +} + +// DeleteRelation is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.DeleteRelationRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) DeleteRelation(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_DeleteRelation_Call { + return &ShieldServiceClient_DeleteRelation_Call{Call: _e.mock.On("DeleteRelation", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_DeleteRelation_Call) Run(run func(ctx context.Context, in *shieldv1beta1.DeleteRelationRequest, opts ...grpc.CallOption)) *ShieldServiceClient_DeleteRelation_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.DeleteRelationRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_DeleteRelation_Call) Return(_a0 *shieldv1beta1.DeleteRelationResponse, _a1 error) *ShieldServiceClient_DeleteRelation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_DeleteRelation_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.DeleteRelationRequest, ...grpc.CallOption) (*shieldv1beta1.DeleteRelationResponse, error)) *ShieldServiceClient_DeleteRelation_Call { + _c.Call.Return(run) + return _c +} + // GetCurrentUser provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetCurrentUser(ctx context.Context, in *shieldv1beta1.GetCurrentUserRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetCurrentUserResponse, error) { _va := make([]interface{}, len(opts)) @@ -479,6 +968,43 @@ func (_m *ShieldServiceClient) GetCurrentUser(ctx context.Context, in *shieldv1b return r0, r1 } +// ShieldServiceClient_GetCurrentUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrentUser' +type ShieldServiceClient_GetCurrentUser_Call struct { + *mock.Call +} + +// GetCurrentUser is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetCurrentUserRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetCurrentUser(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetCurrentUser_Call { + return &ShieldServiceClient_GetCurrentUser_Call{Call: _e.mock.On("GetCurrentUser", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetCurrentUser_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetCurrentUserRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetCurrentUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetCurrentUserRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetCurrentUser_Call) Return(_a0 *shieldv1beta1.GetCurrentUserResponse, _a1 error) *ShieldServiceClient_GetCurrentUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetCurrentUser_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetCurrentUserRequest, ...grpc.CallOption) (*shieldv1beta1.GetCurrentUserResponse, error)) *ShieldServiceClient_GetCurrentUser_Call { + _c.Call.Return(run) + return _c +} + // GetGroup provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetGroup(ctx context.Context, in *shieldv1beta1.GetGroupRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetGroupResponse, error) { _va := make([]interface{}, len(opts)) @@ -512,6 +1038,43 @@ func (_m *ShieldServiceClient) GetGroup(ctx context.Context, in *shieldv1beta1.G return r0, r1 } +// ShieldServiceClient_GetGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroup' +type ShieldServiceClient_GetGroup_Call struct { + *mock.Call +} + +// GetGroup is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetGroupRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetGroup(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetGroup_Call { + return &ShieldServiceClient_GetGroup_Call{Call: _e.mock.On("GetGroup", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetGroup_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetGroupRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetGroupRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetGroup_Call) Return(_a0 *shieldv1beta1.GetGroupResponse, _a1 error) *ShieldServiceClient_GetGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetGroup_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetGroupRequest, ...grpc.CallOption) (*shieldv1beta1.GetGroupResponse, error)) *ShieldServiceClient_GetGroup_Call { + _c.Call.Return(run) + return _c +} + // GetNamespace provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetNamespace(ctx context.Context, in *shieldv1beta1.GetNamespaceRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -545,6 +1108,43 @@ func (_m *ShieldServiceClient) GetNamespace(ctx context.Context, in *shieldv1bet return r0, r1 } +// ShieldServiceClient_GetNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNamespace' +type ShieldServiceClient_GetNamespace_Call struct { + *mock.Call +} + +// GetNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetNamespaceRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetNamespace(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetNamespace_Call { + return &ShieldServiceClient_GetNamespace_Call{Call: _e.mock.On("GetNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetNamespace_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetNamespaceRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetNamespace_Call) Return(_a0 *shieldv1beta1.GetNamespaceResponse, _a1 error) *ShieldServiceClient_GetNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetNamespace_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetNamespaceRequest, ...grpc.CallOption) (*shieldv1beta1.GetNamespaceResponse, error)) *ShieldServiceClient_GetNamespace_Call { + _c.Call.Return(run) + return _c +} + // GetOrganization provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetOrganization(ctx context.Context, in *shieldv1beta1.GetOrganizationRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetOrganizationResponse, error) { _va := make([]interface{}, len(opts)) @@ -578,6 +1178,43 @@ func (_m *ShieldServiceClient) GetOrganization(ctx context.Context, in *shieldv1 return r0, r1 } +// ShieldServiceClient_GetOrganization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrganization' +type ShieldServiceClient_GetOrganization_Call struct { + *mock.Call +} + +// GetOrganization is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetOrganizationRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetOrganization(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetOrganization_Call { + return &ShieldServiceClient_GetOrganization_Call{Call: _e.mock.On("GetOrganization", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetOrganization_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetOrganizationRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetOrganization_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetOrganizationRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetOrganization_Call) Return(_a0 *shieldv1beta1.GetOrganizationResponse, _a1 error) *ShieldServiceClient_GetOrganization_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetOrganization_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetOrganizationRequest, ...grpc.CallOption) (*shieldv1beta1.GetOrganizationResponse, error)) *ShieldServiceClient_GetOrganization_Call { + _c.Call.Return(run) + return _c +} + // GetProject provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetProject(ctx context.Context, in *shieldv1beta1.GetProjectRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetProjectResponse, error) { _va := make([]interface{}, len(opts)) @@ -611,6 +1248,43 @@ func (_m *ShieldServiceClient) GetProject(ctx context.Context, in *shieldv1beta1 return r0, r1 } +// ShieldServiceClient_GetProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProject' +type ShieldServiceClient_GetProject_Call struct { + *mock.Call +} + +// GetProject is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetProjectRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetProject(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetProject_Call { + return &ShieldServiceClient_GetProject_Call{Call: _e.mock.On("GetProject", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetProject_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetProjectRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetProject_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetProjectRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetProject_Call) Return(_a0 *shieldv1beta1.GetProjectResponse, _a1 error) *ShieldServiceClient_GetProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetProject_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetProjectRequest, ...grpc.CallOption) (*shieldv1beta1.GetProjectResponse, error)) *ShieldServiceClient_GetProject_Call { + _c.Call.Return(run) + return _c +} + // GetRelation provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetRelation(ctx context.Context, in *shieldv1beta1.GetRelationRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetRelationResponse, error) { _va := make([]interface{}, len(opts)) @@ -644,6 +1318,43 @@ func (_m *ShieldServiceClient) GetRelation(ctx context.Context, in *shieldv1beta return r0, r1 } +// ShieldServiceClient_GetRelation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRelation' +type ShieldServiceClient_GetRelation_Call struct { + *mock.Call +} + +// GetRelation is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetRelationRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetRelation(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetRelation_Call { + return &ShieldServiceClient_GetRelation_Call{Call: _e.mock.On("GetRelation", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetRelation_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetRelationRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetRelation_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetRelationRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetRelation_Call) Return(_a0 *shieldv1beta1.GetRelationResponse, _a1 error) *ShieldServiceClient_GetRelation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetRelation_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetRelationRequest, ...grpc.CallOption) (*shieldv1beta1.GetRelationResponse, error)) *ShieldServiceClient_GetRelation_Call { + _c.Call.Return(run) + return _c +} + // GetResource provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetResource(ctx context.Context, in *shieldv1beta1.GetResourceRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetResourceResponse, error) { _va := make([]interface{}, len(opts)) @@ -677,6 +1388,43 @@ func (_m *ShieldServiceClient) GetResource(ctx context.Context, in *shieldv1beta return r0, r1 } +// ShieldServiceClient_GetResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResource' +type ShieldServiceClient_GetResource_Call struct { + *mock.Call +} + +// GetResource is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetResourceRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetResource(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetResource_Call { + return &ShieldServiceClient_GetResource_Call{Call: _e.mock.On("GetResource", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetResource_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetResourceRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetResourceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetResource_Call) Return(_a0 *shieldv1beta1.GetResourceResponse, _a1 error) *ShieldServiceClient_GetResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetResource_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetResourceRequest, ...grpc.CallOption) (*shieldv1beta1.GetResourceResponse, error)) *ShieldServiceClient_GetResource_Call { + _c.Call.Return(run) + return _c +} + // GetUser provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) GetUser(ctx context.Context, in *shieldv1beta1.GetUserRequest, opts ...grpc.CallOption) (*shieldv1beta1.GetUserResponse, error) { _va := make([]interface{}, len(opts)) @@ -710,6 +1458,43 @@ func (_m *ShieldServiceClient) GetUser(ctx context.Context, in *shieldv1beta1.Ge return r0, r1 } +// ShieldServiceClient_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser' +type ShieldServiceClient_GetUser_Call struct { + *mock.Call +} + +// GetUser is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.GetUserRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) GetUser(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_GetUser_Call { + return &ShieldServiceClient_GetUser_Call{Call: _e.mock.On("GetUser", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_GetUser_Call) Run(run func(ctx context.Context, in *shieldv1beta1.GetUserRequest, opts ...grpc.CallOption)) *ShieldServiceClient_GetUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.GetUserRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_GetUser_Call) Return(_a0 *shieldv1beta1.GetUserResponse, _a1 error) *ShieldServiceClient_GetUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_GetUser_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.GetUserRequest, ...grpc.CallOption) (*shieldv1beta1.GetUserResponse, error)) *ShieldServiceClient_GetUser_Call { + _c.Call.Return(run) + return _c +} + // ListActions provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListActions(ctx context.Context, in *shieldv1beta1.ListActionsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListActionsResponse, error) { _va := make([]interface{}, len(opts)) @@ -743,6 +1528,43 @@ func (_m *ShieldServiceClient) ListActions(ctx context.Context, in *shieldv1beta return r0, r1 } +// ShieldServiceClient_ListActions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListActions' +type ShieldServiceClient_ListActions_Call struct { + *mock.Call +} + +// ListActions is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListActionsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListActions(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListActions_Call { + return &ShieldServiceClient_ListActions_Call{Call: _e.mock.On("ListActions", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListActions_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListActionsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListActions_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListActionsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListActions_Call) Return(_a0 *shieldv1beta1.ListActionsResponse, _a1 error) *ShieldServiceClient_ListActions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListActions_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListActionsRequest, ...grpc.CallOption) (*shieldv1beta1.ListActionsResponse, error)) *ShieldServiceClient_ListActions_Call { + _c.Call.Return(run) + return _c +} + // ListGroupRelations provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListGroupRelations(ctx context.Context, in *shieldv1beta1.ListGroupRelationsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListGroupRelationsResponse, error) { _va := make([]interface{}, len(opts)) @@ -776,6 +1598,43 @@ func (_m *ShieldServiceClient) ListGroupRelations(ctx context.Context, in *shiel return r0, r1 } +// ShieldServiceClient_ListGroupRelations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroupRelations' +type ShieldServiceClient_ListGroupRelations_Call struct { + *mock.Call +} + +// ListGroupRelations is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListGroupRelationsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListGroupRelations(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListGroupRelations_Call { + return &ShieldServiceClient_ListGroupRelations_Call{Call: _e.mock.On("ListGroupRelations", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListGroupRelations_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListGroupRelationsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListGroupRelations_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListGroupRelationsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListGroupRelations_Call) Return(_a0 *shieldv1beta1.ListGroupRelationsResponse, _a1 error) *ShieldServiceClient_ListGroupRelations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListGroupRelations_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListGroupRelationsRequest, ...grpc.CallOption) (*shieldv1beta1.ListGroupRelationsResponse, error)) *ShieldServiceClient_ListGroupRelations_Call { + _c.Call.Return(run) + return _c +} + // ListGroups provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListGroups(ctx context.Context, in *shieldv1beta1.ListGroupsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListGroupsResponse, error) { _va := make([]interface{}, len(opts)) @@ -809,6 +1668,43 @@ func (_m *ShieldServiceClient) ListGroups(ctx context.Context, in *shieldv1beta1 return r0, r1 } +// ShieldServiceClient_ListGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroups' +type ShieldServiceClient_ListGroups_Call struct { + *mock.Call +} + +// ListGroups is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListGroupsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListGroups(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListGroups_Call { + return &ShieldServiceClient_ListGroups_Call{Call: _e.mock.On("ListGroups", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListGroups_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListGroupsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListGroups_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListGroupsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListGroups_Call) Return(_a0 *shieldv1beta1.ListGroupsResponse, _a1 error) *ShieldServiceClient_ListGroups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListGroups_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListGroupsRequest, ...grpc.CallOption) (*shieldv1beta1.ListGroupsResponse, error)) *ShieldServiceClient_ListGroups_Call { + _c.Call.Return(run) + return _c +} + // ListNamespaces provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListNamespaces(ctx context.Context, in *shieldv1beta1.ListNamespacesRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListNamespacesResponse, error) { _va := make([]interface{}, len(opts)) @@ -842,6 +1738,43 @@ func (_m *ShieldServiceClient) ListNamespaces(ctx context.Context, in *shieldv1b return r0, r1 } +// ShieldServiceClient_ListNamespaces_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListNamespaces' +type ShieldServiceClient_ListNamespaces_Call struct { + *mock.Call +} + +// ListNamespaces is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListNamespacesRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListNamespaces(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListNamespaces_Call { + return &ShieldServiceClient_ListNamespaces_Call{Call: _e.mock.On("ListNamespaces", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListNamespaces_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListNamespacesRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListNamespaces_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListNamespacesRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListNamespaces_Call) Return(_a0 *shieldv1beta1.ListNamespacesResponse, _a1 error) *ShieldServiceClient_ListNamespaces_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListNamespaces_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListNamespacesRequest, ...grpc.CallOption) (*shieldv1beta1.ListNamespacesResponse, error)) *ShieldServiceClient_ListNamespaces_Call { + _c.Call.Return(run) + return _c +} + // ListOrganizationAdmins provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListOrganizationAdmins(ctx context.Context, in *shieldv1beta1.ListOrganizationAdminsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListOrganizationAdminsResponse, error) { _va := make([]interface{}, len(opts)) @@ -875,6 +1808,43 @@ func (_m *ShieldServiceClient) ListOrganizationAdmins(ctx context.Context, in *s return r0, r1 } +// ShieldServiceClient_ListOrganizationAdmins_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListOrganizationAdmins' +type ShieldServiceClient_ListOrganizationAdmins_Call struct { + *mock.Call +} + +// ListOrganizationAdmins is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListOrganizationAdminsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListOrganizationAdmins(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListOrganizationAdmins_Call { + return &ShieldServiceClient_ListOrganizationAdmins_Call{Call: _e.mock.On("ListOrganizationAdmins", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListOrganizationAdmins_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListOrganizationAdminsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListOrganizationAdmins_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListOrganizationAdminsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListOrganizationAdmins_Call) Return(_a0 *shieldv1beta1.ListOrganizationAdminsResponse, _a1 error) *ShieldServiceClient_ListOrganizationAdmins_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListOrganizationAdmins_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListOrganizationAdminsRequest, ...grpc.CallOption) (*shieldv1beta1.ListOrganizationAdminsResponse, error)) *ShieldServiceClient_ListOrganizationAdmins_Call { + _c.Call.Return(run) + return _c +} + // ListOrganizations provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListOrganizations(ctx context.Context, in *shieldv1beta1.ListOrganizationsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListOrganizationsResponse, error) { _va := make([]interface{}, len(opts)) @@ -908,6 +1878,43 @@ func (_m *ShieldServiceClient) ListOrganizations(ctx context.Context, in *shield return r0, r1 } +// ShieldServiceClient_ListOrganizations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListOrganizations' +type ShieldServiceClient_ListOrganizations_Call struct { + *mock.Call +} + +// ListOrganizations is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListOrganizationsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListOrganizations(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListOrganizations_Call { + return &ShieldServiceClient_ListOrganizations_Call{Call: _e.mock.On("ListOrganizations", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListOrganizations_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListOrganizationsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListOrganizations_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListOrganizationsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListOrganizations_Call) Return(_a0 *shieldv1beta1.ListOrganizationsResponse, _a1 error) *ShieldServiceClient_ListOrganizations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListOrganizations_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListOrganizationsRequest, ...grpc.CallOption) (*shieldv1beta1.ListOrganizationsResponse, error)) *ShieldServiceClient_ListOrganizations_Call { + _c.Call.Return(run) + return _c +} + // ListPolicies provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListPolicies(ctx context.Context, in *shieldv1beta1.ListPoliciesRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListPoliciesResponse, error) { _va := make([]interface{}, len(opts)) @@ -941,6 +1948,43 @@ func (_m *ShieldServiceClient) ListPolicies(ctx context.Context, in *shieldv1bet return r0, r1 } +// ShieldServiceClient_ListPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPolicies' +type ShieldServiceClient_ListPolicies_Call struct { + *mock.Call +} + +// ListPolicies is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListPoliciesRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListPolicies(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListPolicies_Call { + return &ShieldServiceClient_ListPolicies_Call{Call: _e.mock.On("ListPolicies", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListPolicies_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListPoliciesRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListPolicies_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListPoliciesRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListPolicies_Call) Return(_a0 *shieldv1beta1.ListPoliciesResponse, _a1 error) *ShieldServiceClient_ListPolicies_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListPolicies_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListPoliciesRequest, ...grpc.CallOption) (*shieldv1beta1.ListPoliciesResponse, error)) *ShieldServiceClient_ListPolicies_Call { + _c.Call.Return(run) + return _c +} + // ListProjectAdmins provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListProjectAdmins(ctx context.Context, in *shieldv1beta1.ListProjectAdminsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListProjectAdminsResponse, error) { _va := make([]interface{}, len(opts)) @@ -974,6 +2018,43 @@ func (_m *ShieldServiceClient) ListProjectAdmins(ctx context.Context, in *shield return r0, r1 } +// ShieldServiceClient_ListProjectAdmins_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListProjectAdmins' +type ShieldServiceClient_ListProjectAdmins_Call struct { + *mock.Call +} + +// ListProjectAdmins is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListProjectAdminsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListProjectAdmins(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListProjectAdmins_Call { + return &ShieldServiceClient_ListProjectAdmins_Call{Call: _e.mock.On("ListProjectAdmins", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListProjectAdmins_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListProjectAdminsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListProjectAdmins_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListProjectAdminsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListProjectAdmins_Call) Return(_a0 *shieldv1beta1.ListProjectAdminsResponse, _a1 error) *ShieldServiceClient_ListProjectAdmins_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListProjectAdmins_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListProjectAdminsRequest, ...grpc.CallOption) (*shieldv1beta1.ListProjectAdminsResponse, error)) *ShieldServiceClient_ListProjectAdmins_Call { + _c.Call.Return(run) + return _c +} + // ListProjects provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListProjects(ctx context.Context, in *shieldv1beta1.ListProjectsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListProjectsResponse, error) { _va := make([]interface{}, len(opts)) @@ -1007,6 +2088,43 @@ func (_m *ShieldServiceClient) ListProjects(ctx context.Context, in *shieldv1bet return r0, r1 } +// ShieldServiceClient_ListProjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListProjects' +type ShieldServiceClient_ListProjects_Call struct { + *mock.Call +} + +// ListProjects is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListProjectsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListProjects(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListProjects_Call { + return &ShieldServiceClient_ListProjects_Call{Call: _e.mock.On("ListProjects", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListProjects_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListProjectsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListProjects_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListProjectsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListProjects_Call) Return(_a0 *shieldv1beta1.ListProjectsResponse, _a1 error) *ShieldServiceClient_ListProjects_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListProjects_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListProjectsRequest, ...grpc.CallOption) (*shieldv1beta1.ListProjectsResponse, error)) *ShieldServiceClient_ListProjects_Call { + _c.Call.Return(run) + return _c +} + // ListRelations provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListRelations(ctx context.Context, in *shieldv1beta1.ListRelationsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListRelationsResponse, error) { _va := make([]interface{}, len(opts)) @@ -1040,6 +2158,43 @@ func (_m *ShieldServiceClient) ListRelations(ctx context.Context, in *shieldv1be return r0, r1 } +// ShieldServiceClient_ListRelations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRelations' +type ShieldServiceClient_ListRelations_Call struct { + *mock.Call +} + +// ListRelations is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListRelationsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListRelations(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListRelations_Call { + return &ShieldServiceClient_ListRelations_Call{Call: _e.mock.On("ListRelations", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListRelations_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListRelationsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListRelations_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListRelationsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListRelations_Call) Return(_a0 *shieldv1beta1.ListRelationsResponse, _a1 error) *ShieldServiceClient_ListRelations_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListRelations_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListRelationsRequest, ...grpc.CallOption) (*shieldv1beta1.ListRelationsResponse, error)) *ShieldServiceClient_ListRelations_Call { + _c.Call.Return(run) + return _c +} + // ListResources provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListResources(ctx context.Context, in *shieldv1beta1.ListResourcesRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListResourcesResponse, error) { _va := make([]interface{}, len(opts)) @@ -1073,6 +2228,43 @@ func (_m *ShieldServiceClient) ListResources(ctx context.Context, in *shieldv1be return r0, r1 } +// ShieldServiceClient_ListResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListResources' +type ShieldServiceClient_ListResources_Call struct { + *mock.Call +} + +// ListResources is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListResourcesRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListResources(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListResources_Call { + return &ShieldServiceClient_ListResources_Call{Call: _e.mock.On("ListResources", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListResources_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListResourcesRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListResources_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListResourcesRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListResources_Call) Return(_a0 *shieldv1beta1.ListResourcesResponse, _a1 error) *ShieldServiceClient_ListResources_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListResources_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListResourcesRequest, ...grpc.CallOption) (*shieldv1beta1.ListResourcesResponse, error)) *ShieldServiceClient_ListResources_Call { + _c.Call.Return(run) + return _c +} + // ListRoles provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListRoles(ctx context.Context, in *shieldv1beta1.ListRolesRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListRolesResponse, error) { _va := make([]interface{}, len(opts)) @@ -1106,6 +2298,43 @@ func (_m *ShieldServiceClient) ListRoles(ctx context.Context, in *shieldv1beta1. return r0, r1 } +// ShieldServiceClient_ListRoles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoles' +type ShieldServiceClient_ListRoles_Call struct { + *mock.Call +} + +// ListRoles is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListRolesRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListRoles(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListRoles_Call { + return &ShieldServiceClient_ListRoles_Call{Call: _e.mock.On("ListRoles", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListRoles_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListRolesRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListRoles_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListRolesRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListRoles_Call) Return(_a0 *shieldv1beta1.ListRolesResponse, _a1 error) *ShieldServiceClient_ListRoles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListRoles_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListRolesRequest, ...grpc.CallOption) (*shieldv1beta1.ListRolesResponse, error)) *ShieldServiceClient_ListRoles_Call { + _c.Call.Return(run) + return _c +} + // ListUserGroups provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListUserGroups(ctx context.Context, in *shieldv1beta1.ListUserGroupsRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListUserGroupsResponse, error) { _va := make([]interface{}, len(opts)) @@ -1139,6 +2368,43 @@ func (_m *ShieldServiceClient) ListUserGroups(ctx context.Context, in *shieldv1b return r0, r1 } +// ShieldServiceClient_ListUserGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUserGroups' +type ShieldServiceClient_ListUserGroups_Call struct { + *mock.Call +} + +// ListUserGroups is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListUserGroupsRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListUserGroups(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListUserGroups_Call { + return &ShieldServiceClient_ListUserGroups_Call{Call: _e.mock.On("ListUserGroups", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListUserGroups_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListUserGroupsRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListUserGroups_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListUserGroupsRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListUserGroups_Call) Return(_a0 *shieldv1beta1.ListUserGroupsResponse, _a1 error) *ShieldServiceClient_ListUserGroups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListUserGroups_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListUserGroupsRequest, ...grpc.CallOption) (*shieldv1beta1.ListUserGroupsResponse, error)) *ShieldServiceClient_ListUserGroups_Call { + _c.Call.Return(run) + return _c +} + // ListUsers provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) ListUsers(ctx context.Context, in *shieldv1beta1.ListUsersRequest, opts ...grpc.CallOption) (*shieldv1beta1.ListUsersResponse, error) { _va := make([]interface{}, len(opts)) @@ -1172,6 +2438,43 @@ func (_m *ShieldServiceClient) ListUsers(ctx context.Context, in *shieldv1beta1. return r0, r1 } +// ShieldServiceClient_ListUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUsers' +type ShieldServiceClient_ListUsers_Call struct { + *mock.Call +} + +// ListUsers is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.ListUsersRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) ListUsers(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_ListUsers_Call { + return &ShieldServiceClient_ListUsers_Call{Call: _e.mock.On("ListUsers", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_ListUsers_Call) Run(run func(ctx context.Context, in *shieldv1beta1.ListUsersRequest, opts ...grpc.CallOption)) *ShieldServiceClient_ListUsers_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.ListUsersRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_ListUsers_Call) Return(_a0 *shieldv1beta1.ListUsersResponse, _a1 error) *ShieldServiceClient_ListUsers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_ListUsers_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.ListUsersRequest, ...grpc.CallOption) (*shieldv1beta1.ListUsersResponse, error)) *ShieldServiceClient_ListUsers_Call { + _c.Call.Return(run) + return _c +} + // UpdateCurrentUser provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) UpdateCurrentUser(ctx context.Context, in *shieldv1beta1.UpdateCurrentUserRequest, opts ...grpc.CallOption) (*shieldv1beta1.UpdateCurrentUserResponse, error) { _va := make([]interface{}, len(opts)) @@ -1205,6 +2508,43 @@ func (_m *ShieldServiceClient) UpdateCurrentUser(ctx context.Context, in *shield return r0, r1 } +// ShieldServiceClient_UpdateCurrentUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCurrentUser' +type ShieldServiceClient_UpdateCurrentUser_Call struct { + *mock.Call +} + +// UpdateCurrentUser is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.UpdateCurrentUserRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) UpdateCurrentUser(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_UpdateCurrentUser_Call { + return &ShieldServiceClient_UpdateCurrentUser_Call{Call: _e.mock.On("UpdateCurrentUser", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_UpdateCurrentUser_Call) Run(run func(ctx context.Context, in *shieldv1beta1.UpdateCurrentUserRequest, opts ...grpc.CallOption)) *ShieldServiceClient_UpdateCurrentUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.UpdateCurrentUserRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_UpdateCurrentUser_Call) Return(_a0 *shieldv1beta1.UpdateCurrentUserResponse, _a1 error) *ShieldServiceClient_UpdateCurrentUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_UpdateCurrentUser_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.UpdateCurrentUserRequest, ...grpc.CallOption) (*shieldv1beta1.UpdateCurrentUserResponse, error)) *ShieldServiceClient_UpdateCurrentUser_Call { + _c.Call.Return(run) + return _c +} + // UpdateGroup provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) UpdateGroup(ctx context.Context, in *shieldv1beta1.UpdateGroupRequest, opts ...grpc.CallOption) (*shieldv1beta1.UpdateGroupResponse, error) { _va := make([]interface{}, len(opts)) @@ -1238,6 +2578,43 @@ func (_m *ShieldServiceClient) UpdateGroup(ctx context.Context, in *shieldv1beta return r0, r1 } +// ShieldServiceClient_UpdateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroup' +type ShieldServiceClient_UpdateGroup_Call struct { + *mock.Call +} + +// UpdateGroup is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.UpdateGroupRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) UpdateGroup(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_UpdateGroup_Call { + return &ShieldServiceClient_UpdateGroup_Call{Call: _e.mock.On("UpdateGroup", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_UpdateGroup_Call) Run(run func(ctx context.Context, in *shieldv1beta1.UpdateGroupRequest, opts ...grpc.CallOption)) *ShieldServiceClient_UpdateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.UpdateGroupRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_UpdateGroup_Call) Return(_a0 *shieldv1beta1.UpdateGroupResponse, _a1 error) *ShieldServiceClient_UpdateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_UpdateGroup_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.UpdateGroupRequest, ...grpc.CallOption) (*shieldv1beta1.UpdateGroupResponse, error)) *ShieldServiceClient_UpdateGroup_Call { + _c.Call.Return(run) + return _c +} + // UpdateNamespace provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) UpdateNamespace(ctx context.Context, in *shieldv1beta1.UpdateNamespaceRequest, opts ...grpc.CallOption) (*shieldv1beta1.UpdateNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -1271,6 +2648,43 @@ func (_m *ShieldServiceClient) UpdateNamespace(ctx context.Context, in *shieldv1 return r0, r1 } +// ShieldServiceClient_UpdateNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNamespace' +type ShieldServiceClient_UpdateNamespace_Call struct { + *mock.Call +} + +// UpdateNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.UpdateNamespaceRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) UpdateNamespace(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_UpdateNamespace_Call { + return &ShieldServiceClient_UpdateNamespace_Call{Call: _e.mock.On("UpdateNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_UpdateNamespace_Call) Run(run func(ctx context.Context, in *shieldv1beta1.UpdateNamespaceRequest, opts ...grpc.CallOption)) *ShieldServiceClient_UpdateNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.UpdateNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_UpdateNamespace_Call) Return(_a0 *shieldv1beta1.UpdateNamespaceResponse, _a1 error) *ShieldServiceClient_UpdateNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_UpdateNamespace_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.UpdateNamespaceRequest, ...grpc.CallOption) (*shieldv1beta1.UpdateNamespaceResponse, error)) *ShieldServiceClient_UpdateNamespace_Call { + _c.Call.Return(run) + return _c +} + // UpdateOrganization provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) UpdateOrganization(ctx context.Context, in *shieldv1beta1.UpdateOrganizationRequest, opts ...grpc.CallOption) (*shieldv1beta1.UpdateOrganizationResponse, error) { _va := make([]interface{}, len(opts)) @@ -1304,6 +2718,43 @@ func (_m *ShieldServiceClient) UpdateOrganization(ctx context.Context, in *shiel return r0, r1 } +// ShieldServiceClient_UpdateOrganization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateOrganization' +type ShieldServiceClient_UpdateOrganization_Call struct { + *mock.Call +} + +// UpdateOrganization is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.UpdateOrganizationRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) UpdateOrganization(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_UpdateOrganization_Call { + return &ShieldServiceClient_UpdateOrganization_Call{Call: _e.mock.On("UpdateOrganization", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_UpdateOrganization_Call) Run(run func(ctx context.Context, in *shieldv1beta1.UpdateOrganizationRequest, opts ...grpc.CallOption)) *ShieldServiceClient_UpdateOrganization_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.UpdateOrganizationRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_UpdateOrganization_Call) Return(_a0 *shieldv1beta1.UpdateOrganizationResponse, _a1 error) *ShieldServiceClient_UpdateOrganization_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_UpdateOrganization_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.UpdateOrganizationRequest, ...grpc.CallOption) (*shieldv1beta1.UpdateOrganizationResponse, error)) *ShieldServiceClient_UpdateOrganization_Call { + _c.Call.Return(run) + return _c +} + // UpdateProject provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) UpdateProject(ctx context.Context, in *shieldv1beta1.UpdateProjectRequest, opts ...grpc.CallOption) (*shieldv1beta1.UpdateProjectResponse, error) { _va := make([]interface{}, len(opts)) @@ -1337,6 +2788,43 @@ func (_m *ShieldServiceClient) UpdateProject(ctx context.Context, in *shieldv1be return r0, r1 } +// ShieldServiceClient_UpdateProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateProject' +type ShieldServiceClient_UpdateProject_Call struct { + *mock.Call +} + +// UpdateProject is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.UpdateProjectRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) UpdateProject(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_UpdateProject_Call { + return &ShieldServiceClient_UpdateProject_Call{Call: _e.mock.On("UpdateProject", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_UpdateProject_Call) Run(run func(ctx context.Context, in *shieldv1beta1.UpdateProjectRequest, opts ...grpc.CallOption)) *ShieldServiceClient_UpdateProject_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.UpdateProjectRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_UpdateProject_Call) Return(_a0 *shieldv1beta1.UpdateProjectResponse, _a1 error) *ShieldServiceClient_UpdateProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_UpdateProject_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.UpdateProjectRequest, ...grpc.CallOption) (*shieldv1beta1.UpdateProjectResponse, error)) *ShieldServiceClient_UpdateProject_Call { + _c.Call.Return(run) + return _c +} + // UpdateResource provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) UpdateResource(ctx context.Context, in *shieldv1beta1.UpdateResourceRequest, opts ...grpc.CallOption) (*shieldv1beta1.UpdateResourceResponse, error) { _va := make([]interface{}, len(opts)) @@ -1370,6 +2858,43 @@ func (_m *ShieldServiceClient) UpdateResource(ctx context.Context, in *shieldv1b return r0, r1 } +// ShieldServiceClient_UpdateResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateResource' +type ShieldServiceClient_UpdateResource_Call struct { + *mock.Call +} + +// UpdateResource is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.UpdateResourceRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) UpdateResource(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_UpdateResource_Call { + return &ShieldServiceClient_UpdateResource_Call{Call: _e.mock.On("UpdateResource", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_UpdateResource_Call) Run(run func(ctx context.Context, in *shieldv1beta1.UpdateResourceRequest, opts ...grpc.CallOption)) *ShieldServiceClient_UpdateResource_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.UpdateResourceRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_UpdateResource_Call) Return(_a0 *shieldv1beta1.UpdateResourceResponse, _a1 error) *ShieldServiceClient_UpdateResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_UpdateResource_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.UpdateResourceRequest, ...grpc.CallOption) (*shieldv1beta1.UpdateResourceResponse, error)) *ShieldServiceClient_UpdateResource_Call { + _c.Call.Return(run) + return _c +} + // UpdateUser provides a mock function with given fields: ctx, in, opts func (_m *ShieldServiceClient) UpdateUser(ctx context.Context, in *shieldv1beta1.UpdateUserRequest, opts ...grpc.CallOption) (*shieldv1beta1.UpdateUserResponse, error) { _va := make([]interface{}, len(opts)) @@ -1403,6 +2928,43 @@ func (_m *ShieldServiceClient) UpdateUser(ctx context.Context, in *shieldv1beta1 return r0, r1 } +// ShieldServiceClient_UpdateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUser' +type ShieldServiceClient_UpdateUser_Call struct { + *mock.Call +} + +// UpdateUser is a helper method to define mock.On call +// - ctx context.Context +// - in *shieldv1beta1.UpdateUserRequest +// - opts ...grpc.CallOption +func (_e *ShieldServiceClient_Expecter) UpdateUser(ctx interface{}, in interface{}, opts ...interface{}) *ShieldServiceClient_UpdateUser_Call { + return &ShieldServiceClient_UpdateUser_Call{Call: _e.mock.On("UpdateUser", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ShieldServiceClient_UpdateUser_Call) Run(run func(ctx context.Context, in *shieldv1beta1.UpdateUserRequest, opts ...grpc.CallOption)) *ShieldServiceClient_UpdateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*shieldv1beta1.UpdateUserRequest), variadicArgs...) + }) + return _c +} + +func (_c *ShieldServiceClient_UpdateUser_Call) Return(_a0 *shieldv1beta1.UpdateUserResponse, _a1 error) *ShieldServiceClient_UpdateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ShieldServiceClient_UpdateUser_Call) RunAndReturn(run func(context.Context, *shieldv1beta1.UpdateUserRequest, ...grpc.CallOption) (*shieldv1beta1.UpdateUserResponse, error)) *ShieldServiceClient_UpdateUser_Call { + _c.Call.Return(run) + return _c +} + // NewShieldServiceClient creates a new instance of ShieldServiceClient. 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 NewShieldServiceClient(t interface { diff --git a/mocks/SirenServiceClient.go b/mocks/SirenServiceClient.go index 2687e09..cc14604 100644 --- a/mocks/SirenServiceClient.go +++ b/mocks/SirenServiceClient.go @@ -17,6 +17,14 @@ type SirenServiceClient struct { mock.Mock } +type SirenServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *SirenServiceClient) EXPECT() *SirenServiceClient_Expecter { + return &SirenServiceClient_Expecter{mock: &_m.Mock} +} + // CreateAlerts provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) CreateAlerts(ctx context.Context, in *sirenv1beta1.CreateAlertsRequest, opts ...grpc.CallOption) (*sirenv1beta1.CreateAlertsResponse, error) { _va := make([]interface{}, len(opts)) @@ -50,6 +58,43 @@ func (_m *SirenServiceClient) CreateAlerts(ctx context.Context, in *sirenv1beta1 return r0, r1 } +// SirenServiceClient_CreateAlerts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAlerts' +type SirenServiceClient_CreateAlerts_Call struct { + *mock.Call +} + +// CreateAlerts is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.CreateAlertsRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) CreateAlerts(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_CreateAlerts_Call { + return &SirenServiceClient_CreateAlerts_Call{Call: _e.mock.On("CreateAlerts", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_CreateAlerts_Call) Run(run func(ctx context.Context, in *sirenv1beta1.CreateAlertsRequest, opts ...grpc.CallOption)) *SirenServiceClient_CreateAlerts_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.CreateAlertsRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_CreateAlerts_Call) Return(_a0 *sirenv1beta1.CreateAlertsResponse, _a1 error) *SirenServiceClient_CreateAlerts_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_CreateAlerts_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.CreateAlertsRequest, ...grpc.CallOption) (*sirenv1beta1.CreateAlertsResponse, error)) *SirenServiceClient_CreateAlerts_Call { + _c.Call.Return(run) + return _c +} + // CreateAlertsWithNamespace provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) CreateAlertsWithNamespace(ctx context.Context, in *sirenv1beta1.CreateAlertsWithNamespaceRequest, opts ...grpc.CallOption) (*sirenv1beta1.CreateAlertsWithNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -83,6 +128,43 @@ func (_m *SirenServiceClient) CreateAlertsWithNamespace(ctx context.Context, in return r0, r1 } +// SirenServiceClient_CreateAlertsWithNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAlertsWithNamespace' +type SirenServiceClient_CreateAlertsWithNamespace_Call struct { + *mock.Call +} + +// CreateAlertsWithNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.CreateAlertsWithNamespaceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) CreateAlertsWithNamespace(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_CreateAlertsWithNamespace_Call { + return &SirenServiceClient_CreateAlertsWithNamespace_Call{Call: _e.mock.On("CreateAlertsWithNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_CreateAlertsWithNamespace_Call) Run(run func(ctx context.Context, in *sirenv1beta1.CreateAlertsWithNamespaceRequest, opts ...grpc.CallOption)) *SirenServiceClient_CreateAlertsWithNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.CreateAlertsWithNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_CreateAlertsWithNamespace_Call) Return(_a0 *sirenv1beta1.CreateAlertsWithNamespaceResponse, _a1 error) *SirenServiceClient_CreateAlertsWithNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_CreateAlertsWithNamespace_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.CreateAlertsWithNamespaceRequest, ...grpc.CallOption) (*sirenv1beta1.CreateAlertsWithNamespaceResponse, error)) *SirenServiceClient_CreateAlertsWithNamespace_Call { + _c.Call.Return(run) + return _c +} + // CreateNamespace provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) CreateNamespace(ctx context.Context, in *sirenv1beta1.CreateNamespaceRequest, opts ...grpc.CallOption) (*sirenv1beta1.CreateNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -116,6 +198,43 @@ func (_m *SirenServiceClient) CreateNamespace(ctx context.Context, in *sirenv1be return r0, r1 } +// SirenServiceClient_CreateNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateNamespace' +type SirenServiceClient_CreateNamespace_Call struct { + *mock.Call +} + +// CreateNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.CreateNamespaceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) CreateNamespace(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_CreateNamespace_Call { + return &SirenServiceClient_CreateNamespace_Call{Call: _e.mock.On("CreateNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_CreateNamespace_Call) Run(run func(ctx context.Context, in *sirenv1beta1.CreateNamespaceRequest, opts ...grpc.CallOption)) *SirenServiceClient_CreateNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.CreateNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_CreateNamespace_Call) Return(_a0 *sirenv1beta1.CreateNamespaceResponse, _a1 error) *SirenServiceClient_CreateNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_CreateNamespace_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.CreateNamespaceRequest, ...grpc.CallOption) (*sirenv1beta1.CreateNamespaceResponse, error)) *SirenServiceClient_CreateNamespace_Call { + _c.Call.Return(run) + return _c +} + // CreateProvider provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) CreateProvider(ctx context.Context, in *sirenv1beta1.CreateProviderRequest, opts ...grpc.CallOption) (*sirenv1beta1.CreateProviderResponse, error) { _va := make([]interface{}, len(opts)) @@ -149,6 +268,43 @@ func (_m *SirenServiceClient) CreateProvider(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_CreateProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateProvider' +type SirenServiceClient_CreateProvider_Call struct { + *mock.Call +} + +// CreateProvider is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.CreateProviderRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) CreateProvider(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_CreateProvider_Call { + return &SirenServiceClient_CreateProvider_Call{Call: _e.mock.On("CreateProvider", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_CreateProvider_Call) Run(run func(ctx context.Context, in *sirenv1beta1.CreateProviderRequest, opts ...grpc.CallOption)) *SirenServiceClient_CreateProvider_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.CreateProviderRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_CreateProvider_Call) Return(_a0 *sirenv1beta1.CreateProviderResponse, _a1 error) *SirenServiceClient_CreateProvider_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_CreateProvider_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.CreateProviderRequest, ...grpc.CallOption) (*sirenv1beta1.CreateProviderResponse, error)) *SirenServiceClient_CreateProvider_Call { + _c.Call.Return(run) + return _c +} + // CreateReceiver provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) CreateReceiver(ctx context.Context, in *sirenv1beta1.CreateReceiverRequest, opts ...grpc.CallOption) (*sirenv1beta1.CreateReceiverResponse, error) { _va := make([]interface{}, len(opts)) @@ -182,6 +338,43 @@ func (_m *SirenServiceClient) CreateReceiver(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_CreateReceiver_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateReceiver' +type SirenServiceClient_CreateReceiver_Call struct { + *mock.Call +} + +// CreateReceiver is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.CreateReceiverRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) CreateReceiver(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_CreateReceiver_Call { + return &SirenServiceClient_CreateReceiver_Call{Call: _e.mock.On("CreateReceiver", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_CreateReceiver_Call) Run(run func(ctx context.Context, in *sirenv1beta1.CreateReceiverRequest, opts ...grpc.CallOption)) *SirenServiceClient_CreateReceiver_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.CreateReceiverRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_CreateReceiver_Call) Return(_a0 *sirenv1beta1.CreateReceiverResponse, _a1 error) *SirenServiceClient_CreateReceiver_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_CreateReceiver_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.CreateReceiverRequest, ...grpc.CallOption) (*sirenv1beta1.CreateReceiverResponse, error)) *SirenServiceClient_CreateReceiver_Call { + _c.Call.Return(run) + return _c +} + // CreateSilence provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) CreateSilence(ctx context.Context, in *sirenv1beta1.CreateSilenceRequest, opts ...grpc.CallOption) (*sirenv1beta1.CreateSilenceResponse, error) { _va := make([]interface{}, len(opts)) @@ -215,6 +408,43 @@ func (_m *SirenServiceClient) CreateSilence(ctx context.Context, in *sirenv1beta return r0, r1 } +// SirenServiceClient_CreateSilence_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSilence' +type SirenServiceClient_CreateSilence_Call struct { + *mock.Call +} + +// CreateSilence is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.CreateSilenceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) CreateSilence(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_CreateSilence_Call { + return &SirenServiceClient_CreateSilence_Call{Call: _e.mock.On("CreateSilence", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_CreateSilence_Call) Run(run func(ctx context.Context, in *sirenv1beta1.CreateSilenceRequest, opts ...grpc.CallOption)) *SirenServiceClient_CreateSilence_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.CreateSilenceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_CreateSilence_Call) Return(_a0 *sirenv1beta1.CreateSilenceResponse, _a1 error) *SirenServiceClient_CreateSilence_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_CreateSilence_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.CreateSilenceRequest, ...grpc.CallOption) (*sirenv1beta1.CreateSilenceResponse, error)) *SirenServiceClient_CreateSilence_Call { + _c.Call.Return(run) + return _c +} + // CreateSubscription provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) CreateSubscription(ctx context.Context, in *sirenv1beta1.CreateSubscriptionRequest, opts ...grpc.CallOption) (*sirenv1beta1.CreateSubscriptionResponse, error) { _va := make([]interface{}, len(opts)) @@ -248,6 +478,43 @@ func (_m *SirenServiceClient) CreateSubscription(ctx context.Context, in *sirenv return r0, r1 } +// SirenServiceClient_CreateSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSubscription' +type SirenServiceClient_CreateSubscription_Call struct { + *mock.Call +} + +// CreateSubscription is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.CreateSubscriptionRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) CreateSubscription(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_CreateSubscription_Call { + return &SirenServiceClient_CreateSubscription_Call{Call: _e.mock.On("CreateSubscription", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_CreateSubscription_Call) Run(run func(ctx context.Context, in *sirenv1beta1.CreateSubscriptionRequest, opts ...grpc.CallOption)) *SirenServiceClient_CreateSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.CreateSubscriptionRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_CreateSubscription_Call) Return(_a0 *sirenv1beta1.CreateSubscriptionResponse, _a1 error) *SirenServiceClient_CreateSubscription_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_CreateSubscription_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.CreateSubscriptionRequest, ...grpc.CallOption) (*sirenv1beta1.CreateSubscriptionResponse, error)) *SirenServiceClient_CreateSubscription_Call { + _c.Call.Return(run) + return _c +} + // DeleteNamespace provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) DeleteNamespace(ctx context.Context, in *sirenv1beta1.DeleteNamespaceRequest, opts ...grpc.CallOption) (*sirenv1beta1.DeleteNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -281,6 +548,43 @@ func (_m *SirenServiceClient) DeleteNamespace(ctx context.Context, in *sirenv1be return r0, r1 } +// SirenServiceClient_DeleteNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteNamespace' +type SirenServiceClient_DeleteNamespace_Call struct { + *mock.Call +} + +// DeleteNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.DeleteNamespaceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) DeleteNamespace(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_DeleteNamespace_Call { + return &SirenServiceClient_DeleteNamespace_Call{Call: _e.mock.On("DeleteNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_DeleteNamespace_Call) Run(run func(ctx context.Context, in *sirenv1beta1.DeleteNamespaceRequest, opts ...grpc.CallOption)) *SirenServiceClient_DeleteNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.DeleteNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_DeleteNamespace_Call) Return(_a0 *sirenv1beta1.DeleteNamespaceResponse, _a1 error) *SirenServiceClient_DeleteNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_DeleteNamespace_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.DeleteNamespaceRequest, ...grpc.CallOption) (*sirenv1beta1.DeleteNamespaceResponse, error)) *SirenServiceClient_DeleteNamespace_Call { + _c.Call.Return(run) + return _c +} + // DeleteProvider provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) DeleteProvider(ctx context.Context, in *sirenv1beta1.DeleteProviderRequest, opts ...grpc.CallOption) (*sirenv1beta1.DeleteProviderResponse, error) { _va := make([]interface{}, len(opts)) @@ -314,6 +618,43 @@ func (_m *SirenServiceClient) DeleteProvider(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_DeleteProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteProvider' +type SirenServiceClient_DeleteProvider_Call struct { + *mock.Call +} + +// DeleteProvider is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.DeleteProviderRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) DeleteProvider(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_DeleteProvider_Call { + return &SirenServiceClient_DeleteProvider_Call{Call: _e.mock.On("DeleteProvider", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_DeleteProvider_Call) Run(run func(ctx context.Context, in *sirenv1beta1.DeleteProviderRequest, opts ...grpc.CallOption)) *SirenServiceClient_DeleteProvider_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.DeleteProviderRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_DeleteProvider_Call) Return(_a0 *sirenv1beta1.DeleteProviderResponse, _a1 error) *SirenServiceClient_DeleteProvider_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_DeleteProvider_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.DeleteProviderRequest, ...grpc.CallOption) (*sirenv1beta1.DeleteProviderResponse, error)) *SirenServiceClient_DeleteProvider_Call { + _c.Call.Return(run) + return _c +} + // DeleteReceiver provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) DeleteReceiver(ctx context.Context, in *sirenv1beta1.DeleteReceiverRequest, opts ...grpc.CallOption) (*sirenv1beta1.DeleteReceiverResponse, error) { _va := make([]interface{}, len(opts)) @@ -347,6 +688,43 @@ func (_m *SirenServiceClient) DeleteReceiver(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_DeleteReceiver_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteReceiver' +type SirenServiceClient_DeleteReceiver_Call struct { + *mock.Call +} + +// DeleteReceiver is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.DeleteReceiverRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) DeleteReceiver(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_DeleteReceiver_Call { + return &SirenServiceClient_DeleteReceiver_Call{Call: _e.mock.On("DeleteReceiver", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_DeleteReceiver_Call) Run(run func(ctx context.Context, in *sirenv1beta1.DeleteReceiverRequest, opts ...grpc.CallOption)) *SirenServiceClient_DeleteReceiver_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.DeleteReceiverRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_DeleteReceiver_Call) Return(_a0 *sirenv1beta1.DeleteReceiverResponse, _a1 error) *SirenServiceClient_DeleteReceiver_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_DeleteReceiver_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.DeleteReceiverRequest, ...grpc.CallOption) (*sirenv1beta1.DeleteReceiverResponse, error)) *SirenServiceClient_DeleteReceiver_Call { + _c.Call.Return(run) + return _c +} + // DeleteSubscription provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) DeleteSubscription(ctx context.Context, in *sirenv1beta1.DeleteSubscriptionRequest, opts ...grpc.CallOption) (*sirenv1beta1.DeleteSubscriptionResponse, error) { _va := make([]interface{}, len(opts)) @@ -380,6 +758,43 @@ func (_m *SirenServiceClient) DeleteSubscription(ctx context.Context, in *sirenv return r0, r1 } +// SirenServiceClient_DeleteSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteSubscription' +type SirenServiceClient_DeleteSubscription_Call struct { + *mock.Call +} + +// DeleteSubscription is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.DeleteSubscriptionRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) DeleteSubscription(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_DeleteSubscription_Call { + return &SirenServiceClient_DeleteSubscription_Call{Call: _e.mock.On("DeleteSubscription", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_DeleteSubscription_Call) Run(run func(ctx context.Context, in *sirenv1beta1.DeleteSubscriptionRequest, opts ...grpc.CallOption)) *SirenServiceClient_DeleteSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.DeleteSubscriptionRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_DeleteSubscription_Call) Return(_a0 *sirenv1beta1.DeleteSubscriptionResponse, _a1 error) *SirenServiceClient_DeleteSubscription_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_DeleteSubscription_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.DeleteSubscriptionRequest, ...grpc.CallOption) (*sirenv1beta1.DeleteSubscriptionResponse, error)) *SirenServiceClient_DeleteSubscription_Call { + _c.Call.Return(run) + return _c +} + // DeleteTemplate provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) DeleteTemplate(ctx context.Context, in *sirenv1beta1.DeleteTemplateRequest, opts ...grpc.CallOption) (*sirenv1beta1.DeleteTemplateResponse, error) { _va := make([]interface{}, len(opts)) @@ -413,6 +828,43 @@ func (_m *SirenServiceClient) DeleteTemplate(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_DeleteTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteTemplate' +type SirenServiceClient_DeleteTemplate_Call struct { + *mock.Call +} + +// DeleteTemplate is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.DeleteTemplateRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) DeleteTemplate(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_DeleteTemplate_Call { + return &SirenServiceClient_DeleteTemplate_Call{Call: _e.mock.On("DeleteTemplate", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_DeleteTemplate_Call) Run(run func(ctx context.Context, in *sirenv1beta1.DeleteTemplateRequest, opts ...grpc.CallOption)) *SirenServiceClient_DeleteTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.DeleteTemplateRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_DeleteTemplate_Call) Return(_a0 *sirenv1beta1.DeleteTemplateResponse, _a1 error) *SirenServiceClient_DeleteTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_DeleteTemplate_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.DeleteTemplateRequest, ...grpc.CallOption) (*sirenv1beta1.DeleteTemplateResponse, error)) *SirenServiceClient_DeleteTemplate_Call { + _c.Call.Return(run) + return _c +} + // ExpireSilence provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ExpireSilence(ctx context.Context, in *sirenv1beta1.ExpireSilenceRequest, opts ...grpc.CallOption) (*sirenv1beta1.ExpireSilenceResponse, error) { _va := make([]interface{}, len(opts)) @@ -446,6 +898,43 @@ func (_m *SirenServiceClient) ExpireSilence(ctx context.Context, in *sirenv1beta return r0, r1 } +// SirenServiceClient_ExpireSilence_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExpireSilence' +type SirenServiceClient_ExpireSilence_Call struct { + *mock.Call +} + +// ExpireSilence is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ExpireSilenceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ExpireSilence(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ExpireSilence_Call { + return &SirenServiceClient_ExpireSilence_Call{Call: _e.mock.On("ExpireSilence", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ExpireSilence_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ExpireSilenceRequest, opts ...grpc.CallOption)) *SirenServiceClient_ExpireSilence_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ExpireSilenceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ExpireSilence_Call) Return(_a0 *sirenv1beta1.ExpireSilenceResponse, _a1 error) *SirenServiceClient_ExpireSilence_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ExpireSilence_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ExpireSilenceRequest, ...grpc.CallOption) (*sirenv1beta1.ExpireSilenceResponse, error)) *SirenServiceClient_ExpireSilence_Call { + _c.Call.Return(run) + return _c +} + // GetNamespace provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) GetNamespace(ctx context.Context, in *sirenv1beta1.GetNamespaceRequest, opts ...grpc.CallOption) (*sirenv1beta1.GetNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -479,6 +968,43 @@ func (_m *SirenServiceClient) GetNamespace(ctx context.Context, in *sirenv1beta1 return r0, r1 } +// SirenServiceClient_GetNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNamespace' +type SirenServiceClient_GetNamespace_Call struct { + *mock.Call +} + +// GetNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.GetNamespaceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) GetNamespace(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_GetNamespace_Call { + return &SirenServiceClient_GetNamespace_Call{Call: _e.mock.On("GetNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_GetNamespace_Call) Run(run func(ctx context.Context, in *sirenv1beta1.GetNamespaceRequest, opts ...grpc.CallOption)) *SirenServiceClient_GetNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.GetNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_GetNamespace_Call) Return(_a0 *sirenv1beta1.GetNamespaceResponse, _a1 error) *SirenServiceClient_GetNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_GetNamespace_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.GetNamespaceRequest, ...grpc.CallOption) (*sirenv1beta1.GetNamespaceResponse, error)) *SirenServiceClient_GetNamespace_Call { + _c.Call.Return(run) + return _c +} + // GetProvider provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) GetProvider(ctx context.Context, in *sirenv1beta1.GetProviderRequest, opts ...grpc.CallOption) (*sirenv1beta1.GetProviderResponse, error) { _va := make([]interface{}, len(opts)) @@ -512,6 +1038,43 @@ func (_m *SirenServiceClient) GetProvider(ctx context.Context, in *sirenv1beta1. return r0, r1 } +// SirenServiceClient_GetProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProvider' +type SirenServiceClient_GetProvider_Call struct { + *mock.Call +} + +// GetProvider is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.GetProviderRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) GetProvider(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_GetProvider_Call { + return &SirenServiceClient_GetProvider_Call{Call: _e.mock.On("GetProvider", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_GetProvider_Call) Run(run func(ctx context.Context, in *sirenv1beta1.GetProviderRequest, opts ...grpc.CallOption)) *SirenServiceClient_GetProvider_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.GetProviderRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_GetProvider_Call) Return(_a0 *sirenv1beta1.GetProviderResponse, _a1 error) *SirenServiceClient_GetProvider_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_GetProvider_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.GetProviderRequest, ...grpc.CallOption) (*sirenv1beta1.GetProviderResponse, error)) *SirenServiceClient_GetProvider_Call { + _c.Call.Return(run) + return _c +} + // GetReceiver provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) GetReceiver(ctx context.Context, in *sirenv1beta1.GetReceiverRequest, opts ...grpc.CallOption) (*sirenv1beta1.GetReceiverResponse, error) { _va := make([]interface{}, len(opts)) @@ -545,6 +1108,43 @@ func (_m *SirenServiceClient) GetReceiver(ctx context.Context, in *sirenv1beta1. return r0, r1 } +// SirenServiceClient_GetReceiver_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReceiver' +type SirenServiceClient_GetReceiver_Call struct { + *mock.Call +} + +// GetReceiver is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.GetReceiverRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) GetReceiver(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_GetReceiver_Call { + return &SirenServiceClient_GetReceiver_Call{Call: _e.mock.On("GetReceiver", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_GetReceiver_Call) Run(run func(ctx context.Context, in *sirenv1beta1.GetReceiverRequest, opts ...grpc.CallOption)) *SirenServiceClient_GetReceiver_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.GetReceiverRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_GetReceiver_Call) Return(_a0 *sirenv1beta1.GetReceiverResponse, _a1 error) *SirenServiceClient_GetReceiver_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_GetReceiver_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.GetReceiverRequest, ...grpc.CallOption) (*sirenv1beta1.GetReceiverResponse, error)) *SirenServiceClient_GetReceiver_Call { + _c.Call.Return(run) + return _c +} + // GetSilence provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) GetSilence(ctx context.Context, in *sirenv1beta1.GetSilenceRequest, opts ...grpc.CallOption) (*sirenv1beta1.GetSilenceResponse, error) { _va := make([]interface{}, len(opts)) @@ -578,6 +1178,43 @@ func (_m *SirenServiceClient) GetSilence(ctx context.Context, in *sirenv1beta1.G return r0, r1 } +// SirenServiceClient_GetSilence_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSilence' +type SirenServiceClient_GetSilence_Call struct { + *mock.Call +} + +// GetSilence is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.GetSilenceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) GetSilence(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_GetSilence_Call { + return &SirenServiceClient_GetSilence_Call{Call: _e.mock.On("GetSilence", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_GetSilence_Call) Run(run func(ctx context.Context, in *sirenv1beta1.GetSilenceRequest, opts ...grpc.CallOption)) *SirenServiceClient_GetSilence_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.GetSilenceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_GetSilence_Call) Return(_a0 *sirenv1beta1.GetSilenceResponse, _a1 error) *SirenServiceClient_GetSilence_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_GetSilence_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.GetSilenceRequest, ...grpc.CallOption) (*sirenv1beta1.GetSilenceResponse, error)) *SirenServiceClient_GetSilence_Call { + _c.Call.Return(run) + return _c +} + // GetSubscription provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) GetSubscription(ctx context.Context, in *sirenv1beta1.GetSubscriptionRequest, opts ...grpc.CallOption) (*sirenv1beta1.GetSubscriptionResponse, error) { _va := make([]interface{}, len(opts)) @@ -611,6 +1248,43 @@ func (_m *SirenServiceClient) GetSubscription(ctx context.Context, in *sirenv1be return r0, r1 } +// SirenServiceClient_GetSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubscription' +type SirenServiceClient_GetSubscription_Call struct { + *mock.Call +} + +// GetSubscription is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.GetSubscriptionRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) GetSubscription(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_GetSubscription_Call { + return &SirenServiceClient_GetSubscription_Call{Call: _e.mock.On("GetSubscription", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_GetSubscription_Call) Run(run func(ctx context.Context, in *sirenv1beta1.GetSubscriptionRequest, opts ...grpc.CallOption)) *SirenServiceClient_GetSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.GetSubscriptionRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_GetSubscription_Call) Return(_a0 *sirenv1beta1.GetSubscriptionResponse, _a1 error) *SirenServiceClient_GetSubscription_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_GetSubscription_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.GetSubscriptionRequest, ...grpc.CallOption) (*sirenv1beta1.GetSubscriptionResponse, error)) *SirenServiceClient_GetSubscription_Call { + _c.Call.Return(run) + return _c +} + // GetTemplate provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) GetTemplate(ctx context.Context, in *sirenv1beta1.GetTemplateRequest, opts ...grpc.CallOption) (*sirenv1beta1.GetTemplateResponse, error) { _va := make([]interface{}, len(opts)) @@ -644,6 +1318,43 @@ func (_m *SirenServiceClient) GetTemplate(ctx context.Context, in *sirenv1beta1. return r0, r1 } +// SirenServiceClient_GetTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTemplate' +type SirenServiceClient_GetTemplate_Call struct { + *mock.Call +} + +// GetTemplate is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.GetTemplateRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) GetTemplate(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_GetTemplate_Call { + return &SirenServiceClient_GetTemplate_Call{Call: _e.mock.On("GetTemplate", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_GetTemplate_Call) Run(run func(ctx context.Context, in *sirenv1beta1.GetTemplateRequest, opts ...grpc.CallOption)) *SirenServiceClient_GetTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.GetTemplateRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_GetTemplate_Call) Return(_a0 *sirenv1beta1.GetTemplateResponse, _a1 error) *SirenServiceClient_GetTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_GetTemplate_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.GetTemplateRequest, ...grpc.CallOption) (*sirenv1beta1.GetTemplateResponse, error)) *SirenServiceClient_GetTemplate_Call { + _c.Call.Return(run) + return _c +} + // ListAlerts provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListAlerts(ctx context.Context, in *sirenv1beta1.ListAlertsRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListAlertsResponse, error) { _va := make([]interface{}, len(opts)) @@ -677,6 +1388,43 @@ func (_m *SirenServiceClient) ListAlerts(ctx context.Context, in *sirenv1beta1.L return r0, r1 } +// SirenServiceClient_ListAlerts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAlerts' +type SirenServiceClient_ListAlerts_Call struct { + *mock.Call +} + +// ListAlerts is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListAlertsRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListAlerts(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListAlerts_Call { + return &SirenServiceClient_ListAlerts_Call{Call: _e.mock.On("ListAlerts", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListAlerts_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListAlertsRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListAlerts_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListAlertsRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListAlerts_Call) Return(_a0 *sirenv1beta1.ListAlertsResponse, _a1 error) *SirenServiceClient_ListAlerts_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListAlerts_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListAlertsRequest, ...grpc.CallOption) (*sirenv1beta1.ListAlertsResponse, error)) *SirenServiceClient_ListAlerts_Call { + _c.Call.Return(run) + return _c +} + // ListNamespaces provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListNamespaces(ctx context.Context, in *sirenv1beta1.ListNamespacesRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListNamespacesResponse, error) { _va := make([]interface{}, len(opts)) @@ -710,6 +1458,43 @@ func (_m *SirenServiceClient) ListNamespaces(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_ListNamespaces_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListNamespaces' +type SirenServiceClient_ListNamespaces_Call struct { + *mock.Call +} + +// ListNamespaces is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListNamespacesRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListNamespaces(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListNamespaces_Call { + return &SirenServiceClient_ListNamespaces_Call{Call: _e.mock.On("ListNamespaces", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListNamespaces_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListNamespacesRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListNamespaces_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListNamespacesRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListNamespaces_Call) Return(_a0 *sirenv1beta1.ListNamespacesResponse, _a1 error) *SirenServiceClient_ListNamespaces_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListNamespaces_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListNamespacesRequest, ...grpc.CallOption) (*sirenv1beta1.ListNamespacesResponse, error)) *SirenServiceClient_ListNamespaces_Call { + _c.Call.Return(run) + return _c +} + // ListProviders provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListProviders(ctx context.Context, in *sirenv1beta1.ListProvidersRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListProvidersResponse, error) { _va := make([]interface{}, len(opts)) @@ -743,6 +1528,43 @@ func (_m *SirenServiceClient) ListProviders(ctx context.Context, in *sirenv1beta return r0, r1 } +// SirenServiceClient_ListProviders_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListProviders' +type SirenServiceClient_ListProviders_Call struct { + *mock.Call +} + +// ListProviders is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListProvidersRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListProviders(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListProviders_Call { + return &SirenServiceClient_ListProviders_Call{Call: _e.mock.On("ListProviders", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListProviders_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListProvidersRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListProviders_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListProvidersRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListProviders_Call) Return(_a0 *sirenv1beta1.ListProvidersResponse, _a1 error) *SirenServiceClient_ListProviders_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListProviders_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListProvidersRequest, ...grpc.CallOption) (*sirenv1beta1.ListProvidersResponse, error)) *SirenServiceClient_ListProviders_Call { + _c.Call.Return(run) + return _c +} + // ListReceivers provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListReceivers(ctx context.Context, in *sirenv1beta1.ListReceiversRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListReceiversResponse, error) { _va := make([]interface{}, len(opts)) @@ -776,6 +1598,43 @@ func (_m *SirenServiceClient) ListReceivers(ctx context.Context, in *sirenv1beta return r0, r1 } +// SirenServiceClient_ListReceivers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListReceivers' +type SirenServiceClient_ListReceivers_Call struct { + *mock.Call +} + +// ListReceivers is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListReceiversRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListReceivers(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListReceivers_Call { + return &SirenServiceClient_ListReceivers_Call{Call: _e.mock.On("ListReceivers", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListReceivers_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListReceiversRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListReceivers_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListReceiversRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListReceivers_Call) Return(_a0 *sirenv1beta1.ListReceiversResponse, _a1 error) *SirenServiceClient_ListReceivers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListReceivers_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListReceiversRequest, ...grpc.CallOption) (*sirenv1beta1.ListReceiversResponse, error)) *SirenServiceClient_ListReceivers_Call { + _c.Call.Return(run) + return _c +} + // ListRules provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListRules(ctx context.Context, in *sirenv1beta1.ListRulesRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListRulesResponse, error) { _va := make([]interface{}, len(opts)) @@ -809,6 +1668,43 @@ func (_m *SirenServiceClient) ListRules(ctx context.Context, in *sirenv1beta1.Li return r0, r1 } +// SirenServiceClient_ListRules_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRules' +type SirenServiceClient_ListRules_Call struct { + *mock.Call +} + +// ListRules is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListRulesRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListRules(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListRules_Call { + return &SirenServiceClient_ListRules_Call{Call: _e.mock.On("ListRules", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListRules_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListRulesRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListRules_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListRulesRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListRules_Call) Return(_a0 *sirenv1beta1.ListRulesResponse, _a1 error) *SirenServiceClient_ListRules_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListRules_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListRulesRequest, ...grpc.CallOption) (*sirenv1beta1.ListRulesResponse, error)) *SirenServiceClient_ListRules_Call { + _c.Call.Return(run) + return _c +} + // ListSilences provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListSilences(ctx context.Context, in *sirenv1beta1.ListSilencesRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListSilencesResponse, error) { _va := make([]interface{}, len(opts)) @@ -842,6 +1738,43 @@ func (_m *SirenServiceClient) ListSilences(ctx context.Context, in *sirenv1beta1 return r0, r1 } +// SirenServiceClient_ListSilences_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSilences' +type SirenServiceClient_ListSilences_Call struct { + *mock.Call +} + +// ListSilences is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListSilencesRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListSilences(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListSilences_Call { + return &SirenServiceClient_ListSilences_Call{Call: _e.mock.On("ListSilences", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListSilences_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListSilencesRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListSilences_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListSilencesRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListSilences_Call) Return(_a0 *sirenv1beta1.ListSilencesResponse, _a1 error) *SirenServiceClient_ListSilences_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListSilences_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListSilencesRequest, ...grpc.CallOption) (*sirenv1beta1.ListSilencesResponse, error)) *SirenServiceClient_ListSilences_Call { + _c.Call.Return(run) + return _c +} + // ListSubscriptions provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListSubscriptions(ctx context.Context, in *sirenv1beta1.ListSubscriptionsRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListSubscriptionsResponse, error) { _va := make([]interface{}, len(opts)) @@ -875,6 +1808,43 @@ func (_m *SirenServiceClient) ListSubscriptions(ctx context.Context, in *sirenv1 return r0, r1 } +// SirenServiceClient_ListSubscriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubscriptions' +type SirenServiceClient_ListSubscriptions_Call struct { + *mock.Call +} + +// ListSubscriptions is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListSubscriptionsRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListSubscriptions(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListSubscriptions_Call { + return &SirenServiceClient_ListSubscriptions_Call{Call: _e.mock.On("ListSubscriptions", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListSubscriptions_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListSubscriptionsRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListSubscriptions_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListSubscriptionsRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListSubscriptions_Call) Return(_a0 *sirenv1beta1.ListSubscriptionsResponse, _a1 error) *SirenServiceClient_ListSubscriptions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListSubscriptions_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListSubscriptionsRequest, ...grpc.CallOption) (*sirenv1beta1.ListSubscriptionsResponse, error)) *SirenServiceClient_ListSubscriptions_Call { + _c.Call.Return(run) + return _c +} + // ListTemplates provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) ListTemplates(ctx context.Context, in *sirenv1beta1.ListTemplatesRequest, opts ...grpc.CallOption) (*sirenv1beta1.ListTemplatesResponse, error) { _va := make([]interface{}, len(opts)) @@ -908,6 +1878,43 @@ func (_m *SirenServiceClient) ListTemplates(ctx context.Context, in *sirenv1beta return r0, r1 } +// SirenServiceClient_ListTemplates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTemplates' +type SirenServiceClient_ListTemplates_Call struct { + *mock.Call +} + +// ListTemplates is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.ListTemplatesRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) ListTemplates(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_ListTemplates_Call { + return &SirenServiceClient_ListTemplates_Call{Call: _e.mock.On("ListTemplates", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_ListTemplates_Call) Run(run func(ctx context.Context, in *sirenv1beta1.ListTemplatesRequest, opts ...grpc.CallOption)) *SirenServiceClient_ListTemplates_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.ListTemplatesRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_ListTemplates_Call) Return(_a0 *sirenv1beta1.ListTemplatesResponse, _a1 error) *SirenServiceClient_ListTemplates_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_ListTemplates_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.ListTemplatesRequest, ...grpc.CallOption) (*sirenv1beta1.ListTemplatesResponse, error)) *SirenServiceClient_ListTemplates_Call { + _c.Call.Return(run) + return _c +} + // NotifyReceiver provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) NotifyReceiver(ctx context.Context, in *sirenv1beta1.NotifyReceiverRequest, opts ...grpc.CallOption) (*sirenv1beta1.NotifyReceiverResponse, error) { _va := make([]interface{}, len(opts)) @@ -941,6 +1948,43 @@ func (_m *SirenServiceClient) NotifyReceiver(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_NotifyReceiver_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NotifyReceiver' +type SirenServiceClient_NotifyReceiver_Call struct { + *mock.Call +} + +// NotifyReceiver is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.NotifyReceiverRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) NotifyReceiver(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_NotifyReceiver_Call { + return &SirenServiceClient_NotifyReceiver_Call{Call: _e.mock.On("NotifyReceiver", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_NotifyReceiver_Call) Run(run func(ctx context.Context, in *sirenv1beta1.NotifyReceiverRequest, opts ...grpc.CallOption)) *SirenServiceClient_NotifyReceiver_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.NotifyReceiverRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_NotifyReceiver_Call) Return(_a0 *sirenv1beta1.NotifyReceiverResponse, _a1 error) *SirenServiceClient_NotifyReceiver_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_NotifyReceiver_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.NotifyReceiverRequest, ...grpc.CallOption) (*sirenv1beta1.NotifyReceiverResponse, error)) *SirenServiceClient_NotifyReceiver_Call { + _c.Call.Return(run) + return _c +} + // RenderTemplate provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) RenderTemplate(ctx context.Context, in *sirenv1beta1.RenderTemplateRequest, opts ...grpc.CallOption) (*sirenv1beta1.RenderTemplateResponse, error) { _va := make([]interface{}, len(opts)) @@ -974,6 +2018,43 @@ func (_m *SirenServiceClient) RenderTemplate(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_RenderTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenderTemplate' +type SirenServiceClient_RenderTemplate_Call struct { + *mock.Call +} + +// RenderTemplate is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.RenderTemplateRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) RenderTemplate(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_RenderTemplate_Call { + return &SirenServiceClient_RenderTemplate_Call{Call: _e.mock.On("RenderTemplate", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_RenderTemplate_Call) Run(run func(ctx context.Context, in *sirenv1beta1.RenderTemplateRequest, opts ...grpc.CallOption)) *SirenServiceClient_RenderTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.RenderTemplateRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_RenderTemplate_Call) Return(_a0 *sirenv1beta1.RenderTemplateResponse, _a1 error) *SirenServiceClient_RenderTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_RenderTemplate_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.RenderTemplateRequest, ...grpc.CallOption) (*sirenv1beta1.RenderTemplateResponse, error)) *SirenServiceClient_RenderTemplate_Call { + _c.Call.Return(run) + return _c +} + // UpdateNamespace provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) UpdateNamespace(ctx context.Context, in *sirenv1beta1.UpdateNamespaceRequest, opts ...grpc.CallOption) (*sirenv1beta1.UpdateNamespaceResponse, error) { _va := make([]interface{}, len(opts)) @@ -1007,6 +2088,43 @@ func (_m *SirenServiceClient) UpdateNamespace(ctx context.Context, in *sirenv1be return r0, r1 } +// SirenServiceClient_UpdateNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateNamespace' +type SirenServiceClient_UpdateNamespace_Call struct { + *mock.Call +} + +// UpdateNamespace is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.UpdateNamespaceRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) UpdateNamespace(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_UpdateNamespace_Call { + return &SirenServiceClient_UpdateNamespace_Call{Call: _e.mock.On("UpdateNamespace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_UpdateNamespace_Call) Run(run func(ctx context.Context, in *sirenv1beta1.UpdateNamespaceRequest, opts ...grpc.CallOption)) *SirenServiceClient_UpdateNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.UpdateNamespaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_UpdateNamespace_Call) Return(_a0 *sirenv1beta1.UpdateNamespaceResponse, _a1 error) *SirenServiceClient_UpdateNamespace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_UpdateNamespace_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.UpdateNamespaceRequest, ...grpc.CallOption) (*sirenv1beta1.UpdateNamespaceResponse, error)) *SirenServiceClient_UpdateNamespace_Call { + _c.Call.Return(run) + return _c +} + // UpdateProvider provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) UpdateProvider(ctx context.Context, in *sirenv1beta1.UpdateProviderRequest, opts ...grpc.CallOption) (*sirenv1beta1.UpdateProviderResponse, error) { _va := make([]interface{}, len(opts)) @@ -1040,6 +2158,43 @@ func (_m *SirenServiceClient) UpdateProvider(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_UpdateProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateProvider' +type SirenServiceClient_UpdateProvider_Call struct { + *mock.Call +} + +// UpdateProvider is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.UpdateProviderRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) UpdateProvider(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_UpdateProvider_Call { + return &SirenServiceClient_UpdateProvider_Call{Call: _e.mock.On("UpdateProvider", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_UpdateProvider_Call) Run(run func(ctx context.Context, in *sirenv1beta1.UpdateProviderRequest, opts ...grpc.CallOption)) *SirenServiceClient_UpdateProvider_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.UpdateProviderRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_UpdateProvider_Call) Return(_a0 *sirenv1beta1.UpdateProviderResponse, _a1 error) *SirenServiceClient_UpdateProvider_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_UpdateProvider_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.UpdateProviderRequest, ...grpc.CallOption) (*sirenv1beta1.UpdateProviderResponse, error)) *SirenServiceClient_UpdateProvider_Call { + _c.Call.Return(run) + return _c +} + // UpdateReceiver provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) UpdateReceiver(ctx context.Context, in *sirenv1beta1.UpdateReceiverRequest, opts ...grpc.CallOption) (*sirenv1beta1.UpdateReceiverResponse, error) { _va := make([]interface{}, len(opts)) @@ -1073,6 +2228,43 @@ func (_m *SirenServiceClient) UpdateReceiver(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_UpdateReceiver_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateReceiver' +type SirenServiceClient_UpdateReceiver_Call struct { + *mock.Call +} + +// UpdateReceiver is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.UpdateReceiverRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) UpdateReceiver(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_UpdateReceiver_Call { + return &SirenServiceClient_UpdateReceiver_Call{Call: _e.mock.On("UpdateReceiver", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_UpdateReceiver_Call) Run(run func(ctx context.Context, in *sirenv1beta1.UpdateReceiverRequest, opts ...grpc.CallOption)) *SirenServiceClient_UpdateReceiver_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.UpdateReceiverRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_UpdateReceiver_Call) Return(_a0 *sirenv1beta1.UpdateReceiverResponse, _a1 error) *SirenServiceClient_UpdateReceiver_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_UpdateReceiver_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.UpdateReceiverRequest, ...grpc.CallOption) (*sirenv1beta1.UpdateReceiverResponse, error)) *SirenServiceClient_UpdateReceiver_Call { + _c.Call.Return(run) + return _c +} + // UpdateRule provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) UpdateRule(ctx context.Context, in *sirenv1beta1.UpdateRuleRequest, opts ...grpc.CallOption) (*sirenv1beta1.UpdateRuleResponse, error) { _va := make([]interface{}, len(opts)) @@ -1106,6 +2298,43 @@ func (_m *SirenServiceClient) UpdateRule(ctx context.Context, in *sirenv1beta1.U return r0, r1 } +// SirenServiceClient_UpdateRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRule' +type SirenServiceClient_UpdateRule_Call struct { + *mock.Call +} + +// UpdateRule is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.UpdateRuleRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) UpdateRule(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_UpdateRule_Call { + return &SirenServiceClient_UpdateRule_Call{Call: _e.mock.On("UpdateRule", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_UpdateRule_Call) Run(run func(ctx context.Context, in *sirenv1beta1.UpdateRuleRequest, opts ...grpc.CallOption)) *SirenServiceClient_UpdateRule_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.UpdateRuleRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_UpdateRule_Call) Return(_a0 *sirenv1beta1.UpdateRuleResponse, _a1 error) *SirenServiceClient_UpdateRule_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_UpdateRule_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.UpdateRuleRequest, ...grpc.CallOption) (*sirenv1beta1.UpdateRuleResponse, error)) *SirenServiceClient_UpdateRule_Call { + _c.Call.Return(run) + return _c +} + // UpdateSubscription provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) UpdateSubscription(ctx context.Context, in *sirenv1beta1.UpdateSubscriptionRequest, opts ...grpc.CallOption) (*sirenv1beta1.UpdateSubscriptionResponse, error) { _va := make([]interface{}, len(opts)) @@ -1139,6 +2368,43 @@ func (_m *SirenServiceClient) UpdateSubscription(ctx context.Context, in *sirenv return r0, r1 } +// SirenServiceClient_UpdateSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSubscription' +type SirenServiceClient_UpdateSubscription_Call struct { + *mock.Call +} + +// UpdateSubscription is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.UpdateSubscriptionRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) UpdateSubscription(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_UpdateSubscription_Call { + return &SirenServiceClient_UpdateSubscription_Call{Call: _e.mock.On("UpdateSubscription", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_UpdateSubscription_Call) Run(run func(ctx context.Context, in *sirenv1beta1.UpdateSubscriptionRequest, opts ...grpc.CallOption)) *SirenServiceClient_UpdateSubscription_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.UpdateSubscriptionRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_UpdateSubscription_Call) Return(_a0 *sirenv1beta1.UpdateSubscriptionResponse, _a1 error) *SirenServiceClient_UpdateSubscription_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_UpdateSubscription_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.UpdateSubscriptionRequest, ...grpc.CallOption) (*sirenv1beta1.UpdateSubscriptionResponse, error)) *SirenServiceClient_UpdateSubscription_Call { + _c.Call.Return(run) + return _c +} + // UpsertTemplate provides a mock function with given fields: ctx, in, opts func (_m *SirenServiceClient) UpsertTemplate(ctx context.Context, in *sirenv1beta1.UpsertTemplateRequest, opts ...grpc.CallOption) (*sirenv1beta1.UpsertTemplateResponse, error) { _va := make([]interface{}, len(opts)) @@ -1172,6 +2438,43 @@ func (_m *SirenServiceClient) UpsertTemplate(ctx context.Context, in *sirenv1bet return r0, r1 } +// SirenServiceClient_UpsertTemplate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpsertTemplate' +type SirenServiceClient_UpsertTemplate_Call struct { + *mock.Call +} + +// UpsertTemplate is a helper method to define mock.On call +// - ctx context.Context +// - in *sirenv1beta1.UpsertTemplateRequest +// - opts ...grpc.CallOption +func (_e *SirenServiceClient_Expecter) UpsertTemplate(ctx interface{}, in interface{}, opts ...interface{}) *SirenServiceClient_UpsertTemplate_Call { + return &SirenServiceClient_UpsertTemplate_Call{Call: _e.mock.On("UpsertTemplate", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SirenServiceClient_UpsertTemplate_Call) Run(run func(ctx context.Context, in *sirenv1beta1.UpsertTemplateRequest, opts ...grpc.CallOption)) *SirenServiceClient_UpsertTemplate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*sirenv1beta1.UpsertTemplateRequest), variadicArgs...) + }) + return _c +} + +func (_c *SirenServiceClient_UpsertTemplate_Call) Return(_a0 *sirenv1beta1.UpsertTemplateResponse, _a1 error) *SirenServiceClient_UpsertTemplate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SirenServiceClient_UpsertTemplate_Call) RunAndReturn(run func(context.Context, *sirenv1beta1.UpsertTemplateRequest, ...grpc.CallOption) (*sirenv1beta1.UpsertTemplateResponse, error)) *SirenServiceClient_UpsertTemplate_Call { + _c.Call.Return(run) + return _c +} + // NewSirenServiceClient creates a new instance of SirenServiceClient. 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 NewSirenServiceClient(t interface { diff --git a/warden/client.go b/warden/client.go new file mode 100644 index 0000000..7f844ee --- /dev/null +++ b/warden/client.go @@ -0,0 +1,90 @@ +package warden + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" +) + +type Client struct { + BaseURL string + Client *http.Client +} + +func NewClient(baseURL string) *Client { + return &Client{ + BaseURL: baseURL, + Client: &http.Client{}, + } +} + +func (c *Client) ListUserTeams(ctx context.Context, req TeamListRequest) ([]Team, error) { + url := fmt.Sprintf("%s/api/v1/users/%s/teams", c.BaseURL, req.Email) + httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + + resp, err := c.Client.Do(httpReq) + if err != nil { + return nil, fmt.Errorf("error sending request: %w", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + if resp.StatusCode == http.StatusNotFound { + return nil, ErrUserEmailNotFound + } + + bodyBytes, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + bodyString := string(bodyBytes) + return nil, fmt.Errorf("%w: %d: %s", ErrNon200, resp.StatusCode, bodyString) + } + + var data teamListResponse + err = json.NewDecoder(resp.Body).Decode(&data) + if err != nil { + return nil, fmt.Errorf("error decoding warden teamListResponse: %w", err) + } + return data.Data.Teams, nil +} + +func (c *Client) TeamByUUID(ctx context.Context, req TeamByUUIDRequest) (*Team, error) { + url := fmt.Sprintf("%s/api/v2/teams/%s", c.BaseURL, req.TeamUUID) + httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + + resp, err := c.Client.Do(httpReq) + if err != nil { + return nil, fmt.Errorf("error sending request: %w", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + if resp.StatusCode == http.StatusNotFound { + return nil, ErrTeamUUIDNotFound + } + + bodyBytes, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + bodyString := string(bodyBytes) + return nil, fmt.Errorf("%w: %d: %s", ErrNon200, resp.StatusCode, bodyString) + } + + var data teamResponse + err = json.NewDecoder(resp.Body).Decode(&data) + if err != nil { + return nil, fmt.Errorf("error decoding teamResponse: %w", err) + } + + return &data.Data, nil +} diff --git a/warden/error.go b/warden/error.go new file mode 100644 index 0000000..6e71254 --- /dev/null +++ b/warden/error.go @@ -0,0 +1,9 @@ +package warden + +import "errors" + +var ( + ErrUserEmailNotFound = errors.New("user email not found") + ErrTeamUUIDNotFound = errors.New("team with uuid not found") + ErrNon200 = errors.New("got non-200 when hitting warden API") +) diff --git a/warden/warden.go b/warden/warden.go new file mode 100644 index 0000000..2661c42 --- /dev/null +++ b/warden/warden.go @@ -0,0 +1,40 @@ +package warden + +import ( + "time" +) + +type Team struct { + Name string `json:"name"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + OwnerID int `json:"owner_id"` + ParentTeamIdentifier string `json:"parent_team_identifier"` + Identifier string `json:"identifier"` + ProductGroupName string `json:"product_group_name"` + ProductGroupID string `json:"product_group_id"` + Labels any `json:"labels"` + ShortCode string `json:"short_code"` +} + +type TeamListRequest struct { + Email string +} + +type TeamByUUIDRequest struct { + TeamUUID string +} + +type teamResponse struct { + Success bool `json:"success"` + Data Team `json:"data"` +} + +type teamListResponse struct { + Success bool `json:"success"` + Data teamsData `json:"data"` +} + +type teamsData struct { + Teams []Team `json:"teams"` +}