resourcescope

package
v0.0.0-...-39bdb22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientNotFound = apierrors.NotFound.WithReason("ClientNotFound").New("client not found")
View Source
var ErrResourceDuplicateURI = apierrors.BadRequest.WithReason("ResourceDuplicateURI").New("duplicate resource uri")
View Source
var ErrResourceNotAssociatedWithClient = apierrors.Forbidden.WithReason("ResourceNotAssociatedWithClient").New("resource is not associated with the client")
View Source
var ErrResourceNotFound = apierrors.NotFound.WithReason("ResourceNotFound").New("resource not found")
View Source
var ErrScopeDuplicate = apierrors.BadRequest.WithReason("ScopeDuplicate").New("duplicate scope")
View Source
var ErrScopeNotFound = apierrors.NotFound.WithReason("ScopeNotFound").New("scope not found")

Functions

func NewResourceURI

func NewResourceURI(ctx context.Context, str string) newResourceURI

func NewScope

func NewScope(ctx context.Context, str string) newScope

Types

type ClientResourceScopeService

type ClientResourceScopeService struct {
	Store *Store
}

func (*ClientResourceScopeService) GetClientResourceByURI

func (s *ClientResourceScopeService) GetClientResourceByURI(ctx context.Context, clientID string, uri string) (*Resource, error)

func (*ClientResourceScopeService) GetClientResourceScopes

func (s *ClientResourceScopeService) GetClientResourceScopes(ctx context.Context, clientID string, resourceID string) ([]*Scope, error)

type Commands

type Commands struct {
	Store *Store

	OAuthConfig *config.OAuthConfig
}

func (*Commands) AddResourceToClientID

func (c *Commands) AddResourceToClientID(ctx context.Context, resourceURI, clientID string) error

func (*Commands) AddScopesToClientID

func (c *Commands) AddScopesToClientID(ctx context.Context, resourceURI, clientID string, scopes []string) ([]*model.Scope, error)

func (*Commands) CreateResource

func (c *Commands) CreateResource(ctx context.Context, options *NewResourceOptions) (*model.Resource, error)

func (*Commands) CreateScope

func (c *Commands) CreateScope(ctx context.Context, resourceURI string, options *NewScopeOptions) (*model.Scope, error)

func (*Commands) DeleteResourceByURI

func (c *Commands) DeleteResourceByURI(ctx context.Context, uri string) error

func (*Commands) DeleteScope

func (c *Commands) DeleteScope(ctx context.Context, resourceURI string, scope string) error

func (*Commands) GetResourceByURI

func (c *Commands) GetResourceByURI(ctx context.Context, uri string) (*model.Resource, error)

func (*Commands) RemoveResourceFromClientID

func (c *Commands) RemoveResourceFromClientID(ctx context.Context, resourceURI, clientID string) error

func (*Commands) RemoveScopesFromClientID

func (c *Commands) RemoveScopesFromClientID(ctx context.Context, resourceURI, clientID string, scopes []string) ([]*model.Scope, error)

func (*Commands) ReplaceScopesOfClientID

func (c *Commands) ReplaceScopesOfClientID(ctx context.Context, resourceURI, clientID string, scopes []string) ([]*model.Scope, error)

func (*Commands) UpdateResource

func (c *Commands) UpdateResource(ctx context.Context, options *UpdateResourceOptions) (*model.Resource, error)

func (*Commands) UpdateScope

func (c *Commands) UpdateScope(ctx context.Context, options *UpdateScopeOptions) (*model.Scope, error)

type FormatResourceURI

type FormatResourceURI struct{}

func (FormatResourceURI) CheckFormat

func (FormatResourceURI) CheckFormat(ctx context.Context, value interface{}) error

type FormatScopeToken

type FormatScopeToken struct{}

func (FormatScopeToken) CheckFormat

func (FormatScopeToken) CheckFormat(ctx context.Context, value interface{}) error

type ListResourceResult

type ListResourceResult struct {
	Items      []*model.Resource
	Offset     uint64
	TotalCount uint64
}

type ListResourcesOptions

type ListResourcesOptions struct {
	SearchKeyword string
	ClientID      string
}

type ListScopeOptions

type ListScopeOptions struct {
	SearchKeyword string
	ClientID      string
}

type ListScopeResult

type ListScopeResult struct {
	Items      []*model.Scope
	Offset     uint64
	TotalCount uint64
}

type NewResourceOptions

type NewResourceOptions struct {
	URI  newResourceURI
	Name *string
}

type NewScopeOptions

type NewScopeOptions struct {
	Scope       newScope
	Description *string
}

type Queries

type Queries struct {
	Store *Store
}

func (*Queries) GetManyResourceClientIDs

func (q *Queries) GetManyResourceClientIDs(ctx context.Context, resourceIDs []string) (map[string][]string, error)

func (*Queries) GetManyResources

func (q *Queries) GetManyResources(ctx context.Context, ids []string) ([]*model.Resource, error)

func (*Queries) GetManyScopes

func (q *Queries) GetManyScopes(ctx context.Context, ids []string) ([]*model.Scope, error)

func (*Queries) GetResourceByID

func (q *Queries) GetResourceByID(ctx context.Context, id string) (*model.Resource, error)

func (*Queries) GetResourceByURI

func (q *Queries) GetResourceByURI(ctx context.Context, uri string) (*model.Resource, error)

func (*Queries) GetScope

func (q *Queries) GetScope(ctx context.Context, resourceURI string, scope string) (*model.Scope, error)

func (*Queries) ListResources

func (q *Queries) ListResources(ctx context.Context, options *ListResourcesOptions, pageArgs graphqlutil.PageArgs) (*ListResourceResult, error)

func (*Queries) ListScopes

func (q *Queries) ListScopes(ctx context.Context, resourceID string, options *ListScopeOptions, pageArgs graphqlutil.PageArgs) (*ListScopeResult, error)

type Resource

type Resource struct {
	ID          string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	ResourceURI string
	Name        *string
}

func (*Resource) ToModel

func (r *Resource) ToModel() *model.Resource

type Scope

type Scope struct {
	ID          string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	ResourceID  string
	Scope       string
	Description *string
}

func (*Scope) ToModel

func (s *Scope) ToModel() *model.Scope

type Store

type Store struct {
	SQLBuilder  *appdb.SQLBuilderApp
	SQLExecutor *appdb.SQLExecutor
	Clock       clock.Clock
}

func (*Store) AddResourceToClientID

func (s *Store) AddResourceToClientID(ctx context.Context, resourceID, clientID string) error

func (*Store) AddScopesToClientID

func (s *Store) AddScopesToClientID(ctx context.Context, resourceID string, scopeIDs []string, clientID string) error

func (*Store) CreateResource

func (s *Store) CreateResource(ctx context.Context, r *Resource) error

func (*Store) CreateScope

func (s *Store) CreateScope(ctx context.Context, scope *Scope) error

func (*Store) DeleteAllClientResourceAssociations

func (s *Store) DeleteAllClientResourceAssociations(ctx context.Context, resourceID string) error

func (*Store) DeleteAllClientScopeAssociationsByResourceID

func (s *Store) DeleteAllClientScopeAssociationsByResourceID(ctx context.Context, resourceID string) error

func (*Store) DeleteAllClientScopeAssociationsByScopeID

func (s *Store) DeleteAllClientScopeAssociationsByScopeID(ctx context.Context, scopeID string) error

func (*Store) DeleteAllResourceScopes

func (s *Store) DeleteAllResourceScopes(ctx context.Context, resourceID string) error

func (*Store) DeleteResource

func (s *Store) DeleteResource(ctx context.Context, id string) error

func (*Store) DeleteScope

func (s *Store) DeleteScope(ctx context.Context, resourceURI string, scope string) error

func (*Store) GetClientResource

func (s *Store) GetClientResource(ctx context.Context, clientID, resourceID string) (*Resource, error)

func (*Store) GetManyResources

func (s *Store) GetManyResources(ctx context.Context, ids []string) ([]*Resource, error)

func (*Store) GetManyScopes

func (s *Store) GetManyScopes(ctx context.Context, ids []string) ([]*Scope, error)

func (*Store) GetResourceByID

func (s *Store) GetResourceByID(ctx context.Context, id string) (*Resource, error)

func (*Store) GetResourceByURI

func (s *Store) GetResourceByURI(ctx context.Context, uri string) (*Resource, error)

func (*Store) GetResourceScope

func (s *Store) GetResourceScope(ctx context.Context, resourceID string, scope string) (*Scope, error)

func (*Store) GetScopeByID

func (s *Store) GetScopeByID(ctx context.Context, id string) (*Scope, error)

func (*Store) GetScopesByResourceIDAndScopes

func (s *Store) GetScopesByResourceIDAndScopes(ctx context.Context, resourceID string, scopes []string) (map[string]*Scope, error)

func (*Store) ListClientIDsByResourceIDs

func (s *Store) ListClientIDsByResourceIDs(ctx context.Context, resourceIDs []string) (map[string][]string, error)

func (*Store) ListClientScopesByResourceID

func (s *Store) ListClientScopesByResourceID(ctx context.Context, resourceID, clientID string) ([]*Scope, error)

func (*Store) ListResources

func (s *Store) ListResources(ctx context.Context, options *ListResourcesOptions, pageArgs graphqlutil.PageArgs) (*storeListResourceResult, error)

func (*Store) ListScopes

func (s *Store) ListScopes(ctx context.Context, resourceID string, options *ListScopeOptions, pageArgs graphqlutil.PageArgs) (*storeListScopeResult, error)

func (*Store) NewResource

func (s *Store) NewResource(options *NewResourceOptions) *Resource

func (*Store) NewScope

func (s *Store) NewScope(resource *Resource, options *NewScopeOptions) *Scope

func (*Store) RemoveResourceFromClientID

func (s *Store) RemoveResourceFromClientID(ctx context.Context, resourceID, clientID string) error

func (*Store) RemoveScopesFromClientID

func (s *Store) RemoveScopesFromClientID(ctx context.Context, scopeIDs []string, clientID string) error

func (*Store) UpdateResource

func (s *Store) UpdateResource(ctx context.Context, options *UpdateResourceOptions) error

func (*Store) UpdateScope

func (s *Store) UpdateScope(ctx context.Context, options *UpdateScopeOptions) error

type UpdateResourceOptions

type UpdateResourceOptions struct {
	ResourceURI string
	NewName     *string
}

type UpdateScopeOptions

type UpdateScopeOptions struct {
	ResourceURI string
	Scope       string
	NewDesc     *string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL