Documentation
¶
Index ¶
- Variables
- func ApproveBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, ...) (*models.Bundle, error)
- func DraftBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, ...) (*models.Bundle, error)
- func PublishBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, ...) (*models.Bundle, error)
- func PublishContentItems(ctx context.Context, smBundle StateMachineBundleAPI, ...)
- func ReviewBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, ...) (*models.Bundle, error)
- func UpdateContentItemCreateEvent(ctx context.Context, smBundle StateMachineBundleAPI, ...) error
- type State
- type StateMachine
- type StateMachineBundleAPI
- func (s *StateMachineBundleAPI) AddPolicyConditionsForAddedPreviewTeams(ctx context.Context, authToken, bundleID string, ...) error
- func (s *StateMachineBundleAPI) AddPolicyConditionsForContentItem(ctx context.Context, authToken string, bundle *models.Bundle, ...) error
- 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, bundleUpdate *models.Bundle, ...) (*models.Bundle, error)
- func (s *StateMachineBundleAPI) RemovePolicyConditionsForContentItem(ctx context.Context, authToken string, bundle *models.Bundle, ...) error
- func (s *StateMachineBundleAPI) RemovePolicyConditionsForRemovedPreviewTeams(ctx context.Context, authToken, bundleID string, ...) 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
- type Transition
Constants ¶
This section is empty.
Variables ¶
var Approved = State{ Name: "APPROVED", EnterFunc: ApproveBundle, }
var Draft = State{ Name: "DRAFT", EnterFunc: DraftBundle, }
var InReview = State{ Name: "IN_REVIEW", EnterFunc: ReviewBundle, }
var Published = State{ Name: "PUBLISHED", EnterFunc: PublishBundle, }
list of states for the state machine
Functions ¶
func ApproveBundle ¶ added in v1.22.0
func ApproveBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)
func DraftBundle ¶ added in v1.22.0
func DraftBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)
func PublishBundle ¶ added in v1.22.0
func PublishBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)
func PublishContentItems ¶ added in v1.22.0
func PublishContentItems(ctx context.Context, smBundle StateMachineBundleAPI, authEntityData *models.AuthEntityData, contentItem *models.ContentItem, wg *sync.WaitGroup, state, bundleTitle string, errCh chan error)
func ReviewBundle ¶ added in v1.22.0
func ReviewBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)
func UpdateContentItemCreateEvent ¶ added in v1.22.0
func UpdateContentItemCreateEvent(ctx context.Context, smBundle StateMachineBundleAPI, authEntityData *models.AuthEntityData, contentItem *models.ContentItem, state string) error
Types ¶
type State ¶
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
func NewStateMachine ¶
func NewStateMachine(ctx context.Context, states []State, transitions []Transition, datastore store.Datastore, datasetAPIClient datasetAPISDK.Clienter) *StateMachine
func (*StateMachine) Transition ¶
func (sm *StateMachine) Transition(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, currentBundle *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
PreviewServiceURL string
BundleFailedToPublishRunbookURL string
BundlePublishSlowThreshold time.Duration
}
func Setup ¶
func Setup(datastore store.Datastore, stateMachine *StateMachine, datasetAPIClient datasetAPISDK.Clienter, permissionsAPIClient permissionsAPISDK.Clienter, dataBundleSlackClient slack.Clienter, previewServiceURL, bundleFailedToPublishRunbookURL string, bundlePublishSlowThreshold time.Duration) *StateMachineBundleAPI
func (*StateMachineBundleAPI) AddPolicyConditionsForAddedPreviewTeams ¶ added in v1.19.0
func (s *StateMachineBundleAPI) AddPolicyConditionsForAddedPreviewTeams(ctx context.Context, authToken, bundleID string, currentTeams, updatedTeams *[]models.PreviewTeam) error
AddPolicyConditionsForAddedPreviewTeams adds policy conditions for teams that have been added to the bundle during a PUT bundle update
func (*StateMachineBundleAPI) AddPolicyConditionsForContentItem ¶ added in v1.14.0
func (s *StateMachineBundleAPI) AddPolicyConditionsForContentItem(ctx context.Context, authToken string, bundle *models.Bundle, contentItem *models.ContentItem) error
AddPolicyConditionsForContentItem adds policy conditions for all preview teams in a bundle when a content item is added
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) RemovePolicyConditionsForContentItem ¶ added in v1.14.0
func (s *StateMachineBundleAPI) RemovePolicyConditionsForContentItem(ctx context.Context, authToken string, bundle *models.Bundle, contentItem *models.ContentItem) error
RemovePolicyConditionsForContentItem removes policy conditions for all preview teams in a bundle when a content item is removed
func (*StateMachineBundleAPI) RemovePolicyConditionsForRemovedPreviewTeams ¶ added in v1.19.0
func (s *StateMachineBundleAPI) RemovePolicyConditionsForRemovedPreviewTeams(ctx context.Context, authToken, bundleID string, currentTeams, updatedTeams *[]models.PreviewTeam) error
RemovePolicyConditionsForRemovedPreviewTeams removes policy conditions for teams that have been removed from the bundle during a PUT bundle update.
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