Documentation
¶
Index ¶
- func IsValidJobState(state JobState) bool
- func IsValidJobType(state JobType) bool
- func ValidateDatasetID(id string) error
- func ValidateZebedeeURI(path string) error
- type Event
- type Job
- type JobConfig
- type JobLinks
- type JobState
- type JobType
- type JobValidator
- type LinkObject
- type MigrationTaskType
- type StaticDatasetValidator
- func (v *StaticDatasetValidator) ValidateSourceID(sourceID string) error
- func (v *StaticDatasetValidator) ValidateSourceIDWithExternal(ctx context.Context, sourceID string, appClients *clients.ClientList) error
- func (v *StaticDatasetValidator) ValidateTargetID(targetID string) error
- func (v *StaticDatasetValidator) ValidateTargetIDWithExternal(ctx context.Context, targetID string, appClients *clients.ClientList) error
- type Task
- type TaskLinks
- type TaskMetadata
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidJobState ¶ added in v0.7.0
IsValidJobState checks if the provided state is a valid JobState.
func IsValidJobType ¶ added in v0.7.0
IsValidJobType checks if the provided JobType is valid
func ValidateDatasetID ¶ added in v0.7.0
ValidateDatasetID validates if the given id is a valid dataset ID
func ValidateZebedeeURI ¶ added in v0.7.0
ValidateZebedeeURI validates if the given path is a valid URI path
Types ¶
type Event ¶
type Event struct {
CreatedAt string `json:"created_at"`
RequestedBy User `json:"requested_by"`
Action string `json:"action"`
JobID string `json:"job_id"`
}
Event represents an action taken on a migration job
type Job ¶
type Job struct {
ID string `json:"id" bson:"_id"`
LastUpdated time.Time `json:"last_updated" bson:"last_updated"`
State JobState `json:"state" bson:"state"`
Config *JobConfig `json:"config" bson:"config"`
Links JobLinks `json:"links" bson:"links"`
}
Job represents a migration job
type JobConfig ¶
type JobConfig struct {
SourceID string `json:"source_id" bson:"source_id"`
TargetID string `json:"target_id" bson:"target_id"`
Type JobType `json:"type" bson:"type"`
Validator JobValidator `json:"-" bson:"-"`
}
JobConfig represents the configuration for a migration job
func (*JobConfig) ValidateExternal ¶ added in v0.7.0
ValidateExternal performs validation of the JobConfig fields against external systems
func (*JobConfig) ValidateInternal ¶ added in v0.7.0
ValidateInternal performs internal validation of the JobConfig fields
type JobLinks ¶ added in v0.7.0
type JobLinks struct {
Self *LinkObject `bson:"self,omitempty" json:"self,omitempty"`
}
JobLinks contains HATEOS links for a migration job
func NewJobLinks ¶ added in v0.7.0
NewJobLinks creates JobLinks for a job with the given ID
type JobState ¶ added in v0.7.0
type JobState string
JobState represents the various states a migration job can be in.
const ( JobStateSubmitted JobState = "submitted" JobStateInReview JobState = "in_review" JobStateApproved JobState = "approved" JobStatePublished JobState = "published" JobStateCompleted JobState = "completed" JobStateMigrating JobState = "migrating" JobStatePublishing JobState = "publishing" JobStatePostPublishing JobState = "post_publishing" JobStateReverting JobState = "reverting" JobStateFailedPostPublish JobState = "failed_post_publish" JobStateFailedPublish JobState = "failed_publish" JobStateFailedMigration JobState = "failed_migration" JobStateCancelled JobState = "cancelled" )
func GetNonCancelledStates ¶ added in v0.7.0
func GetNonCancelledStates() []JobState
GetNonCancelledStates returns a slice of JobStates excluding the 'cancelled' state.
type JobType ¶ added in v0.7.0
type JobType string
JobType represents the type of migration job
const (
JobTypeStaticDataset JobType = "static_dataset"
)
type JobValidator ¶ added in v0.7.0
type JobValidator interface {
ValidateSourceID(sourceID string) error
ValidateSourceIDWithExternal(ctx context.Context, sourceID string, appClients *clients.ClientList) error
ValidateTargetID(targetID string) error
ValidateTargetIDWithExternal(ctx context.Context, targetID string, appClients *clients.ClientList) error
}
JobValidator defines the contract for validating job configurations against external systems
func GetValidator ¶ added in v0.7.0
func GetValidator(jobType JobType) (JobValidator, error)
GetValidator retrieves the appropriate validator for the given jobType
type LinkObject ¶ added in v0.7.0
type LinkObject struct {
HRef string `bson:"href,omitempty" json:"href,omitempty"`
ID string `bson:"id,omitempty" json:"id,omitempty"`
}
LinkObject represents a generic structure for all links
type MigrationTaskType ¶ added in v0.11.0
type MigrationTaskType string
MigrationTaskType represents the type of migration task
const ( // MigrationTaskTypeDataset indicates a dataset task MigrationTaskTypeDataset MigrationTaskType = "dataset" // MigrationTaskTypeDatasetEdition indicates a dataset edition task MigrationTaskTypeDatasetEdition MigrationTaskType = "dataset_edition" // MigrationTaskTypeDatasetVersion indicates a dataset version task MigrationTaskTypeDatasetVersion MigrationTaskType = "dataset_version" // MigrationTaskTypeDatasetDownload indicates a dataset download task MigrationTaskTypeDatasetDownload MigrationTaskType = "dataset_download" )
type StaticDatasetValidator ¶ added in v0.7.0
type StaticDatasetValidator struct{}
StaticDatasetValidator implements JobValidator for static dataset migration jobs
func (*StaticDatasetValidator) ValidateSourceID ¶ added in v0.7.0
func (v *StaticDatasetValidator) ValidateSourceID(sourceID string) error
ValidateSourceID validates if the given source ID is a valid Zebedee URI
func (*StaticDatasetValidator) ValidateSourceIDWithExternal ¶ added in v0.7.0
func (v *StaticDatasetValidator) ValidateSourceIDWithExternal(ctx context.Context, sourceID string, appClients *clients.ClientList) error
ValidateSourceIDWithExternal validates if the given source ID exists in Zebedee and is of the correct type
func (*StaticDatasetValidator) ValidateTargetID ¶ added in v0.7.0
func (v *StaticDatasetValidator) ValidateTargetID(targetID string) error
ValidateTargetID validates if the given id is a valid dataset ID
func (*StaticDatasetValidator) ValidateTargetIDWithExternal ¶ added in v0.7.0
func (v *StaticDatasetValidator) ValidateTargetIDWithExternal(ctx context.Context, targetID string, appClients *clients.ClientList) error
ValidateTargetIDWithExternal validates that the target dataset ID does not already exist
type Task ¶ added in v0.11.0
type Task struct {
ID string `json:"id" bson:"_id"`
JobID string `json:"job_id" bson:"job_id"`
LastUpdated time.Time `json:"last_updated" bson:"last_updated"`
Source *TaskMetadata `json:"source" bson:"source"`
State JobState `json:"state" bson:"state"`
Target *TaskMetadata `json:"target" bson:"target"`
Type MigrationTaskType `json:"type" bson:"type"`
Links TaskLinks `json:"links" bson:"links"`
}
Task represents a migration task
type TaskLinks ¶ added in v0.11.0
type TaskLinks struct {
Self *LinkObject `bson:"self,omitempty" json:"self,omitempty"`
Job *LinkObject `bson:"job,omitempty" json:"job,omitempty"`
}
TaskLinks contains HATEOAS links for a migration task
func NewTaskLinks ¶ added in v0.11.0
NewTaskLinks creates TaskLinks for a task
type TaskMetadata ¶ added in v0.11.0
type TaskMetadata struct {
ID string `json:"id" bson:"id"`
Label string `json:"label" bson:"label"`
URI string `json:"uri" bson:"uri"`
}
TaskMetadata represents metadata about a task's source or target