Documentation
¶
Index ¶
- Variables
- type State
- type StateMachine
- func (sm *StateMachine) IsValidTransition(ctx context.Context, sourceState, targetState *models.BundleState) error
- func (sm *StateMachine) Transition(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, ...) error
- func (sm *StateMachine) TransitionBundle(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, ...) (*models.Bundle, error)
- type StateMachineBundleAPI
- func (s *StateMachineBundleAPI) CheckAllBundleContentsAreApproved(ctx context.Context, bundleID string) (bool, error)
- func (s *StateMachineBundleAPI) CheckBundleExists(ctx context.Context, bundleID string) (bool, error)
- func (s *StateMachineBundleAPI) CheckBundleExistsByTitle(ctx context.Context, title string) (bool, error)
- func (s *StateMachineBundleAPI) CheckBundleExistsByTitleUpdate(ctx context.Context, title, excludeID string) (bool, error)
- func (s *StateMachineBundleAPI) CheckContentItemExistsByDatasetEditionVersion(ctx context.Context, datasetID, editionID string, versionID int) (bool, error)
- func (s *StateMachineBundleAPI) CheckPolicyExists(ctx context.Context, authToken, policyID string) (bool, error)
- func (s *StateMachineBundleAPI) CreateBundle(ctx context.Context, bundle *models.Bundle, ...) (int, *models.Bundle, *models.Error, error)
- func (s *StateMachineBundleAPI) CreateBundlePolicies(ctx context.Context, authToken string, previewTeams *[]models.PreviewTeam, ...) error
- func (s *StateMachineBundleAPI) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error
- func (s *StateMachineBundleAPI) CreateEvent(ctx context.Context, authEntityData *models.AuthEntityData, ...) error
- func (s *StateMachineBundleAPI) DeleteBundle(ctx context.Context, bundleID string, authEntityData *models.AuthEntityData) (int, *models.Error, error)
- func (s *StateMachineBundleAPI) DeleteContentItem(ctx context.Context, contentItemID string) error
- func (s *StateMachineBundleAPI) GetBundle(ctx context.Context, bundleID string) (*models.Bundle, error)
- func (s *StateMachineBundleAPI) GetBundleAndValidateETag(ctx context.Context, bundleID, suppliedETag string) (*models.Bundle, error)
- func (s *StateMachineBundleAPI) GetBundleContents(ctx context.Context, bundleID string, offset, limit int, ...) ([]*models.ContentItem, int, error)
- func (s *StateMachineBundleAPI) GetContentItemByBundleIDAndContentItemID(ctx context.Context, bundleID, contentItemID string) (*models.ContentItem, error)
- func (s *StateMachineBundleAPI) GetContentItemsByBundleID(ctx context.Context, bundleID string) ([]*models.ContentItem, error)
- func (s *StateMachineBundleAPI) ListBundleEvents(ctx context.Context, offset, limit int, bundleID string, ...) ([]*models.Event, int, error)
- func (s *StateMachineBundleAPI) ListBundles(ctx context.Context, offset, limit int, bundleFilters *filters.BundleFilters) ([]*models.Bundle, int, error)
- func (s *StateMachineBundleAPI) PutBundle(ctx context.Context, bundleID string, ...) (*models.Bundle, error)
- func (s *StateMachineBundleAPI) UpdateBundle(ctx context.Context, bundleID string, bundle *models.Bundle) (*models.Bundle, error)
- func (s *StateMachineBundleAPI) UpdateBundleETag(ctx context.Context, bundleID, email string) (*models.Bundle, error)
- func (s *StateMachineBundleAPI) UpdateBundleState(ctx context.Context, bundleID, suppliedETag string, ...) (*models.Bundle, error)
- func (s *StateMachineBundleAPI) UpdateContentItemDatasetInfo(ctx context.Context, contentItemID, title, state string) error
- func (s *StateMachineBundleAPI) UpdateContentItemsWithDatasetInfo(ctx context.Context, bundleID string, authHeaders datasetAPISDK.Headers) error
- func (s *StateMachineBundleAPI) UpdateDatasetVersionReleaseDate(ctx context.Context, releaseDate *time.Time, datasetID, editionID string, ...) error
- func (s *StateMachineBundleAPI) ValidateBundleRules(ctx context.Context, bundleUpdate, currentBundle *models.Bundle) []*models.Error
- func (s *StateMachineBundleAPI) ValidateScheduledAt(bundle *models.Bundle) error
- type Transition
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Draft = State{Name: "DRAFT"} InReview = State{Name: "IN_REVIEW"} Approved = State{Name: "APPROVED"} Published = State{Name: "PUBLISHED"} )
list of states for the state machine
Functions ¶
This section is empty.
Types ¶
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
func NewStateMachine ¶
func NewStateMachine(ctx context.Context, states []State, transitions []Transition, datastore store.Datastore) *StateMachine
func (*StateMachine) IsValidTransition ¶ added in v1.4.0
func (sm *StateMachine) IsValidTransition(ctx context.Context, sourceState, targetState *models.BundleState) error
IsValidTransition validates whether the sourceState can transition to the targetState. If not, an error is returned
func (*StateMachine) Transition ¶
func (sm *StateMachine) Transition(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, currentBundle, bundleUpdate *models.Bundle) error
func (*StateMachine) TransitionBundle ¶ added in v1.4.0
func (sm *StateMachine) TransitionBundle(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, bundle *models.Bundle, targetState *models.BundleState, authEntityData *models.AuthEntityData) (*models.Bundle, error)
type StateMachineBundleAPI ¶
type StateMachineBundleAPI struct {
Datastore store.Datastore
StateMachine *StateMachine
DatasetAPIClient datasetAPISDK.Clienter
PermissionsAPIClient permissionsAPISDK.Clienter
DataBundleSlackClient slack.Clienter
}
func Setup ¶
func Setup(datastore store.Datastore, stateMachine *StateMachine, datasetAPIClient datasetAPISDK.Clienter, permissionsAPIClient permissionsAPISDK.Clienter, dataBundleSlackClient slack.Clienter) *StateMachineBundleAPI
func (*StateMachineBundleAPI) CheckAllBundleContentsAreApproved ¶
func (*StateMachineBundleAPI) CheckBundleExists ¶ added in v1.3.0
func (*StateMachineBundleAPI) CheckBundleExistsByTitle ¶ added in v1.4.0
func (*StateMachineBundleAPI) CheckBundleExistsByTitleUpdate ¶ added in v1.4.0
func (*StateMachineBundleAPI) CheckContentItemExistsByDatasetEditionVersion ¶ added in v1.3.0
func (*StateMachineBundleAPI) CheckPolicyExists ¶ added in v1.13.0
func (s *StateMachineBundleAPI) CheckPolicyExists(ctx context.Context, authToken, policyID string) (bool, error)
CheckPolicyExists checks if a policy with the given ID exists
func (*StateMachineBundleAPI) CreateBundle ¶ added in v1.4.0
func (*StateMachineBundleAPI) CreateBundlePolicies ¶ added in v1.12.0
func (s *StateMachineBundleAPI) CreateBundlePolicies(ctx context.Context, authToken string, previewTeams *[]models.PreviewTeam, role models.Role) error
CreateBundlePolicies creates a new policy for each preview team with the provided role
func (*StateMachineBundleAPI) CreateContentItem ¶ added in v1.3.0
func (s *StateMachineBundleAPI) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error
func (*StateMachineBundleAPI) CreateEvent ¶ added in v1.10.0
func (s *StateMachineBundleAPI) CreateEvent(ctx context.Context, authEntityData *models.AuthEntityData, action models.Action, bundle *models.Bundle, contentItem *models.ContentItem) error
func (*StateMachineBundleAPI) DeleteBundle ¶ added in v1.4.0
func (s *StateMachineBundleAPI) DeleteBundle(ctx context.Context, bundleID string, authEntityData *models.AuthEntityData) (int, *models.Error, error)
func (*StateMachineBundleAPI) DeleteContentItem ¶ added in v1.4.0
func (s *StateMachineBundleAPI) DeleteContentItem(ctx context.Context, contentItemID string) error
func (*StateMachineBundleAPI) GetBundleAndValidateETag ¶ added in v1.4.0
func (*StateMachineBundleAPI) GetBundleContents ¶ added in v1.4.0
func (s *StateMachineBundleAPI) GetBundleContents(ctx context.Context, bundleID string, offset, limit int, authHeaders datasetAPISDK.Headers) ([]*models.ContentItem, int, error)
func (*StateMachineBundleAPI) GetContentItemByBundleIDAndContentItemID ¶ added in v1.4.0
func (s *StateMachineBundleAPI) GetContentItemByBundleIDAndContentItemID(ctx context.Context, bundleID, contentItemID string) (*models.ContentItem, error)
func (*StateMachineBundleAPI) GetContentItemsByBundleID ¶ added in v1.4.0
func (s *StateMachineBundleAPI) GetContentItemsByBundleID(ctx context.Context, bundleID string) ([]*models.ContentItem, error)
func (*StateMachineBundleAPI) ListBundleEvents ¶ added in v1.3.0
func (*StateMachineBundleAPI) ListBundles ¶
func (s *StateMachineBundleAPI) ListBundles(ctx context.Context, offset, limit int, bundleFilters *filters.BundleFilters) ([]*models.Bundle, int, error)
func (*StateMachineBundleAPI) UpdateBundle ¶ added in v1.4.0
func (*StateMachineBundleAPI) UpdateBundleETag ¶ added in v1.3.0
func (*StateMachineBundleAPI) UpdateBundleState ¶ added in v1.4.0
func (s *StateMachineBundleAPI) UpdateBundleState(ctx context.Context, bundleID, suppliedETag string, targetState models.BundleState, authEntityData *models.AuthEntityData) (*models.Bundle, error)
func (*StateMachineBundleAPI) UpdateContentItemDatasetInfo ¶ added in v1.4.0
func (s *StateMachineBundleAPI) UpdateContentItemDatasetInfo(ctx context.Context, contentItemID, title, state string) error
func (*StateMachineBundleAPI) UpdateContentItemsWithDatasetInfo ¶ added in v1.4.0
func (s *StateMachineBundleAPI) UpdateContentItemsWithDatasetInfo(ctx context.Context, bundleID string, authHeaders datasetAPISDK.Headers) error
func (*StateMachineBundleAPI) UpdateDatasetVersionReleaseDate ¶ added in v1.10.0
func (s *StateMachineBundleAPI) UpdateDatasetVersionReleaseDate(ctx context.Context, releaseDate *time.Time, datasetID, editionID string, versionID int, authHeaders datasetAPISDK.Headers) error
func (*StateMachineBundleAPI) ValidateBundleRules ¶ added in v1.4.0
func (s *StateMachineBundleAPI) ValidateBundleRules(ctx context.Context, bundleUpdate, currentBundle *models.Bundle) []*models.Error
ValidateBundleRules validates the rules for bundle updates
func (*StateMachineBundleAPI) ValidateScheduledAt ¶ added in v1.4.0
func (s *StateMachineBundleAPI) ValidateScheduledAt(bundle *models.Bundle) error
type Transition ¶
Click to show internal directories.
Click to hide internal directories.