contract

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package contract defines the different tenant business contracts

Package contract defines the different tenant business contracts

Package contract defines the different tenant business contracts

Package contract defines the different tenant business contracts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTenantAlreadyExistsError

func NewTenantAlreadyExistsError() error

NewTenantAlreadyExistsError creates a new TenantAlreadyExistsError error

func NewTenantNotFoundError

func NewTenantNotFoundError(tenantID string) error

NewTenantNotFoundError creates a new TenantNotFoundError error tenantID: Mandatory. The tenantID that did not match any existing tenant

func NewUnknownError

func NewUnknownError(errorMessage string) error

NewUnknownError creates a new UnknownError error

Types

type CreateTenantRequest

type CreateTenantRequest struct {
	Tenant models.Tenant
}

CreateTenantRequest contains the request to create a new tenant

func (*CreateTenantRequest) Validate

func (val *CreateTenantRequest) Validate() error

Validate validates the CreateTenantRequest model and return error if the validation failes Returns error if validation failes

type CreateTenantResponse

type CreateTenantResponse struct {
	TenantID string
}

CreateTenantResponse contains the result of creating a new tenant

func (*CreateTenantResponse) Validate

func (val *CreateTenantResponse) Validate() error

Validate validates the CreateTenantResponse model and return error if the validation failes Returns error if validation failes

type DeleteTenantRequest

type DeleteTenantRequest struct {
	TenantID string
}

DeleteTenantRequest contains the request to delete an existing tenant

func (*DeleteTenantRequest) Validate

func (val *DeleteTenantRequest) Validate() error

Validate validates the DeleteTenantRequest model and return error if the validation failes Returns error if validation failes

type DeleteTenantResponse

type DeleteTenantResponse struct {
}

DeleteTenantResponse contains the result of deleting an existing tenant

func (*DeleteTenantResponse) Validate

func (val *DeleteTenantResponse) Validate() error

Validate validates the DeleteTenantResponse model and return error if the validation failes Returns error if validation failes

type ReadTenantRequest

type ReadTenantRequest struct {
	TenantID string
}

ReadTenantRequest contains the request to read an existing tenant

func (*ReadTenantRequest) Validate

func (val *ReadTenantRequest) Validate() error

Validate validates the ReadTenantRequest model and return error if the validation failes Returns error if validation failes

type ReadTenantResponse

type ReadTenantResponse struct {
	Tenant models.Tenant
}

ReadTenantResponse contains the result of reading an existing tenant

func (*ReadTenantResponse) Validate

func (val *ReadTenantResponse) Validate() error

Validate validates the ReadTenantResponse model and return error if the validation failes Returns error if validation failes

type TenantAlreadyExistsError

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

TenantAlreadyExistsError indicates that the tenant with the given information already exists

func (TenantAlreadyExistsError) Error

func (e TenantAlreadyExistsError) Error() string

Error returns message for the TenantAlreadyExistsError error type Returns the error nessage

type TenantNotFoundError

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

TenantNotFoundError indicates that the tenant with the given tenantID does not exist

func (TenantNotFoundError) Error

func (e TenantNotFoundError) Error() string

Error returns message for the TenantNotFoundError error type Returns the error nessage

type TenantServiceContract

type TenantServiceContract interface {
	// CreateTenant creates a new tenant.
	// context: Mandatory The reference to the context
	// request: Mandatory. The request to create a new tenant
	// Returns either the result of creating new tenant or error if something goes wrong.
	CreateTenant(
		ctx context.Context,
		request *CreateTenantRequest) (*CreateTenantResponse, error)

	// ReadTenant read an existing tenant
	// context: Mandatory The reference to the context
	// request: Mandatory. The request to read an esiting tenant
	// Returns either the result of reading an exiting tenant or error if something goes wrong.
	ReadTenant(
		ctx context.Context,
		request *ReadTenantRequest) (*ReadTenantResponse, error)

	// UpdateTenant update an existing tenant
	// context: Mandatory The reference to the context
	// request: Mandatory. The request to update an esiting tenant
	// Returns either the result of updateing an exiting tenant or error if something goes wrong.
	UpdateTenant(
		ctx context.Context,
		request *UpdateTenantRequest) (*UpdateTenantResponse, error)

	// DeleteTenant delete an existing tenant
	// context: Mandatory The reference to the context
	// request: Mandatory. The request to delete an esiting tenant
	// Returns either the result of deleting an exiting tenant or error if something goes wrong.
	DeleteTenant(
		ctx context.Context,
		request *DeleteTenantRequest) (*DeleteTenantResponse, error)
}

TenantServiceContract declares the service that can create new tenant, read, update and delete existing tenants.

type UnknownError

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

UnknownError indicates that the tenant with the given information already exists

func (UnknownError) Error

func (e UnknownError) Error() string

Error returns message for the UnknownError error type Returns the error nessage

type UpdateTenantRequest

type UpdateTenantRequest struct {
	TenantID string
	Tenant   models.Tenant
}

UpdateTenantRequest contains the request to update an existing tenant

func (*UpdateTenantRequest) Validate

func (val *UpdateTenantRequest) Validate() error

Validate validates the UpdateTenantRequest model and return error if the validation failes Returns error if validation failes

type UpdateTenantResponse

type UpdateTenantResponse struct {
}

UpdateTenantResponse contains the result of updating an existing tenant

func (*UpdateTenantResponse) Validate

func (val *UpdateTenantResponse) Validate() error

Validate validates the UpdateTenantResponse model and return error if the validation failes Returns error if validation failes

Jump to

Keyboard shortcuts

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