apps

package
v0.0.0-...-f2fa0db Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockRepository

func NewMockRepository() *mockRepository

func ValidateAppCreateRequest

func ValidateAppCreateRequest(c *auth.CreateAppRequest) error

ValidateAppCreateRequest validates the CreateAppRequest fields.

func ValidateAppUpdateRequest

func ValidateAppUpdateRequest(u *auth.UpdateAppRequest) error

ValidateAppUpdateRequest validates the UpdateAppRequest fields.

func ValidateObjectCreateRequest

func ValidateObjectCreateRequest(c *auth.CreateObjectRequest) error

ValidateObjectCreateRequest validates the CreateObjectRequest fields.

func ValidateObjectUpdateRequest

func ValidateObjectUpdateRequest(u *auth.UpdateObjectRequest) error

ValidateObjectUpdateRequest validates the UpdateObjectRequest fields.

func ValidateResourceCreateRequest

func ValidateResourceCreateRequest(c *auth.CreateResourceRequest) error

ValidateResourceCreateRequest validates the CreateResourceRequest fields.

func ValidateResourceUpdateRequest

func ValidateResourceUpdateRequest(u *auth.UpdateResourceRequest) error

ValidateResourceUpdateRequest validates the UpdateResourceRequest fields.

Types

type API

type API interface {
	grpcgw.Controller
}

func New

func New(srv Service) API

type Repository

type Repository interface {
	// GetApp returns the app with the specified app UUID.
	GetApp(ctx context.Context, uuid string) (entity.App, error)
	// GetAppByName returns the app with the specified app name.
	GetAppByName(ctx context.Context, name string) (entity.App, error)
	// CountApps returns the number of apps.
	CountApps(ctx context.Context) (int64, error)
	// QueryApps returns the list of apps with the given offset and limit.
	QueryApps(ctx context.Context, query string, offset, limit int64) ([]entity.App, int, error)
	// CreateApp saves a new app in the storage.
	CreateApp(ctx context.Context, app entity.App) (string, error)
	// UpdateApp updates the app with given UUID in the storage.
	UpdateApp(ctx context.Context, app entity.App) error
	// DeleteApp removes the app with given UUID from the storage.
	DeleteApp(ctx context.Context, app entity.App) error

	// GetResource returns the Resource with the specified Resource UUID.
	GetResource(ctx context.Context, uuid string) (entity.Resource, error)
	// GetResourceByName returns the app with the specified Resource name.
	GetResourceByName(ctx context.Context, name string) (entity.Resource, error)
	// CountResources returns the number of Resources.
	CountResources(ctx context.Context) (int64, error)
	// QueryResources returns the list of Resources with the given offset and limit.
	QueryResources(ctx context.Context, query string, offset, limit int64) ([]entity.Resource, int, error)
	// CreateResource saves a new Resource in the storage.
	CreateResource(ctx context.Context, app entity.App, resource entity.Resource) (string, error)
	// UpdateResource updates the Resource with given UUID in the storage.
	UpdateResource(ctx context.Context, app entity.App, resource entity.Resource) error
	// DeleteResource removes the Resource with given UUID from the storage.
	DeleteResource(ctx context.Context, resource entity.Resource) error

	// GetObject returns the Object with the specified Object UUID.
	GetObject(ctx context.Context, uuid string) (entity.Object, error)
	// GetObjectByIdentifier returns the app with the specified Object Identifier.
	GetObjectByIdentifier(ctx context.Context, identifier string) (entity.Object, error)
	// CountObjects returns the number of Objects.
	CountObjects(ctx context.Context) (int64, error)
	// QueryObjects returns the list of Objects with the given offset and limit.
	QueryObjects(ctx context.Context, query string, offset, limit int64) ([]entity.Object, int, error)
	// CreateObject saves a new Object in the storage.
	CreateObject(ctx context.Context, app entity.App, object entity.Object) (string, error)
	// UpdateObject updates the Object with given UUID in the storage.
	UpdateObject(ctx context.Context, app entity.App, object entity.Object) error
	// DeleteObject removes the Object with given UUID from the storage.
	DeleteObject(ctx context.Context, object entity.Object) error
}

Repository encapsulates the logic to access apps from the data source.

func NewRepository

func NewRepository(db *db.DB) Repository

NewRepository creates a new app repository

type Service

type Service interface {
	GetApp(ctx context.Context, uuid string) (*auth.App, error)
	QueryApps(ctx context.Context, query string, offset, limit int64) (*auth.ListAppsResponse, error)
	CountApps(ctx context.Context) (int64, error)
	CreateApp(ctx context.Context, input *auth.CreateAppRequest) (*auth.App, error)
	UpdateApp(ctx context.Context, input *auth.UpdateAppRequest) (*auth.App, error)
	DeleteApp(ctx context.Context, uuid string) (*auth.App, error)

	GetResource(ctx context.Context, uuid string) (*auth.Resource, error)
	QueryResources(ctx context.Context, query string, offset, limit int64) (*auth.ListResourcesResponse, error)
	CountResources(ctx context.Context) (int64, error)
	CreateResource(ctx context.Context, input *auth.CreateResourceRequest) (*auth.Resource, error)
	UpdateResource(ctx context.Context, input *auth.UpdateResourceRequest) (*auth.Resource, error)
	DeleteResource(ctx context.Context, uuid string) (*auth.Resource, error)

	GetObject(ctx context.Context, uuid string) (*auth.Object, error)
	QueryObjects(ctx context.Context, query string, offset, limit int64) (*auth.ListObjectsResponse, error)
	CountObjects(ctx context.Context) (int64, error)
	CreateObject(ctx context.Context, input *auth.CreateObjectRequest) (*auth.Object, error)
	UpdateObject(ctx context.Context, input *auth.UpdateObjectRequest) (*auth.Object, error)
	DeleteObject(ctx context.Context, uuid string) (*auth.Object, error)
}

Service encapsulates use case logic for apps.

func NewService

func NewService(repo Repository) Service

NewService creates a new app service.

Jump to

Keyboard shortcuts

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