Skip to content

Commit

Permalink
chore: fix indent with go fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Caio Cavalcante <[email protected]>
  • Loading branch information
Caio Cavalcante committed Oct 29, 2024
1 parent 4a4ce12 commit a35d213
Show file tree
Hide file tree
Showing 16 changed files with 3,598 additions and 3,598 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
root = true

[*]
indent_style = space
indent_style = tab
indent_size = 2
tab_width = 2
124 changes: 62 additions & 62 deletions internal/ast/scope.go
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
package ast

import (
"github.com/cedar-policy/cedar-go/types"
"github.com/cedar-policy/cedar-go/types"
)

type Scope struct{}

func (s Scope) All() ScopeTypeAll {
return ScopeTypeAll{}
return ScopeTypeAll{}
}

func (s Scope) Eq(entity types.EntityReference) ScopeTypeEq {
return ScopeTypeEq{Entity: entity}
return ScopeTypeEq{Entity: entity}
}

func (s Scope) In(entity types.EntityUID) ScopeTypeIn {
return ScopeTypeIn{Entity: entity}
return ScopeTypeIn{Entity: entity}
}

func (s Scope) InSet(entities []types.EntityUID) ScopeTypeInSet {
return ScopeTypeInSet{Entities: entities}
return ScopeTypeInSet{Entities: entities}
}

func (s Scope) Is(entityType types.EntityType) ScopeTypeIs {
return ScopeTypeIs{Type: entityType}
return ScopeTypeIs{Type: entityType}
}

func (s Scope) IsIn(entityType types.EntityType, entity types.EntityUID) ScopeTypeIsIn {
return ScopeTypeIsIn{Type: entityType, Entity: entity}
return ScopeTypeIsIn{Type: entityType, Entity: entity}
}

func (p *Policy) PrincipalEq(entity types.EntityReference) *Policy {
p.Principal = Scope{}.Eq(entity)
return p
p.Principal = Scope{}.Eq(entity)
return p
}

func (p *Policy) PrincipalIn(entity types.EntityUID) *Policy {
p.Principal = Scope{}.In(entity)
return p
p.Principal = Scope{}.In(entity)
return p
}

func (p *Policy) PrincipalIs(entityType types.EntityType) *Policy {
p.Principal = Scope{}.Is(entityType)
return p
p.Principal = Scope{}.Is(entityType)
return p
}

func (p *Policy) PrincipalIsIn(entityType types.EntityType, entity types.EntityUID) *Policy {
p.Principal = Scope{}.IsIn(entityType, entity)
return p
p.Principal = Scope{}.IsIn(entityType, entity)
return p
}

func (p *Policy) ActionEq(entity types.EntityUID) *Policy {
p.Action = Scope{}.Eq(entity)
return p
p.Action = Scope{}.Eq(entity)
return p
}

func (p *Policy) ActionIn(entity types.EntityUID) *Policy {
p.Action = Scope{}.In(entity)
return p
p.Action = Scope{}.In(entity)
return p
}

func (p *Policy) ActionInSet(entities ...types.EntityUID) *Policy {
p.Action = Scope{}.InSet(entities)
return p
p.Action = Scope{}.InSet(entities)
return p
}

func (p *Policy) ResourceEq(entity types.EntityReference) *Policy {
p.Resource = Scope{}.Eq(entity)
return p
p.Resource = Scope{}.Eq(entity)
return p
}

func (p *Policy) ResourceIn(entity types.EntityUID) *Policy {
p.Resource = Scope{}.In(entity)
return p
p.Resource = Scope{}.In(entity)
return p
}

func (p *Policy) ResourceIs(entityType types.EntityType) *Policy {
p.Resource = Scope{}.Is(entityType)
return p
p.Resource = Scope{}.Is(entityType)
return p
}

func (p *Policy) ResourceIsIn(entityType types.EntityType, entity types.EntityUID) *Policy {
p.Resource = Scope{}.IsIn(entityType, entity)
return p
p.Resource = Scope{}.IsIn(entityType, entity)
return p
}

type IsScopeNode interface {
isScope()
isScope()
}

type IsPrincipalScopeNode interface {
IsScopeNode
isPrincipalScope()
IsScopeNode
isPrincipalScope()
}

type IsActionScopeNode interface {
IsScopeNode
isActionScope()
IsScopeNode
isActionScope()
}

type IsResourceScopeNode interface {
IsScopeNode
isResourceScope()
IsScopeNode
isResourceScope()
}

type ScopeNode struct{}
Expand All @@ -121,45 +121,45 @@ type ResourceScopeNode struct{}
func (n ResourceScopeNode) isResourceScope() {}

type ScopeTypeAll struct {
ScopeNode
PrincipalScopeNode
ActionScopeNode
ResourceScopeNode
ScopeNode
PrincipalScopeNode
ActionScopeNode
ResourceScopeNode
}

type ScopeTypeEq struct {
ScopeNode
PrincipalScopeNode
ActionScopeNode
ResourceScopeNode
Entity types.EntityReference
ScopeNode
PrincipalScopeNode
ActionScopeNode
ResourceScopeNode
Entity types.EntityReference
}

type ScopeTypeIn struct {
ScopeNode
PrincipalScopeNode
ActionScopeNode
ResourceScopeNode
Entity types.EntityUID
ScopeNode
PrincipalScopeNode
ActionScopeNode
ResourceScopeNode
Entity types.EntityUID
}

type ScopeTypeInSet struct {
ScopeNode
ActionScopeNode
Entities []types.EntityUID
ScopeNode
ActionScopeNode
Entities []types.EntityUID
}

type ScopeTypeIs struct {
ScopeNode
PrincipalScopeNode
ResourceScopeNode
Type types.EntityType
ScopeNode
PrincipalScopeNode
ResourceScopeNode
Type types.EntityType
}

type ScopeTypeIsIn struct {
ScopeNode
PrincipalScopeNode
ResourceScopeNode
Type types.EntityType
Entity types.EntityUID
ScopeNode
PrincipalScopeNode
ResourceScopeNode
Type types.EntityType
Entity types.EntityUID
}
8 changes: 4 additions & 4 deletions internal/ast/template.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package ast

type Template struct {
Body Policy
Body Policy
}

type LinkedPolicy struct {
TemplateID string
LinkID string
Policy *Policy
TemplateID string
LinkID string
Policy *Policy
}
Loading

0 comments on commit a35d213

Please sign in to comment.