Skip to content

Commit

Permalink
refactor: rename variables
Browse files Browse the repository at this point in the history
Signed-off-by: 1998-felix <[email protected]>
  • Loading branch information
felixgateru committed Aug 30, 2024
1 parent b2febb7 commit f06ca49
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions internal/policy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func NewService(policyClient magistrala.PolicyServiceClient) policy.PolicyServic
}
}

func (s *service) AddPolicy(ctx context.Context, req *magistrala.AddPolicyReq) (bool, error) {
res, err := s.policy.AddPolicy(ctx, req)
func (svc *service) AddPolicy(ctx context.Context, req *magistrala.AddPolicyReq) (bool, error) {
res, err := svc.policy.AddPolicy(ctx, req)
if err != nil {
return false, err
}
Expand All @@ -38,87 +38,87 @@ func (svc *service) AddPolicies(ctx context.Context, req *magistrala.AddPolicies
return res.GetAdded(), nil
}

func (s *service) DeletePolicyFilter(ctx context.Context, req *magistrala.DeletePolicyFilterReq) (bool, error) {
res, err := s.policy.DeletePolicyFilter(ctx, req)
func (svc *service) DeletePolicyFilter(ctx context.Context, req *magistrala.DeletePolicyFilterReq) (bool, error) {
res, err := svc.policy.DeletePolicyFilter(ctx, req)
if err != nil {
return false, err
}
return res.GetDeleted(), nil
}

func (s *service) DeletePolicies(ctx context.Context, req *magistrala.DeletePoliciesReq) (bool, error) {
res, err := s.policy.DeletePolicies(ctx, req)
func (svc *service) DeletePolicies(ctx context.Context, req *magistrala.DeletePoliciesReq) (bool, error) {
res, err := svc.policy.DeletePolicies(ctx, req)
if err != nil {
return false, err
}
return res.GetDeleted(), nil
}

func (s *service) ListObjects(ctx context.Context, req *magistrala.ListObjectsReq) ([]string, error) {
res, err := s.policy.ListObjects(ctx, req)
func (svc *service) ListObjects(ctx context.Context, req *magistrala.ListObjectsReq) ([]string, error) {
res, err := svc.policy.ListObjects(ctx, req)
if err != nil {
return nil, err
}

return res.Policies, nil
}

func (s *service) ListAllObjects(ctx context.Context, req *magistrala.ListObjectsReq) ([]string, error) {
res, err := s.policy.ListAllObjects(ctx, req)
func (svc *service) ListAllObjects(ctx context.Context, req *magistrala.ListObjectsReq) ([]string, error) {
res, err := svc.policy.ListAllObjects(ctx, req)
if err != nil {
return nil, err
}

return res.Policies, nil
}

func (s *service) CountObjects(ctx context.Context, req *magistrala.CountObjectsReq) (uint64, error) {
res, err := s.policy.CountObjects(ctx, req)
func (svc *service) CountObjects(ctx context.Context, req *magistrala.CountObjectsReq) (uint64, error) {
res, err := svc.policy.CountObjects(ctx, req)
if err != nil {
return 0, err
}

return res.Count, nil
}

func (s *service) ListSubjects(ctx context.Context, req *magistrala.ListSubjectsReq) ([]string, error) {
res, err := s.policy.ListSubjects(ctx, req)
func (svc *service) ListSubjects(ctx context.Context, req *magistrala.ListSubjectsReq) ([]string, error) {
res, err := svc.policy.ListSubjects(ctx, req)
if err != nil {
return nil, err
}

return res.Policies, nil
}

func (s *service) ListAllSubjects(ctx context.Context, req *magistrala.ListSubjectsReq) ([]string, error) {
res, err := s.policy.ListAllSubjects(ctx, req)
func (svc *service) ListAllSubjects(ctx context.Context, req *magistrala.ListSubjectsReq) ([]string, error) {
res, err := svc.policy.ListAllSubjects(ctx, req)
if err != nil {
return nil, err
}

return res.Policies, nil
}

func (s *service) CountSubjects(ctx context.Context, req *magistrala.CountSubjectsReq) (uint64, error) {
res, err := s.policy.CountSubjects(ctx, req)
func (svc *service) CountSubjects(ctx context.Context, req *magistrala.CountSubjectsReq) (uint64, error) {
res, err := svc.policy.CountSubjects(ctx, req)
if err != nil {
return 0, err
}

return res.Count, nil
}

func (s *service) ListPermissions(ctx context.Context, req *magistrala.ListPermissionsReq) ([]string, error) {
res, err := s.policy.ListPermissions(ctx, req)
func (svc *service) ListPermissions(ctx context.Context, req *magistrala.ListPermissionsReq) ([]string, error) {
res, err := svc.policy.ListPermissions(ctx, req)
if err != nil {
return nil, err
}

return res.GetPermissions(), nil
}

func (s *service) DeleteEntityPolicies(ctx context.Context, req *magistrala.DeleteEntityPoliciesReq) (bool, error) {
res, err := s.policy.DeleteEntityPolicies(ctx, req)
func (svc *service) DeleteEntityPolicies(ctx context.Context, req *magistrala.DeleteEntityPoliciesReq) (bool, error) {
res, err := svc.policy.DeleteEntityPolicies(ctx, req)
if err != nil {
return false, err
}
Expand Down

0 comments on commit f06ca49

Please sign in to comment.