referentialintegrity

package
v0.0.0-...-29e199f Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateEntryInput

type CreateEntryInput struct {
	// ResourceID is the unique identifier of the resource that references another resource.
	ResourceID string `valid:"required"`
	// ResourceKind is the kind of the resource that references another resource.
	ResourceKind ResourceKind `valid:"required"`
	// ParentResourceID is the unique identifier of the resource being referenced.
	ParentResourceID string `valid:"required"`
	// ParentResourceKind is the kind of the resource being referenced.
	ParentResourceKind ResourceKind `valid:"required"`
}

CreateEntryInput configures the creation of a ReferentialIntegrityEntry.

type CreateEntryOutput

type CreateEntryOutput struct {
	ReferentialIntegrityEntry
}

CreateEntryOutput defines the output of listing ReferentialIntegrityEntry resources.

type DefaultUseCase

type DefaultUseCase struct {
	// contains filtered or unexported fields
}

DefaultUseCase default management of ReferentialIntegrityEntry in configuration implementation.

func ProvideDefaultUseCase

func ProvideDefaultUseCase(options DefaultUseCaseOptions) (*DefaultUseCase, error)

ProvideDefaultUseCase provides a DefaultUseCase with the given options

func (*DefaultUseCase) CreateEntry

func (u *DefaultUseCase) CreateEntry(ctx context.Context, input CreateEntryInput) (*CreateEntryOutput, error)

func (*DefaultUseCase) DeleteEntry

func (u *DefaultUseCase) DeleteEntry(ctx context.Context, input DeleteEntryInput) (*DeleteEntryOutput, error)

func (*DefaultUseCase) DeleteMyEntriesIfAny

func (u *DefaultUseCase) DeleteMyEntriesIfAny(ctx context.Context, input DeleteMyEntriesIfAnyInput) error

func (*DefaultUseCase) GetEntry

func (u *DefaultUseCase) GetEntry(ctx context.Context, input GetEntryInput) (*GetEntryOutput, error)

func (*DefaultUseCase) GetEntryByResourceAndParent

func (*DefaultUseCase) ListEntries

func (u *DefaultUseCase) ListEntries(ctx context.Context, input ListEntriesInput) (*ListEntriesOutput, error)

func (*DefaultUseCase) ListMyChildrenEntries

type DefaultUseCaseOptions

type DefaultUseCaseOptions struct {
	// Storage is the persistence adapter of the references between resources.
	Storage ReferentialIntegrityStorage
}

DefaultUseCaseOptions configures a DefaultUseCase

type DeleteEntryInput

type DeleteEntryInput struct {
	entities.StandardID
}

DeleteEntryInput configures the deletion of a ReferentialIntegrityEntry.

type DeleteEntryOutput

type DeleteEntryOutput struct {
	ReferentialIntegrityEntry
}

DeleteEntryOutput defines the output of deleting a ReferentialIntegrityEntry.

type DeleteMyEntriesIfAnyInput

type DeleteMyEntriesIfAnyInput struct {
	// ResourceID is the unique identifier of the resource.
	ResourceID string `valid:"required"`
	// ResourceKind is the kind of the resource.
	ResourceKind ResourceKind `valid:"required"`
}

DeleteMyEntriesIfAnyInput configures the deletion of all ReferentialIntegrityEntry that matches the specified ResourceID and ResourceKind.

type GetEntryByResourceAndParentInput

type GetEntryByResourceAndParentInput struct {
	// ResourceID is the unique identifier of the resource that references another resource.
	ResourceID string `valid:"required"`
	// ResourceKind is the kind of the resource that references another resource.
	ResourceKind ResourceKind `valid:"required"`
	// ParentResourceID is the unique identifier of the resource being referenced.
	ParentResourceID string `valid:"required"`
	// ParentResourceKind is the kind of the resource being referenced.
	ParentResourceKind ResourceKind `valid:"required"`
}

GetEntryByResourceAndParentInput defines the input for getting a ReferentialIntegrityEntry given the specified parameters.

type GetEntryByResourceAndParentOutput

type GetEntryByResourceAndParentOutput struct {
	ReferentialIntegrityEntry
}

GetEntryByResourceAndParentOutput defines the output of getting a ReferentialIntegrityEntry by the specified parameters.

type GetEntryInput

type GetEntryInput struct {
	entities.StandardID
}

GetEntryInput defines the input for getting a ReferentialIntegrityEntry.

type GetEntryOutput

type GetEntryOutput struct {
	ReferentialIntegrityEntry
}

GetEntryOutput defines the output of getting a ReferentialIntegrityEntry.

type ListEntriesInput

type ListEntriesInput struct {
	// Resource to filter referential integrity entries for.
	Resource *Resource `valid:"optional"`
	// Parent resource to filter referential integrity entries for.
	Parent *Resource `valid:"optional"`
	// PageLimit maximum amount of Application in list output.
	PageLimit int `valid:"natural"`
	// PageOffset amount of Application elapsed in list output.
	PageOffset int `valid:"natural"`
	// OrderBy whether to order by last update date.
	OrderBy string
	// OrderDirection the direction of the OrderBy.
	OrderDirection string
}

ListEntriesInput defines the options to list ReferentialIntegrityEntry resources.

type ListEntriesOutput

type ListEntriesOutput struct {
	ReferentialIntegrityEntryCollection
}

ListEntriesOutput defines the output of listing all ReferentialIntegrityEntry resources.

type ListMyChildrenEntriesInput

type ListMyChildrenEntriesInput struct {
	// ParentResourceID is the unique identifier of the resource being referenced.
	ParentResourceID string `valid:"required"`
	// ParentResourceKind is the kind of the resource being referenced.
	ParentResourceKind ResourceKind `valid:"required"`
}

ListMyChildrenEntriesInput defines the options to list ReferentialIntegrityEntry resources that are referencing the specified resource.

type ListMyChildrenEntriesOutput

type ListMyChildrenEntriesOutput struct {
	ReferentialIntegrityEntryCollection
}

ListMyChildrenEntriesOutput defines the output of listing all ReferentialIntegrityEntry resources that are referencing the specified resource.

type ReferentialIntegrityEntry

type ReferentialIntegrityEntry struct {
	entities.StandardResource
	// ResourceID is the unique identifier of the resource that references to another resource.
	ResourceID string
	// ResourceKind is the kind of the resource that references to another resource.
	ResourceKind ResourceKind
	// ParentResourceID is the unique identifier of the resource being referenced.
	ParentResourceID string
	// ParentResourceKind is the kind of the resource being referenced.
	ParentResourceKind ResourceKind
}

ReferentialIntegrityEntry represents an entry for managing referential integrity between resources.

type ReferentialIntegrityEntryCollection

type ReferentialIntegrityEntryCollection struct {
	// Items is a collection of ReferentialIntegrityEntry.
	Items []ReferentialIntegrityEntry
	// StandardCollectionPage is the page data of the collection.
	entities.StandardCollectionPage
}

ReferentialIntegrityEntryCollection defines a collection of ReferentialIntegrityEntry resources.

type ReferentialIntegrityFilters

type ReferentialIntegrityFilters interface {
	// FilterByParent filters entries by the specified parent ID and Kind.
	FilterByParent(parentResourceID string, parentResourceKind string) ReferentialIntegrityFilters
	// FilterByResource filters entries by the specified ID and Kind.
	FilterByResource(resourceID string, resourceKind string) ReferentialIntegrityFilters
	// OrderByCreationDate orders ReferentialIntegrityEntry in storage by creation date.
	OrderByCreationDate(orderDirection persistence.OrderDirection) ReferentialIntegrityFilters
	// OrderByLastUpdateDate orders ReferentialIntegrityEntry in storage by last update date.
	OrderByLastUpdateDate(orderDirection persistence.OrderDirection) ReferentialIntegrityFilters
	// Paged limits the maximum amount of items to limit parameter and starts the list in offset parameter.
	Paged(limit int, offset int) ReferentialIntegrityFilters
}

ReferentialIntegrityFilters defines filter options for retrieving ReferentialIntegrityEntry from storage.

type ReferentialIntegrityStorage

type ReferentialIntegrityStorage interface {
	// Add a ReferentialIntegrityEntry in storage.
	Add(ctx context.Context, data ReferentialIntegrityEntry) (*ReferentialIntegrityEntry, error)
	// Get a ReferentialIntegrityEntry from storage.
	Get(ctx context.Context, id entities.StandardID) (*ReferentialIntegrityEntry, error)
	// Remove a ReferentialIntegrityEntry in storage.
	Remove(ctx context.Context, id entities.StandardID) (*ReferentialIntegrityEntry, error)
	// RemoveAllFromResource removes all entries where the resource  from storage.
	RemoveAllFromResource(ctx context.Context, resourceID, resourceKind string) (*ReferentialIntegrityEntryCollection, error)
	// All ReferentialIntegrityEntry in storage.
	All(ctx context.Context, filters ReferentialIntegrityFilters) (*ReferentialIntegrityEntryCollection, error)
	// Filter all ReferentialIntegrityEntry by specific properties.
	Filter() ReferentialIntegrityFilters
}

ReferentialIntegrityStorage defines the functionality to interact with the ReferentialIntegrityEntry in storage.

type ReferentialIntegrityUseCase

type ReferentialIntegrityUseCase interface {
	// CreateEntry creates a ReferentialIntegrityEntry. It returns the created ReferentialIntegrityEntry or an error if it fails.
	CreateEntry(ctx context.Context, input CreateEntryInput) (*CreateEntryOutput, error)
	// GetEntry returns the requested ReferentialIntegrityEntry or an error if it fails.
	GetEntry(ctx context.Context, input GetEntryInput) (*GetEntryOutput, error)
	// ListEntries returns all the ReferentialIntegrityEntry resources or an error if it fails.
	ListEntries(ctx context.Context, input ListEntriesInput) (*ListEntriesOutput, error)
	// DeleteEntry deletes a ReferentialIntegrityEntry. It returns the deleted ReferentialIntegrityEntry or an error if it fails.
	DeleteEntry(ctx context.Context, input DeleteEntryInput) (*DeleteEntryOutput, error)
	// ListMyChildrenEntries returns all the ReferentialIntegrityEntry resources referencing a specific resource or an error if it fails.
	ListMyChildrenEntries(ctx context.Context, input ListMyChildrenEntriesInput) (*ListMyChildrenEntriesOutput, error)
	// DeleteMyEntriesIfAny deletes a ReferentialIntegrityEntry by its ID and Kind. It returns the deleted ReferentialIntegrityEntry or an error if it fails.
	DeleteMyEntriesIfAny(ctx context.Context, input DeleteMyEntriesIfAnyInput) error
	// GetEntryByResourceAndParent returns the requested ReferentialIntegrityEntry or an error if it fails.
	GetEntryByResourceAndParent(ctx context.Context, input GetEntryByResourceAndParentInput) (*GetEntryByResourceAndParentOutput, error)
}

ReferentialIntegrityUseCase defines how to interact with ReferentialIntegrityEntry resources.

type Resource

type Resource struct {
	// ResourceID to filter referential integrity entries for.
	ResourceID string `valid:"required"`
	// ResourceKind to filter referential integrity entries for.
	ResourceKind ResourceKind `valid:"required"`
}

type ResourceKind

type ResourceKind string
const (
	KindAccount     ResourceKind = "account"
	KindApplication ResourceKind = "application"
	KindHSMModule   ResourceKind = "hardware_security_module"
	KindHSMSlot     ResourceKind = "hardware_security_module_slot"
	KindUser        ResourceKind = "user"
	KindAdmin       ResourceKind = "admin"
)

Jump to

Keyboard shortcuts

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