services

package
v0.0.0-...-986c4a6 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PatchOpSchema = "urn:ietf:params:scim:api:messages:2.0:PatchOp"

	// Patch operations
	OpAdd     = "add"
	OpReplace = "replace"
	OpRemove  = "remove"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	Payload *prop.Resource
}

type CreateResponse

type CreateResponse struct {
	Resource *prop.Resource
	Location string
	Version  string
}

type CreateService

type CreateService struct {
	Logger   log.Logger
	Filters  []filter.ForResource
	Database db.DB
	Event    event.Publisher
}

func (*CreateService) CreateResource

func (s *CreateService) CreateResource(ctx context.Context, request *CreateRequest) (cr *CreateResponse, err error)

type DeleteRequest

type DeleteRequest struct {
	ResourceID    string
	MatchCriteria func(resource *prop.Resource) bool
}

type DeleteService

type DeleteService struct {
	Logger                log.Logger
	Database              db.DB
	Event                 event.Publisher
	ServiceProviderConfig *spec.ServiceProviderConfig
}

func (*DeleteService) DeleteResource

func (s *DeleteService) DeleteResource(ctx context.Context, request *DeleteRequest) error

type GetRequest

type GetRequest struct {
	*crud.Projection
	ResourceID string
}

type GetResponse

type GetResponse struct {
	Resource *prop.Resource
	Location string
	Version  string
}

type GetService

type GetService struct {
	Logger   log.Logger
	Database db.DB
}

func (*GetService) GetResource

func (s *GetService) GetResource(ctx context.Context, request *GetRequest) (*GetResponse, error)

type PatchOperation

type PatchOperation struct {
	Op    string          `json:"op"`
	Path  string          `json:"path"`
	Value json.RawMessage `json:"value"`
}

func (*PatchOperation) ParseValue

func (po *PatchOperation) ParseValue(resource *prop.Resource) (interface{}, error)

type PatchRequest

type PatchRequest struct {
	Schemas       []string                           `json:"schemas"`
	Operations    []PatchOperation                   `json:"Operations"`
	ResourceID    string                             `json:"-"`
	MatchCriteria func(resource *prop.Resource) bool `json:"-"`
}

func (*PatchRequest) Validate

func (pr *PatchRequest) Validate() error

type PatchResponse

type PatchResponse struct {
	Resource   *prop.Resource
	Location   string
	OldVersion string
	NewVersion string
}

type PatchService

type PatchService struct {
	Logger                log.Logger
	PrePatchFilters       []filter.ForResource
	PostPatchFilters      []filter.ForResource
	Database              db.DB
	ServiceProviderConfig *spec.ServiceProviderConfig
	Event                 event.Publisher
}

func (*PatchService) PatchResource

func (s *PatchService) PatchResource(ctx context.Context, request *PatchRequest) (*PatchResponse, error)

type QueryRequest

type QueryRequest struct {
	Filter     string
	Sort       *crud.Sort
	Pagination *crud.Pagination
	Projection *crud.Projection
}

func (*QueryRequest) ValidateAndDefault

func (q *QueryRequest) ValidateAndDefault() error

type QueryResponse

type QueryResponse struct {
	TotalResults int
	StartIndex   int
	ItemsPerPage int
	Resources    []*prop.Resource
}

type QueryService

type QueryService struct {
	Logger                log.Logger
	Database              db.DB
	ServiceProviderConfig *spec.ServiceProviderConfig
}

func (*QueryService) QueryResource

func (s *QueryService) QueryResource(ctx context.Context, request *QueryRequest) (resp *QueryResponse, err error)

type ReplaceRequest

type ReplaceRequest struct {
	ResourceID    string
	Payload       *prop.Resource
	MatchCriteria func(resource *prop.Resource) bool
}

type ReplaceResponse

type ReplaceResponse struct {
	Resource   *prop.Resource
	Location   string
	OldVersion string
	NewVersion string
}

type ReplaceService

type ReplaceService struct {
	Logger                log.Logger
	Filters               []filter.ForResource
	Database              db.DB
	ServiceProviderConfig *spec.ServiceProviderConfig
	Event                 event.Publisher
}

func (*ReplaceService) ReplaceResource

func (s *ReplaceService) ReplaceResource(ctx context.Context, request *ReplaceRequest) (*ReplaceResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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