engine

package
v0.14.1-dev Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIndent

func GetIndent(step StepEventMetadata, seen map[resource.URN]StepEventMetadata) int

GetIndent computes a step's parent indentation.

func GetResourceOutputsPropertiesString

func GetResourceOutputsPropertiesString(
	step StepEventMetadata, indent int, planning bool, debug bool) string

GetResourceOutputsPropertiesString prints only those properties that either differ from the input properties or, if there is an old snapshot of the resource, differ from the prior old snapshot's output properties.

func GetResourcePropertiesDetails

func GetResourcePropertiesDetails(
	step StepEventMetadata, indent int, planning bool, summary bool, debug bool) string

func GetResourcePropertiesSummary

func GetResourcePropertiesSummary(step StepEventMetadata, indent int) string

func ProjectInfoContext

func ProjectInfoContext(projinfo *Projinfo, config plugin.ConfigSource, pluginEvents plugin.Events,
	diag diag.Sink, tracingSpan opentracing.Span) (string, string, *plugin.Context, error)

ProjectInfoContext returns information about the current project, including its pwd, main, and plugin context.

Types

type Context

type Context struct {
	Cancel          *cancel.Context
	Events          chan<- Event
	SnapshotManager SnapshotManager
	ParentSpan      opentracing.SpanContext
}

Context provides cancellation, termination, and eventing options for an engine operation. It also provides a way for the engine to persist snapshots, using the `SnapshotManager`.

type DiagEventPayload

type DiagEventPayload struct {
	URN      resource.URN
	Prefix   string
	Message  string
	Color    colors.Colorization
	Severity diag.Severity
	StreamID int32
}

DiagEventPayload is the payload for an event with type `diag`

type Event

type Event struct {
	Type    EventType
	Payload interface{}
}

Event represents an event generated by the engine during an operation. The underlying type for the `Payload` field will differ depending on the value of the `Type` field

type EventType

type EventType string

EventType is the kind of event being emitted.

const (
	CancelEvent             EventType = "cancel"
	StdoutColorEvent        EventType = "stdoutcolor"
	DiagEvent               EventType = "diag"
	PreludeEvent            EventType = "prelude"
	SummaryEvent            EventType = "summary"
	ResourcePreEvent        EventType = "resource-pre"
	ResourceOutputsEvent    EventType = "resource-outputs"
	ResourceOperationFailed EventType = "resource-operationfailed"
)

type PreludeEventPayload

type PreludeEventPayload struct {
	IsPreview bool              // true if this prelude is for a plan operation
	Config    map[string]string // the keys and values for config. For encrypted config, the values may be blinded
}

type Projinfo

type Projinfo struct {
	Proj *workspace.Project
	Root string
}

func (*Projinfo) GetPwdMain

func (projinfo *Projinfo) GetPwdMain() (string, string, error)

GetPwdMain returns the working directory and main entrypoint to use for this package.

type ResourceChanges

type ResourceChanges map[deploy.StepOp]int

ResourceChanges contains the aggregate resource changes by operation type.

func Destroy

func Destroy(u UpdateInfo, ctx *Context, opts UpdateOptions, dryRun bool) (ResourceChanges, error)

func Refresh

func Refresh(u UpdateInfo, ctx *Context, opts UpdateOptions, dryRun bool) (ResourceChanges, error)

func Update

func Update(u UpdateInfo, ctx *Context, opts UpdateOptions, dryRun bool) (ResourceChanges, error)

func (ResourceChanges) HasChanges

func (changes ResourceChanges) HasChanges() bool

HasChanges returns true if there are any non-same changes in the resulting summary.

type ResourceOperationFailedPayload

type ResourceOperationFailedPayload struct {
	Metadata StepEventMetadata
	Status   resource.Status
	Steps    int
}

type ResourceOutputsEventPayload

type ResourceOutputsEventPayload struct {
	Metadata StepEventMetadata
	Planning bool
	Debug    bool
}

type ResourcePreEventPayload

type ResourcePreEventPayload struct {
	Metadata StepEventMetadata
	Planning bool
	Debug    bool
}

type SnapshotManager

type SnapshotManager interface {
	io.Closer

	// BeginMutation signals to the SnapshotManager that the planner intends to mutate the global
	// snapshot. It provides the step that it intends to execute. Based on that step, BeginMutation
	// will record this intent in the global snapshot and return a `SnapshotMutation` that, when ended,
	// will complete the transaction.
	BeginMutation(step deploy.Step) (SnapshotMutation, error)

	// RegisterResourceOutputs registers the set of resource outputs generated by performing the
	// given step. These outputs are persisted in the snapshot.
	RegisterResourceOutputs(step deploy.Step) error

	// RecordPlugin records that the current plan loaded a plugin and saves it in the snapshot.
	RecordPlugin(plugin workspace.PluginInfo) error
}

SnapshotManager is responsible for maintaining the in-memory representation of the current state of the resource world.

type SnapshotMutation

type SnapshotMutation interface {
	// End terminates the transaction and commits the results to the snapshot, returning an error if this
	// failed to complete.
	End(step deploy.Step, successful bool) error
}

SnapshotMutation represents an outstanding mutation that is yet to be completed. When the engine completes a mutation, it must call `End` in order to record the successful completion of the mutation.

type StdoutEventPayload

type StdoutEventPayload struct {
	Message string
	Color   colors.Colorization
}

type StepEventMetadata

type StepEventMetadata struct {
	Op      deploy.StepOp           // the operation performed by this step.
	URN     resource.URN            // the resource URN (for before and after).
	Type    tokens.Type             // the type affected by this step.
	Old     *StepEventStateMetadata // the state of the resource before performing this step.
	New     *StepEventStateMetadata // the state of the resource after performing this step.
	Res     *StepEventStateMetadata // the latest state for the resource that is known (worst case, old).
	Keys    []resource.PropertyKey  // the keys causing replacement (only for CreateStep and ReplaceStep).
	Logical bool                    // true if this step represents a logical operation in the program.
}

type StepEventStateMetadata

type StepEventStateMetadata struct {
	// the resource's type.
	Type tokens.Type
	// the resource's object urn, a human-friendly, unique name for the resource.
	URN resource.URN
	// true if the resource is custom, managed by a plugin.
	Custom bool
	// true if this resource is pending deletion due to a replacement.
	Delete bool
	// the resource's unique ID, assigned by the resource provider (or blank if none/uncreated).
	ID resource.ID
	// an optional parent URN that this resource belongs to.
	Parent resource.URN
	// true to "protect" this resource (protected resources cannot be deleted).
	Protect bool
	// the resource's input properties (as specified by the program). Note: because this will cross
	// over rpc boundaries it will be slightly different than the Inputs found in resource_state.
	// Specifically, secrets will have been filtered out, and large values (like assets) will be
	// have a simple hash-based representation.  This allows clients to display this information
	// properly, without worrying about leaking sensitive data, and without having to transmit huge
	// amounts of data.
	Inputs resource.PropertyMap
	// the resource's complete output state (as returned by the resource provider).  See "Inputs"
	// for additional details about how data will be transformed before going into this map.
	Outputs resource.PropertyMap
}

type SummaryEventPayload

type SummaryEventPayload struct {
	IsPreview       bool            // true if this summary is for a plan operation
	MaybeCorrupt    bool            // true if one or more resources may be corrupt
	Duration        time.Duration   // the duration of the entire update operation (zero values for previews)
	ResourceChanges ResourceChanges // count of changed resources, useful for reporting
}

type UpdateInfo

type UpdateInfo interface {
	// GetRoot returns the root directory for this update. This defines the scope for any filesystem resources
	// accessed by this update.
	GetRoot() string
	// GetProject returns information about the project associated with this update. This includes information such as
	// the runtime that will be used to execute the Pulumi program and the program's relative working directory.
	GetProject() *workspace.Project
	// GetTarget returns information about the target of this update. This includes the name of the stack being
	// updated, the configuration values associated with the target and the target's latest snapshot.
	GetTarget() *deploy.Target
}

UpdateInfo abstracts away information about an apply, preview, or destroy.

type UpdateOptions

type UpdateOptions struct {
	// an optional set of analyzers to run as part of this deployment.
	Analyzers []string

	// the degree of parallelism for resource operations (<=1 for serial).
	Parallel int

	// true if debugging output it enabled
	Debug bool
}

UpdateOptions contains all the settings for customizing how an update (deploy, preview, or destroy) is performed.

Jump to

Keyboard shortcuts

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