diff --git a/client/permission.go b/client/permission.go index 2e04cd6e..b0cafbac 100644 --- a/client/permission.go +++ b/client/permission.go @@ -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 + +const ( + PermissionScopeProject PermissionScope = "project" + 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