Skip to content

Commit

Permalink
feat: add get provider default roles api
Browse files Browse the repository at this point in the history
  • Loading branch information
Chief-Rishab committed Dec 3, 2023
1 parent 696b1cd commit 6a5836b
Show file tree
Hide file tree
Showing 23 changed files with 4,335 additions and 3,424 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ COMMIT := $(shell git rev-parse --short HEAD)
TAG := "$(shell git rev-list --tags --max-count=1)"
VERSION := "$(shell git describe --tags ${TAG})-next"
BUILD_DIR=dist
PROTON_COMMIT := "bd2a1d201fb4931e7b62d93031cb541016818daa"
PROTON_COMMIT := "9a4736fa34b310bb2d76371a72173ad984516050"

.PHONY: all build clean test tidy vet proto setup format generate

Expand Down
1 change: 1 addition & 0 deletions api/handler/v1beta1/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type providerService interface {
Find(context.Context, domain.ProviderFilter) ([]*domain.Provider, error)
GetByID(context.Context, string) (*domain.Provider, error)
GetTypes(context.Context) ([]domain.ProviderType, error)
GetDefaultRoles(ctx context.Context, pType string, resourceType string) ([]string, error)
GetOne(ctx context.Context, pType, urn string) (*domain.Provider, error)
Update(context.Context, *domain.Provider) error
FetchResources(context.Context) error
Expand Down
60 changes: 60 additions & 0 deletions api/handler/v1beta1/mocks/providerService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions api/handler/v1beta1/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ func (s *GRPCServer) GetProviderTypes(ctx context.Context, req *guardianv1beta1.
}, nil
}

func (s *GRPCServer) GetProviderRoles(ctx context.Context, req *guardianv1beta1.GetProviderRolesRequest) (*guardianv1beta1.GetProviderRolesResponse, error) {
roles, err := s.providerService.GetDefaultRoles(ctx, req.GetName(), req.GetResourceType())
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to retrieve default roles: %v", err)
}

return &guardianv1beta1.GetProviderRolesResponse{
Roles: roles,
}, nil
}

func (s *GRPCServer) CreateProvider(ctx context.Context, req *guardianv1beta1.CreateProviderRequest) (*guardianv1beta1.CreateProviderResponse, error) {
if req.GetDryRun() {
ctx = provider.WithDryRun(ctx)
Expand Down
Loading

0 comments on commit 6a5836b

Please sign in to comment.