Skip to content

Commit

Permalink
changed permission sciope to const
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM committed Nov 18, 2024
1 parent 8f1212d commit 4267943
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions client/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ package client

import (
"fmt"

clientv1 "github.com/spectrocloud/palette-sdk-go/api/client/v1"
"github.com/spectrocloud/palette-sdk-go/api/models"
)

type PermissionScope string

Check failure on line 9 in client/permission.go

View workflow job for this annotation

GitHub Actions / build-with-coverage

exported: exported type PermissionScope should have comment or be unexported (revive)

const (
PermissionScopeProject PermissionScope = "project"

Check failure on line 12 in client/permission.go

View workflow job for this annotation

GitHub Actions / build-with-coverage

exported: exported const PermissionScopeProject should have comment (or a comment on this block) or be unexported (revive)
PermissionScopeTenant PermissionScope = "tenant"
PermissionScopeResource PermissionScope = "resource"
)

// GetPermissionByName retrieves an existing permission by name and permissionScope(project, tenant & resource).
func (h *V1Client) GetPermissionByName(permissionName string, permissionScope string) (*models.V1Permission, error) {
func (h *V1Client) GetPermissionByName(permissionName string, permissionScope PermissionScope) (*models.V1Permission, error) {
// ACL scoped to tenant only
params := clientv1.NewV1PermissionsListParams().WithScope(&permissionScope)
permScope := string(permissionScope)
params := clientv1.NewV1PermissionsListParams().WithScope(&permScope)
resp, err := h.Client.V1PermissionsList(params)
if err != nil {
return nil, err
Expand Down

0 comments on commit 4267943

Please sign in to comment.