Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add get default provider roles api #399

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
kushsharma marked this conversation as resolved.
Show resolved Hide resolved
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
Loading