job

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityJob = "job"

	UpstreamTypeStatic   UpstreamType = "static"
	UpstreamTypeInferred UpstreamType = "inferred"

	UpstreamStateResolved   UpstreamState = "resolved"
	UpstreamStateUnresolved UpstreamState = "unresolved"

	MetricJobEvent                      = "job_events_total"
	MetricJobEventStateAdded            = "added"
	MetricJobEventStateUpdated          = "updated"
	MetricJobEventStateDeleted          = "deleted"
	MetricJobEventStateUpsertFailed     = "upsert_failed"
	MetricJobEventStateDeleteFailed     = "delete_failed"
	MetricJobEventStateValidationFailed = "validation_failed"
	MetricJobEventEnabled               = "enabled"
	MetricJobEventDisabled              = "disabled"
	MetricJobEventFoundDirty            = "found_dirty"

	MetricJobRefreshResourceDownstream = "refresh_resource_downstream_total"

	UnspecifiedImpactChange UpdateImpact = "unspecified_impact"
	JobInternalImpact       UpdateImpact = "internal_impact"
	JobBehaviourImpact      UpdateImpact = "behaviour_impact"
)
View Source
const (
	DateLayout = "2006-01-02"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertSpec

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

func NewAlertSpec

func NewAlertSpec(on string, channels []string, config Config) (*AlertSpec, error)

func (AlertSpec) Channels

func (a AlertSpec) Channels() []string

func (AlertSpec) Config

func (a AlertSpec) Config() Config

func (AlertSpec) On

func (a AlertSpec) On() string

type Asset

type Asset map[string]string

func AssetFrom

func AssetFrom(fileNameToContent map[string]string) (Asset, error)

func (Asset) Map

func (a Asset) Map() map[string]string

type Config

type Config map[string]string

func ConfigFrom

func ConfigFrom(configs map[string]string) (Config, error)

func (Config) Map

func (c Config) Map() map[string]string

type Downstream

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

func NewDownstream

func NewDownstream(name Name, projectName tenant.ProjectName, namespaceName tenant.NamespaceName, taskName TaskName) *Downstream

func (Downstream) FullName

func (d Downstream) FullName() FullName

func (Downstream) Name

func (d Downstream) Name() Name

func (Downstream) NamespaceName

func (d Downstream) NamespaceName() tenant.NamespaceName

func (Downstream) ProjectName

func (d Downstream) ProjectName() tenant.ProjectName

func (Downstream) TaskName

func (d Downstream) TaskName() TaskName

type DownstreamList

type DownstreamList []*Downstream

func (DownstreamList) GetDownstreamFullNames

func (d DownstreamList) GetDownstreamFullNames() FullNames

type FullName

type FullName string

func FullNameFrom

func FullNameFrom(projectName tenant.ProjectName, jobName Name) FullName

func (FullName) String

func (f FullName) String() string

type FullNames

type FullNames []FullName

func (FullNames) String

func (f FullNames) String() string

type Hook

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

func NewHook

func NewHook(name string, config Config) (*Hook, error)

func (Hook) Config

func (h Hook) Config() Config

func (Hook) Name

func (h Hook) Name() string

type Job

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

func NewJob

func NewJob(tenant tenant.Tenant, spec *Spec, destination ResourceURN, sources []ResourceURN, isDirty bool) *Job

func (*Job) Destination

func (j *Job) Destination() ResourceURN

func (*Job) FullName

func (j *Job) FullName() string

func (*Job) GetJobWithUnresolvedUpstream

func (j *Job) GetJobWithUnresolvedUpstream() (*WithUpstream, error)

func (*Job) GetName

func (j *Job) GetName() string

func (*Job) GetStaticUpstreamsToResolve added in v0.11.0

func (j *Job) GetStaticUpstreamsToResolve() ([]*Upstream, error)

func (*Job) IsDirty added in v0.11.0

func (j *Job) IsDirty() bool

func (*Job) ProjectName

func (j *Job) ProjectName() tenant.ProjectName

func (*Job) SetDirty added in v0.11.0

func (j *Job) SetDirty(val bool)

func (*Job) Sources

func (j *Job) Sources() []ResourceURN

func (*Job) Spec

func (j *Job) Spec() *Spec

func (*Job) StaticUpstreamNames

func (j *Job) StaticUpstreamNames() []SpecUpstreamName

func (*Job) Tenant

func (j *Job) Tenant() tenant.Tenant

type Jobs

type Jobs []*Job

func (Jobs) GetJobNames

func (j Jobs) GetJobNames() []Name

func (Jobs) GetJobsWithUnresolvedStaticUpstreams added in v0.11.0

func (j Jobs) GetJobsWithUnresolvedStaticUpstreams() ([]*WithUpstream, error)

func (Jobs) GetJobsWithUnresolvedUpstreams

func (j Jobs) GetJobsWithUnresolvedUpstreams() ([]*WithUpstream, error)

func (Jobs) GetNameAndJobMap

func (j Jobs) GetNameAndJobMap() map[Name]*Job

func (Jobs) GetNameMap added in v0.11.0

func (j Jobs) GetNameMap() map[Name]*Job

func (Jobs) GetNamespaceNameAndJobsMap

func (j Jobs) GetNamespaceNameAndJobsMap() map[tenant.NamespaceName][]*Job

func (Jobs) GetSpecs

func (j Jobs) GetSpecs() []*Spec

type Metadata

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

func (Metadata) Resource

func (m Metadata) Resource() *MetadataResource

func (Metadata) Scheduler

func (m Metadata) Scheduler() map[string]string

type MetadataBuilder

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

func NewMetadataBuilder

func NewMetadataBuilder() *MetadataBuilder

func (*MetadataBuilder) Build

func (m *MetadataBuilder) Build() (*Metadata, error)

func (*MetadataBuilder) WithResource

func (m *MetadataBuilder) WithResource(resource *MetadataResource) *MetadataBuilder

func (*MetadataBuilder) WithScheduler

func (m *MetadataBuilder) WithScheduler(scheduler map[string]string) *MetadataBuilder

type MetadataResource

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

func NewResourceMetadata

func NewResourceMetadata(request, limit *MetadataResourceConfig) *MetadataResource

func (MetadataResource) Limit

func (MetadataResource) Request

type MetadataResourceConfig

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

func NewMetadataResourceConfig

func NewMetadataResourceConfig(cpu, memory string) *MetadataResourceConfig

func (MetadataResourceConfig) CPU

func (MetadataResourceConfig) Memory

func (m MetadataResourceConfig) Memory() string

type Name

type Name string

func NameFrom

func NameFrom(name string) (Name, error)

func (Name) String

func (n Name) String() string

type ResourceURN

type ResourceURN string

func (ResourceURN) String

func (n ResourceURN) String() string

type ResourceURNWithUpstreams added in v0.10.1

type ResourceURNWithUpstreams struct {
	URN       ResourceURN
	Upstreams []*ResourceURNWithUpstreams
}

type ResourceURNWithUpstreamsList added in v0.10.1

type ResourceURNWithUpstreamsList []*ResourceURNWithUpstreams

func (ResourceURNWithUpstreamsList) Flatten added in v0.10.1

type Retry

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

func NewRetry

func NewRetry(count int, delay int64, exponentialBackoff bool) *Retry

func (Retry) Count

func (r Retry) Count() int

func (Retry) DelayInSeconds added in v0.12.0

func (r Retry) DelayInSeconds() int64

func (Retry) ExponentialBackoff

func (r Retry) ExponentialBackoff() bool

type Schedule

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

func (Schedule) CatchUp

func (s Schedule) CatchUp() bool

func (Schedule) DependsOnPast

func (s Schedule) DependsOnPast() bool

func (Schedule) EndDate

func (s Schedule) EndDate() ScheduleDate

func (Schedule) Interval

func (s Schedule) Interval() string

func (Schedule) Retry

func (s Schedule) Retry() *Retry

func (Schedule) StartDate

func (s Schedule) StartDate() ScheduleDate

type ScheduleBuilder

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

func NewScheduleBuilder

func NewScheduleBuilder(startDate ScheduleDate) *ScheduleBuilder

TODO: move interval to optional

func (*ScheduleBuilder) Build

func (s *ScheduleBuilder) Build() (*Schedule, error)

func (*ScheduleBuilder) WithCatchUp

func (s *ScheduleBuilder) WithCatchUp(catchUp bool) *ScheduleBuilder

func (*ScheduleBuilder) WithDependsOnPast

func (s *ScheduleBuilder) WithDependsOnPast(dependsOnPast bool) *ScheduleBuilder

func (*ScheduleBuilder) WithEndDate

func (s *ScheduleBuilder) WithEndDate(endDate ScheduleDate) *ScheduleBuilder

func (*ScheduleBuilder) WithInterval

func (s *ScheduleBuilder) WithInterval(interval string) *ScheduleBuilder

func (*ScheduleBuilder) WithRetry

func (s *ScheduleBuilder) WithRetry(retry *Retry) *ScheduleBuilder

type ScheduleDate

type ScheduleDate string

func ScheduleDateFrom

func ScheduleDateFrom(date string) (ScheduleDate, error)

func (ScheduleDate) String

func (s ScheduleDate) String() string

type Spec

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

func (*Spec) AlertSpecs

func (s *Spec) AlertSpecs() []*AlertSpec

func (*Spec) Asset

func (s *Spec) Asset() Asset

func (*Spec) Description

func (s *Spec) Description() string

func (*Spec) DiffBehaviorally added in v0.12.0

func (s *Spec) DiffBehaviorally(incoming *Spec) bool

func (*Spec) Hooks

func (s *Spec) Hooks() []*Hook

func (*Spec) Labels

func (s *Spec) Labels() labels.Labels

func (*Spec) Metadata

func (s *Spec) Metadata() *Metadata

func (*Spec) Name

func (s *Spec) Name() Name

func (*Spec) Owner

func (s *Spec) Owner() string

func (*Spec) Schedule

func (s *Spec) Schedule() *Schedule

func (*Spec) Task

func (s *Spec) Task() Task

func (*Spec) UpstreamSpec

func (s *Spec) UpstreamSpec() *UpstreamSpec

func (*Spec) Version

func (s *Spec) Version() int

func (*Spec) WebhookSpecs added in v0.11.4

func (s *Spec) WebhookSpecs() []*WebhookSpec

func (*Spec) WindowConfig added in v0.10.0

func (s *Spec) WindowConfig() window.Config

type SpecBuilder

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

func NewSpecBuilder

func NewSpecBuilder(version int, name Name, owner string, schedule *Schedule, w window.Config, task Task) *SpecBuilder

func (*SpecBuilder) Build

func (s *SpecBuilder) Build() (*Spec, error)

func (*SpecBuilder) WithAlerts

func (s *SpecBuilder) WithAlerts(alerts []*AlertSpec) *SpecBuilder

func (*SpecBuilder) WithAsset

func (s *SpecBuilder) WithAsset(asset Asset) *SpecBuilder

func (*SpecBuilder) WithDescription

func (s *SpecBuilder) WithDescription(description string) *SpecBuilder

func (*SpecBuilder) WithHooks

func (s *SpecBuilder) WithHooks(hooks []*Hook) *SpecBuilder

func (*SpecBuilder) WithLabels

func (s *SpecBuilder) WithLabels(labels labels.Labels) *SpecBuilder

func (*SpecBuilder) WithMetadata

func (s *SpecBuilder) WithMetadata(metadata *Metadata) *SpecBuilder

func (*SpecBuilder) WithSpecUpstream

func (s *SpecBuilder) WithSpecUpstream(specUpstream *UpstreamSpec) *SpecBuilder

func (*SpecBuilder) WithWebhooks added in v0.11.4

func (s *SpecBuilder) WithWebhooks(webhook []*WebhookSpec) *SpecBuilder

type SpecHTTPUpstream

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

TODO: reconsider whether we still need it or not

func (SpecHTTPUpstream) Headers

func (s SpecHTTPUpstream) Headers() map[string]string

func (SpecHTTPUpstream) Name

func (s SpecHTTPUpstream) Name() string

func (SpecHTTPUpstream) Params

func (s SpecHTTPUpstream) Params() map[string]string

func (SpecHTTPUpstream) URL

func (s SpecHTTPUpstream) URL() string

type SpecHTTPUpstreamBuilder

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

func NewSpecHTTPUpstreamBuilder

func NewSpecHTTPUpstreamBuilder(name, url string) *SpecHTTPUpstreamBuilder

func (*SpecHTTPUpstreamBuilder) Build

func (*SpecHTTPUpstreamBuilder) WithHeaders

func (s *SpecHTTPUpstreamBuilder) WithHeaders(headers map[string]string) *SpecHTTPUpstreamBuilder

func (*SpecHTTPUpstreamBuilder) WithParams

func (s *SpecHTTPUpstreamBuilder) WithParams(params map[string]string) *SpecHTTPUpstreamBuilder

type SpecUpstreamBuilder

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

func NewSpecUpstreamBuilder

func NewSpecUpstreamBuilder() *SpecUpstreamBuilder

func (*SpecUpstreamBuilder) Build

func (s *SpecUpstreamBuilder) Build() (*UpstreamSpec, error)

func (*SpecUpstreamBuilder) WithSpecHTTPUpstream

func (s *SpecUpstreamBuilder) WithSpecHTTPUpstream(httpUpstreams []*SpecHTTPUpstream) *SpecUpstreamBuilder

func (*SpecUpstreamBuilder) WithUpstreamNames

func (s *SpecUpstreamBuilder) WithUpstreamNames(names []SpecUpstreamName) *SpecUpstreamBuilder

type SpecUpstreamName

type SpecUpstreamName string

func SpecUpstreamNameFrom

func SpecUpstreamNameFrom(specUpstreamName string) SpecUpstreamName

func (SpecUpstreamName) GetJobName

func (s SpecUpstreamName) GetJobName() (Name, error)

func (SpecUpstreamName) GetProjectName

func (s SpecUpstreamName) GetProjectName() (tenant.ProjectName, error)

func (SpecUpstreamName) IsWithProjectName

func (s SpecUpstreamName) IsWithProjectName() bool

func (SpecUpstreamName) String

func (s SpecUpstreamName) String() string

type Specs

type Specs []*Spec

func (Specs) GetValid added in v0.8.1

func (s Specs) GetValid() []*Spec

func (Specs) ToFullNameAndSpecMap added in v0.7.0

func (s Specs) ToFullNameAndSpecMap(projectName tenant.ProjectName) map[FullName]*Spec

func (Specs) ToNameAndSpecMap

func (s Specs) ToNameAndSpecMap() map[Name]*Spec

func (Specs) Validate added in v0.8.1

func (s Specs) Validate() error

type State added in v0.9.0

type State string
const (
	ENABLED  State = "enabled"
	DISABLED State = "disabled"
)

func StateFrom added in v0.9.0

func StateFrom(name string) (State, error)

func (State) String added in v0.9.0

func (n State) String() string

type Task

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

func NewTask

func NewTask(name TaskName, config Config) Task

func (Task) Config

func (t Task) Config() Config

func (Task) Name

func (t Task) Name() TaskName

type TaskName

type TaskName string

func TaskNameFrom

func TaskNameFrom(name string) (TaskName, error)

func (TaskName) String

func (t TaskName) String() string

type UpdateImpact added in v0.12.0

type UpdateImpact string

func (UpdateImpact) String added in v0.12.0

func (u UpdateImpact) String() string

type Upstream

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

func NewUpstreamResolved

func NewUpstreamResolved(name Name, host string, resource ResourceURN, jobTenant tenant.Tenant, upstreamType UpstreamType, taskName TaskName, external bool) *Upstream

func NewUpstreamUnresolvedInferred

func NewUpstreamUnresolvedInferred(resource ResourceURN) *Upstream

func NewUpstreamUnresolvedStatic

func NewUpstreamUnresolvedStatic(name Name, projectName tenant.ProjectName) *Upstream

func (*Upstream) External

func (u *Upstream) External() bool

func (*Upstream) FullName

func (u *Upstream) FullName() string

func (*Upstream) Host

func (u *Upstream) Host() string

func (*Upstream) Name

func (u *Upstream) Name() Name

func (*Upstream) NamespaceName

func (u *Upstream) NamespaceName() tenant.NamespaceName

func (*Upstream) ProjectName

func (u *Upstream) ProjectName() tenant.ProjectName

func (*Upstream) Resource

func (u *Upstream) Resource() ResourceURN

func (*Upstream) State

func (u *Upstream) State() UpstreamState

func (*Upstream) TaskName

func (u *Upstream) TaskName() TaskName

func (*Upstream) Type

func (u *Upstream) Type() UpstreamType

type UpstreamSpec

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

func (UpstreamSpec) HTTPUpstreams

func (s UpstreamSpec) HTTPUpstreams() []*SpecHTTPUpstream

func (UpstreamSpec) UpstreamNames

func (s UpstreamSpec) UpstreamNames() []SpecUpstreamName

type UpstreamState

type UpstreamState string

func (UpstreamState) String

func (d UpstreamState) String() string

type UpstreamType

type UpstreamType string

func UpstreamTypeFrom

func UpstreamTypeFrom(str string) (UpstreamType, error)

func (UpstreamType) String

func (d UpstreamType) String() string

type Upstreams

type Upstreams []*Upstream

func (Upstreams) Deduplicate

func (u Upstreams) Deduplicate() []*Upstream

func (Upstreams) ToFullNameAndUpstreamMap

func (u Upstreams) ToFullNameAndUpstreamMap() map[string]*Upstream

func (Upstreams) ToResourceDestinationAndUpstreamMap

func (u Upstreams) ToResourceDestinationAndUpstreamMap() map[string]*Upstream

type WebhookEndPoint added in v0.11.4

type WebhookEndPoint struct {
	URL     string
	Headers map[string]string
}

type WebhookSpec added in v0.11.4

type WebhookSpec struct {
	On        string
	Endpoints []WebhookEndPoint
}

type WithUpstream

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

func NewWithUpstream

func NewWithUpstream(job *Job, upstreams []*Upstream) *WithUpstream

func (WithUpstream) GetName

func (w WithUpstream) GetName() string

func (WithUpstream) GetResolvedUpstreams

func (w WithUpstream) GetResolvedUpstreams() []*Upstream

func (WithUpstream) GetUnresolvedUpstreams

func (w WithUpstream) GetUnresolvedUpstreams() []*Upstream

func (WithUpstream) Job

func (w WithUpstream) Job() *Job

func (WithUpstream) Name

func (w WithUpstream) Name() Name

func (WithUpstream) Upstreams

func (w WithUpstream) Upstreams() []*Upstream

type WithUpstreams

type WithUpstreams []*WithUpstream

func (WithUpstreams) GetSubjectJobNames

func (w WithUpstreams) GetSubjectJobNames() []Name

func (WithUpstreams) MergeWithResolvedUpstreams

func (w WithUpstreams) MergeWithResolvedUpstreams(resolvedUpstreamsBySubjectJobMap map[Name][]*Upstream) []*WithUpstream

Directories

Path Synopsis
handler

Jump to

Keyboard shortcuts

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