Documentation ¶
Index ¶
- Constants
- type CredentialAdapter
- type EventAdapter
- type GitAdapter
- type MongoAdapter
- func (adapter *MongoAdapter) Close() error
- func (adapter *MongoAdapter) Create(template types.Template) error
- func (adapter *MongoAdapter) CreateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType) error
- func (adapter *MongoAdapter) CreateType(templateType types.TemplateType) error
- func (adapter *MongoAdapter) CreateVersion(version types.TemplateVersion) error
- func (adapter *MongoAdapter) Delete(user string, templateID cacao_common.ID) error
- func (adapter *MongoAdapter) DeleteCustomFieldType(templateCustomFieldTypeName string) error
- func (adapter *MongoAdapter) DeleteType(templateTypeName cacao_common_service.TemplateTypeName) error
- func (adapter *MongoAdapter) DeleteVersion(versionID cacao_common.ID) error
- func (adapter *MongoAdapter) DisableVersion(versionID cacao_common.ID) (time.Time, error)
- func (adapter *MongoAdapter) Get(user string, templateID cacao_common.ID) (types.Template, error)
- func (adapter *MongoAdapter) GetCustomFieldType(templateCustomFieldTypeName string) (types.TemplateCustomFieldType, error)
- func (adapter *MongoAdapter) GetMock() *mock.Mock
- func (adapter *MongoAdapter) GetType(templateTypeName cacao_common_service.TemplateTypeName) (types.TemplateType, error)
- func (adapter *MongoAdapter) GetVersion(user string, versionID cacao_common.ID) (types.TemplateVersion, error)
- func (adapter *MongoAdapter) Init(config *types.Config) error
- func (adapter *MongoAdapter) InitMock(config *types.Config)
- func (adapter *MongoAdapter) List(user string, includeCacaoReservedPurposes bool) ([]types.Template, error)
- func (adapter *MongoAdapter) ListCustomFieldTypes() ([]types.TemplateCustomFieldType, error)
- func (adapter *MongoAdapter) ListTypes() ([]types.TemplateType, error)
- func (adapter *MongoAdapter) ListTypesForProviderType(providerType cacao_common_service.TemplateProviderType) ([]types.TemplateType, error)
- func (adapter *MongoAdapter) ListVersions(user string, templateID cacao_common.ID) ([]types.TemplateVersion, error)
- func (adapter *MongoAdapter) MockCreate(template types.Template, expectedError error) error
- func (adapter *MongoAdapter) MockCreateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType, expectedError error) error
- func (adapter *MongoAdapter) MockCreateType(templateType types.TemplateType, expectedError error) error
- func (adapter *MongoAdapter) MockCreateVersion(version types.TemplateVersion, expectedError error) error
- func (adapter *MongoAdapter) MockDelete(user string, templateID cacao_common.ID, existingTemplate types.Template, ...) error
- func (adapter *MongoAdapter) MockDeleteCustomFieldType(templateCustomFieldTypeName string, expectedError error) error
- func (adapter *MongoAdapter) MockDeleteType(templateTypeName cacao_common_service.TemplateTypeName, expectedError error) error
- func (adapter *MongoAdapter) MockDeleteVersion(templateTypeName cacao_common_service.TemplateTypeName, expectedError error) error
- func (adapter *MongoAdapter) MockGet(user string, templateID cacao_common.ID, expectedTemplate types.Template, ...) error
- func (adapter *MongoAdapter) MockGetCustomFieldType(templateCustomFieldTypeName string, ...) error
- func (adapter *MongoAdapter) MockGetType(templateTypeName cacao_common_service.TemplateTypeName, ...) error
- func (adapter *MongoAdapter) MockGetVersion(templateTypeName cacao_common_service.TemplateTypeName, ...) error
- func (adapter *MongoAdapter) MockList(user string, includeCacaoReservedPurposes bool, ...) error
- func (adapter *MongoAdapter) MockListCustomFieldTypes(expectedTemplateCustomFieldTypes []types.TemplateCustomFieldType, ...) error
- func (adapter *MongoAdapter) MockListTypes(expectedTemplateTypes []types.TemplateType, expectedError error) error
- func (adapter *MongoAdapter) MockListTypesForProviderType(providerType cacao_common_service.TemplateProviderType, ...) error
- func (adapter *MongoAdapter) MockUpdate(existingTemplate types.Template, newTemplate types.Template, ...) error
- func (adapter *MongoAdapter) MockUpdateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType, expectedError error) error
- func (adapter *MongoAdapter) MockUpdateType(templateType types.TemplateType, expectedError error) error
- func (adapter *MongoAdapter) SoftDelete(user string, templateID cacao_common.ID) error
- func (adapter *MongoAdapter) TemplateSyncFinished(templateID cacao_common.ID) error
- func (adapter *MongoAdapter) TemplateSyncStart(templateID cacao_common.ID) (success bool, err error)
- func (adapter *MongoAdapter) Update(template types.Template, updateFieldNames []string) error
- func (adapter *MongoAdapter) UpdateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType, ...) error
- func (adapter *MongoAdapter) UpdateType(templateType types.TemplateType, updateFieldNames []string) error
- type QueryAdapter
- type TemplateCustomFieldTypeQueryAdapter
- func (adapter *TemplateCustomFieldTypeQueryAdapter) Finalize()
- func (adapter *TemplateCustomFieldTypeQueryAdapter) Init(config *types.Config) error
- func (adapter *TemplateCustomFieldTypeQueryAdapter) QueryTemplateCustomFieldType(actor string, emulator string, ...) (types.TemplateCustomFieldTypeQueryResult, error)
Constants ¶
const ( // TemplateMetadataVersionSupported is the current version of template metadata supported TemplateMetadataVersionSupported string = "3" // TemplateUIMetadataVersionSupported is the current version of template UI metadata supported TemplateUIMetadataVersionSupported string = "1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CredentialAdapter ¶
type CredentialAdapter struct {
// contains filtered or unexported fields
}
CredentialAdapter implements CredentialPort
func NewCredentialAdapter ¶
func NewCredentialAdapter(queryConn *messaging2.NatsConnection) *CredentialAdapter
NewCredentialAdapter ...
func (*CredentialAdapter) GetTemplateSourceCredential ¶
func (adapter *CredentialAdapter) GetTemplateSourceCredential(actor string, emulator string, credentialID string) (cacao_common_service.TemplateSourceCredential, error)
GetTemplateSourceCredential returns template source credential
type EventAdapter ¶
type EventAdapter struct { Config *types.Config IncomingPort ports.IncomingEventPort // internal Connection cacao_common_messaging.StreamingEventService EventWaitGroup sync.WaitGroup // contains filtered or unexported fields }
EventAdapter communicates to IncomingEventPort and implements OutgoingEventPort
func NewEventAdapter ¶
func NewEventAdapter(conn messaging2.EventConnection) *EventAdapter
NewEventAdapter ...
func (*EventAdapter) Finalize ¶
func (adapter *EventAdapter) Finalize()
Finalize finalizes the adapter
func (*EventAdapter) Init ¶
func (adapter *EventAdapter) Init(config *types.Config) error
Init initializes the adapter
func (*EventAdapter) Start ¶
func (adapter *EventAdapter) Start(ctx context.Context, wg *sync.WaitGroup, handlers ports.IncomingEventHandlers) error
Start starts the adapter
type GitAdapter ¶
type GitAdapter struct { Config *types.Config GitStorageOption *cacao_common_git.RAMStorageOption }
GitAdapter implements TemplateSourcePort
func (*GitAdapter) GetTemplateMetadata ¶
func (adapter *GitAdapter) GetTemplateMetadata(source cacao_common_service.TemplateSource, credential cacao_common_service.TemplateSourceCredential) (cacao_common_service.TemplateMetadata, cacao_common_service.TemplateUIMetadata, cacao_common_service.TemplateSource, error)
GetTemplateMetadata returns all template metadata
type MongoAdapter ¶
type MongoAdapter struct { Config *types.Config Store cacao_common_db.ObjectStore Conn *cacao_common_db.MongoDBConnection }
MongoAdapter implements PersistentStoragePort
func (*MongoAdapter) Create ¶
func (adapter *MongoAdapter) Create(template types.Template) error
Create inserts a template
func (*MongoAdapter) CreateCustomFieldType ¶
func (adapter *MongoAdapter) CreateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType) error
CreateCustomFieldType inserts a template custom field type
func (*MongoAdapter) CreateType ¶
func (adapter *MongoAdapter) CreateType(templateType types.TemplateType) error
CreateType inserts a template type
func (*MongoAdapter) CreateVersion ¶
func (adapter *MongoAdapter) CreateVersion(version types.TemplateVersion) error
CreateVersion inserts a template version
func (*MongoAdapter) Delete ¶
func (adapter *MongoAdapter) Delete(user string, templateID cacao_common.ID) error
Delete deletes a template. Only delete the template if user is authorized (user owns the template).
func (*MongoAdapter) DeleteCustomFieldType ¶
func (adapter *MongoAdapter) DeleteCustomFieldType(templateCustomFieldTypeName string) error
DeleteCustomFieldType deletes a template custom field type
func (*MongoAdapter) DeleteType ¶
func (adapter *MongoAdapter) DeleteType(templateTypeName cacao_common_service.TemplateTypeName) error
DeleteType deletes a template type
func (*MongoAdapter) DeleteVersion ¶
func (adapter *MongoAdapter) DeleteVersion(versionID cacao_common.ID) error
DeleteVersion permanently deletes a template version. This permanently deletes the version, there will be no recover after this except recover from backup.
func (*MongoAdapter) DisableVersion ¶
func (adapter *MongoAdapter) DisableVersion(versionID cacao_common.ID) (time.Time, error)
DisableVersion disables a template version.
func (*MongoAdapter) Get ¶
func (adapter *MongoAdapter) Get(user string, templateID cacao_common.ID) (types.Template, error)
Get returns the template with the ID. Return the template only if it exists AND user is authorized (template is public or user owns the template).
func (*MongoAdapter) GetCustomFieldType ¶
func (adapter *MongoAdapter) GetCustomFieldType(templateCustomFieldTypeName string) (types.TemplateCustomFieldType, error)
GetCustomFieldType returns the template custom field type with the name
func (*MongoAdapter) GetMock ¶
func (adapter *MongoAdapter) GetMock() *mock.Mock
GetMock returns Mock
func (*MongoAdapter) GetType ¶
func (adapter *MongoAdapter) GetType(templateTypeName cacao_common_service.TemplateTypeName) (types.TemplateType, error)
GetType returns the template type with the name
func (*MongoAdapter) GetVersion ¶
func (adapter *MongoAdapter) GetVersion(user string, versionID cacao_common.ID) (types.TemplateVersion, error)
GetVersion returns the template version with the ID
func (*MongoAdapter) Init ¶
func (adapter *MongoAdapter) Init(config *types.Config) error
Init initialize mongodb adapter
func (*MongoAdapter) InitMock ¶
func (adapter *MongoAdapter) InitMock(config *types.Config)
InitMock initialize mongodb adapter with mock_objectstore
func (*MongoAdapter) List ¶
func (adapter *MongoAdapter) List(user string, includeCacaoReservedPurposes bool) ([]types.Template, error)
List returns all templates accessible for a user. Only return public templates and templates that user owns.
func (*MongoAdapter) ListCustomFieldTypes ¶
func (adapter *MongoAdapter) ListCustomFieldTypes() ([]types.TemplateCustomFieldType, error)
ListCustomFieldTypes returns all template custom field types
func (*MongoAdapter) ListTypes ¶
func (adapter *MongoAdapter) ListTypes() ([]types.TemplateType, error)
ListTypes returns all template types
func (*MongoAdapter) ListTypesForProviderType ¶
func (adapter *MongoAdapter) ListTypesForProviderType(providerType cacao_common_service.TemplateProviderType) ([]types.TemplateType, error)
ListTypesForProviderType returns all template types for the given ProviderType
func (*MongoAdapter) ListVersions ¶
func (adapter *MongoAdapter) ListVersions(user string, templateID cacao_common.ID) ([]types.TemplateVersion, error)
ListVersions returns all template versions
func (*MongoAdapter) MockCreate ¶
func (adapter *MongoAdapter) MockCreate(template types.Template, expectedError error) error
MockCreate sets expected results for Create
func (*MongoAdapter) MockCreateCustomFieldType ¶
func (adapter *MongoAdapter) MockCreateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType, expectedError error) error
MockCreateCustomFieldType sets expected results for CreateCustomFieldType
func (*MongoAdapter) MockCreateType ¶
func (adapter *MongoAdapter) MockCreateType(templateType types.TemplateType, expectedError error) error
MockCreateType sets expected results for CreateType
func (*MongoAdapter) MockCreateVersion ¶
func (adapter *MongoAdapter) MockCreateVersion(version types.TemplateVersion, expectedError error) error
MockCreateVersion sets expected results for CreateVersion
func (*MongoAdapter) MockDelete ¶
func (adapter *MongoAdapter) MockDelete(user string, templateID cacao_common.ID, existingTemplate types.Template, expectedError error) error
MockDelete sets expected results for Delete
func (*MongoAdapter) MockDeleteCustomFieldType ¶
func (adapter *MongoAdapter) MockDeleteCustomFieldType(templateCustomFieldTypeName string, expectedError error) error
MockDeleteCustomFieldType sets expected results for DeleteCustomFieldType
func (*MongoAdapter) MockDeleteType ¶
func (adapter *MongoAdapter) MockDeleteType(templateTypeName cacao_common_service.TemplateTypeName, expectedError error) error
MockDeleteType sets expected results for DeleteType
func (*MongoAdapter) MockDeleteVersion ¶
func (adapter *MongoAdapter) MockDeleteVersion(templateTypeName cacao_common_service.TemplateTypeName, expectedError error) error
MockDeleteVersion sets expected results for DeleteVersion
func (*MongoAdapter) MockGet ¶
func (adapter *MongoAdapter) MockGet(user string, templateID cacao_common.ID, expectedTemplate types.Template, expectedError error) error
MockGet sets expected results for Get
func (*MongoAdapter) MockGetCustomFieldType ¶
func (adapter *MongoAdapter) MockGetCustomFieldType(templateCustomFieldTypeName string, expectedTemplateCustomFieldType types.TemplateCustomFieldType, expectedError error) error
MockGetCustomFieldType sets expected results for GetCustomFieldType
func (*MongoAdapter) MockGetType ¶
func (adapter *MongoAdapter) MockGetType(templateTypeName cacao_common_service.TemplateTypeName, expectedTemplateType types.TemplateType, expectedError error) error
MockGetType sets expected results for GetType
func (*MongoAdapter) MockGetVersion ¶
func (adapter *MongoAdapter) MockGetVersion(templateTypeName cacao_common_service.TemplateTypeName, expectedTemplateType types.TemplateVersion, expectedError error) error
MockGetVersion sets expected results for GetVersion
func (*MongoAdapter) MockList ¶
func (adapter *MongoAdapter) MockList(user string, includeCacaoReservedPurposes bool, expectedTemplates []types.Template, expectedError error) error
MockList sets expected results for List
func (*MongoAdapter) MockListCustomFieldTypes ¶
func (adapter *MongoAdapter) MockListCustomFieldTypes(expectedTemplateCustomFieldTypes []types.TemplateCustomFieldType, expectedError error) error
MockListCustomFieldTypes sets expected results for ListCustomFieldTypes
func (*MongoAdapter) MockListTypes ¶
func (adapter *MongoAdapter) MockListTypes(expectedTemplateTypes []types.TemplateType, expectedError error) error
MockListTypes sets expected results for ListTypes
func (*MongoAdapter) MockListTypesForProviderType ¶
func (adapter *MongoAdapter) MockListTypesForProviderType(providerType cacao_common_service.TemplateProviderType, expectedTemplateTypes []types.TemplateType, expectedError error) error
MockListTypesForProviderType sets expected results for ListTypesForProviderType
func (*MongoAdapter) MockUpdate ¶
func (adapter *MongoAdapter) MockUpdate(existingTemplate types.Template, newTemplate types.Template, expectedError error) error
MockUpdate sets expected results for Update
func (*MongoAdapter) MockUpdateCustomFieldType ¶
func (adapter *MongoAdapter) MockUpdateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType, expectedError error) error
MockUpdateCustomFieldType sets expected results for UpdateCustomFieldType
func (*MongoAdapter) MockUpdateType ¶
func (adapter *MongoAdapter) MockUpdateType(templateType types.TemplateType, expectedError error) error
MockUpdateType sets expected results for UpdateType
func (*MongoAdapter) SoftDelete ¶
func (adapter *MongoAdapter) SoftDelete(user string, templateID cacao_common.ID) error
SoftDelete soft deletes a template, template is simply being marked as deleted. Only delete the template if user is authorized (user owns the template).
func (*MongoAdapter) TemplateSyncFinished ¶
func (adapter *MongoAdapter) TemplateSyncFinished(templateID cacao_common.ID) error
TemplateSyncFinished releases the sync lock for the template.
func (*MongoAdapter) TemplateSyncStart ¶
func (adapter *MongoAdapter) TemplateSyncStart(templateID cacao_common.ID) (success bool, err error)
TemplateSyncStart insert a template sync object into DB. Return true if successfully acquire the sync lock for the template. Return (false, nil) if there is already a template sync in DB.
func (*MongoAdapter) Update ¶
func (adapter *MongoAdapter) Update(template types.Template, updateFieldNames []string) error
Update updates/edits a template. Only update the template if user is authorized (user owns the template).
func (*MongoAdapter) UpdateCustomFieldType ¶
func (adapter *MongoAdapter) UpdateCustomFieldType(templateCustomFieldType types.TemplateCustomFieldType, updateFieldNames []string) error
UpdateCustomFieldType updates/edits a template custom field type
func (*MongoAdapter) UpdateType ¶
func (adapter *MongoAdapter) UpdateType(templateType types.TemplateType, updateFieldNames []string) error
UpdateType updates/edits a template type
type QueryAdapter ¶
type QueryAdapter struct {
// contains filtered or unexported fields
}
QueryAdapter communicates to IncomingQueryPort
func NewQueryAdapter ¶
func NewQueryAdapter(conn messaging2.QueryConnection) *QueryAdapter
NewQueryAdapter ...
func (*QueryAdapter) Init ¶
func (adapter *QueryAdapter) Init(config *types.Config) error
Init initializes the adapter
func (*QueryAdapter) Start ¶
func (adapter *QueryAdapter) Start(ctx context.Context, wg *sync.WaitGroup, handlers ports.IncomingQueryHandlers) error
Start starts the adapter
type TemplateCustomFieldTypeQueryAdapter ¶
type TemplateCustomFieldTypeQueryAdapter struct { Config *types.Config ParamRegex *regexp.Regexp // contains filtered or unexported fields }
TemplateCustomFieldTypeQueryAdapter implements TemplateCustomFieldTypeQueryPort
func (*TemplateCustomFieldTypeQueryAdapter) Finalize ¶
func (adapter *TemplateCustomFieldTypeQueryAdapter) Finalize()
Finalize finalizes credential adapter
func (*TemplateCustomFieldTypeQueryAdapter) Init ¶
func (adapter *TemplateCustomFieldTypeQueryAdapter) Init(config *types.Config) error
Init initialize template custom field type query adapter
func (*TemplateCustomFieldTypeQueryAdapter) QueryTemplateCustomFieldType ¶
func (adapter *TemplateCustomFieldTypeQueryAdapter) QueryTemplateCustomFieldType(actor string, emulator string, templateCustomFieldType types.TemplateCustomFieldType, queryParams map[string]string) (types.TemplateCustomFieldTypeQueryResult, error)
QueryTemplateCustomFieldType returns template custom field type query result