{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package engine\n\n## Functions\n\n```go\nfunc SimplifyError(err error, logger *zap.Logger) error\n```\nSimplifyError deals with simplifying specific deploy engine errors that are a part of the deploy engine client library API and transforming them into something easier to digest for the user. When an error is simplified, the original error will be logged at the debug level with the provided logger so there is a traceable record of the original error when debugging.\n\n## Types\n\n```go\ntype DeployEngine interface {\n\n\t// CreateBlueprintValidation creates a new blueprint validation\n\t// for the provided blueprint document and starts the validation process.\n\t// Returns a response containing the validation resource and a LastEventID\n\t// that should be passed to StreamBlueprintValidationEvents to avoid stale events.\n\tCreateBlueprintValidation(\n\t\tctx context.Context,\n\t\tpayload *types.CreateBlueprintValidationPayload,\n\t\tquery *types.CreateBlueprintValidationQuery,\n\t) (*types.BlueprintValidationResponse, error)\n\n\t// GetBlueprintValidation retrieves metadata and status information\n\t// about a blueprint validation.\n\t// To get validation events (diagnostics), use the `StreamBlueprintValidationEvents`\n\t// method.\n\tGetBlueprintValidation(\n\t\tctx context.Context,\n\t\tvalidationID string,\n\t) (*manage.BlueprintValidation, error)\n\n\t// StreamBlueprintValidationEvents streams events from a blueprint\n\t// validation process.\n\t// This will produce a stream of events as they occur or that have\n\t// recently occurred.\n\t// Any HTTP errors that occur when estabilishing a connection will be sent\n\t// to the provided error channel.\n\t//\n\t// The lastEventID parameter follows SSE Last-Event-ID semantics - it is exclusive,\n\t// meaning the event with this ID will NOT be included, only events after it.\n\t// Use the LastEventID from CreateBlueprintValidation to avoid stale events.\n\tStreamBlueprintValidationEvents(\n\t\tctx context.Context,\n\t\tvalidationID string,\n\t\tlastEventID string,\n\t\tstreamTo chan\u003c- types.BlueprintValidationEvent,\n\t\terrChan chan\u003c- error,\n\t) error\n\n\t// CleanupBlueprintValidations cleans up blueprint validations that are\n\t// older than the retention period configured for the Deploy Engine instance.\n\t// Returns a CleanupOperation that can be polled for completion status.\n\tCleanupBlueprintValidations(\n\t\tctx context.Context,\n\t) (*manage.CleanupOperation, error)\n\n\t// CreateChangeset creates a change set for a blueprint deployment.\n\t// This will start a change staging process for the provided blueprint\n\t// document and return an ID that can be used to retrieve the change set\n\t// or stream change staging events.\n\t//\n\t// If a valid instance ID or name is provided, a change set will be created\n\t// by comparing the provided blueprint document with the current state of the\n\t// existing blueprint instance.\n\t//\n\t// Creating a change set should be carried out in preparation for deploying new blueprint\n\t// instances or updating existing blueprint instances.\n\t//\n\t// Returns a response containing the changeset and a LastEventID\n\t// that should be passed to StreamChangeStagingEvents to avoid stale events.\n\tCreateChangeset(\n\t\tctx context.Context,\n\t\tpayload *types.CreateChangesetPayload,\n\t) (*types.ChangesetResponse, error)\n\n\t// GetChangeset retrieves a change set for a blueprint deployment.\n\t// This will return the current status of the change staging process.\n\t// If complete, the response will include a full set of changes that\n\t// will be applied when deploying the change set.\n\tGetChangeset(\n\t\tctx context.Context,\n\t\tchangesetID string,\n\t) (*manage.Changeset, error)\n\n\t// StreamChangeStagingEvents streams events from the change staging process\n\t// for the given change set ID.\n\t// This will produce a stream of events as they occur or that have recently occurred.\n\t// Any HTTP errors that occur when estabilishing a connection will be sent\n\t// to the provided error channel.\n\t//\n\t// The lastEventID parameter follows SSE Last-Event-ID semantics - it is exclusive,\n\t// meaning the event with this ID will NOT be included, only events after it.\n\t// Use the LastEventID from CreateChangeset to avoid stale events from previous operations.\n\tStreamChangeStagingEvents(\n\t\tctx context.Context,\n\t\tchangesetID string,\n\t\tlastEventID string,\n\t\tstreamTo chan\u003c- types.ChangeStagingEvent,\n\t\terrChan chan\u003c- error,\n\t) error\n\n\t// CleanupChangesets cleans up change sets that are older than the retention\n\t// period configured for the Deploy Engine instance.\n\t// Returns a CleanupOperation that can be polled for completion status.\n\tCleanupChangesets(\n\t\tctx context.Context,\n\t) (*manage.CleanupOperation, error)\n\n\t// CreateBlueprintInstance (Deploy New) creates a new blueprint deployment instance.\n\t// This will start the deployment process for the provided blueprint\n\t// document and change set.\n\t// Returns a response containing the instance state and a LastEventID\n\t// that should be passed to StreamBlueprintInstanceEvents to avoid stale events.\n\tCreateBlueprintInstance(\n\t\tctx context.Context,\n\t\tpayload *types.BlueprintInstancePayload,\n\t) (*types.BlueprintInstanceResponse, error)\n\n\t// UpdateBlueprintInstance (Deploy Existing) updates an existing blueprint\n\t// deployment instance.\n\t// This will start the deployment process for the provided blueprint\n\t// document and change set.\n\t// Returns a response containing the instance state and a LastEventID\n\t// that should be passed to StreamBlueprintInstanceEvents to avoid stale events.\n\tUpdateBlueprintInstance(\n\t\tctx context.Context,\n\t\tinstanceID string,\n\t\tpayload *types.BlueprintInstancePayload,\n\t) (*types.BlueprintInstanceResponse, error)\n\n\t// GetBlueprintInstance retrieves a blueprint deployment instance.\n\t// This will return the current status of the deployment along with\n\t// the current state of the blueprint intance.\n\tGetBlueprintInstance(\n\t\tctx context.Context,\n\t\tinstanceID string,\n\t) (*state.InstanceState, error)\n\n\t// ListBlueprintInstances retrieves blueprint instances with pagination and optional filtering.\n\t// The params allow filtering by name and paginating results.\n\tListBlueprintInstances(\n\t\tctx context.Context,\n\t\tparams state.ListInstancesParams,\n\t) (state.ListInstancesResult, error)\n\n\t// GetBlueprintInstanceExports retrieves the exports from a blueprint\n\t// deployment instance.\n\t// This will return the exported fields from the blueprint instance.\n\tGetBlueprintInstanceExports(\n\t\tctx context.Context,\n\t\tinstanceID string,\n\t) (map[string]*state.ExportState, error)\n\n\t// DestroyBlueprintInstance destroys a blueprint deployment instance.\n\t// This will start the destroy process for the provided change set.\n\t// Returns a response containing the instance state and a LastEventID\n\t// that should be passed to StreamBlueprintInstanceEvents to avoid stale events.\n\tDestroyBlueprintInstance(\n\t\tctx context.Context,\n\t\tinstanceID string,\n\t\tpayload *types.DestroyBlueprintInstancePayload,\n\t) (*types.BlueprintInstanceResponse, error)\n\n\t// StreamBlueprintInstanceEvents streams events from the current deployment\n\t// process for the given blueprint instance ID.\n\t//\n\t// This will stream events for new deployments, updates and for destroying\n\t// a blueprint instance.\n\t//\n\t// This will produce a stream of events as they occur or that have recently occurred.\n\t//\n\t// For a blueprint instance that has been destroyed, this stream will no longer be available\n\t// to new connections once the destroy process has been successfully completed.\n\t//\n\t// Any HTTP errors that occur when estabilishing a connection or unexpected failures\n\t// in the deployment process will be sent to the provided error channel.\n\t//\n\t// The lastEventID parameter follows SSE Last-Event-ID semantics - it is exclusive,\n\t// meaning the event with this ID will NOT be included, only events after it.\n\t// Use the LastEventID from Create/Update/DestroyBlueprintInstance to avoid stale events.\n\tStreamBlueprintInstanceEvents(\n\t\tctx context.Context,\n\t\tinstanceID string,\n\t\tlastEventID string,\n\t\tstreamTo chan\u003c- types.BlueprintInstanceEvent,\n\t\terrChan chan\u003c- error,\n\t) error\n\n\t// CleanupEvents cleans up events that are older than the retention\n\t// period configured for the Deploy Engine instance.\n\t//\n\t// This will clean up events for all processes including blueprint validations,\n\t// change staging and deployments. This will not clean up the resources themselves,\n\t// only the events that are associated with them.\n\t// You can clean up change sets and blueprint validations using the dedicated methods.\n\t// Returns a CleanupOperation that can be polled for completion status.\n\tCleanupEvents(\n\t\tctx context.Context,\n\t) (*manage.CleanupOperation, error)\n\n\t// CleanupReconciliationResults cleans up reconciliation check results that are\n\t// older than the retention period configured for the Deploy Engine instance.\n\t// Returns a CleanupOperation that can be polled for completion status.\n\tCleanupReconciliationResults(\n\t\tctx context.Context,\n\t) (*manage.CleanupOperation, error)\n\n\t// GetCleanupOperation retrieves the status of a cleanup operation by ID.\n\tGetCleanupOperation(\n\t\tctx context.Context,\n\t\tcleanupType manage.CleanupType,\n\t\toperationID string,\n\t) (*manage.CleanupOperation, error)\n\n\t// WaitForCleanupCompletion polls until the cleanup operation completes or fails.\n\tWaitForCleanupCompletion(\n\t\tctx context.Context,\n\t\tcleanupType manage.CleanupType,\n\t\toperationID string,\n\t\tpollInterval time.Duration,\n\t) (*manage.CleanupOperation, error)\n\n\t// ApplyReconciliation applies reconciliation actions to resolve drift or interrupted state.\n\t// This is a synchronous operation that returns the result of applying the reconciliation actions.\n\t//\n\t// The instanceID parameter can be either the unique instance ID or\n\t// the user-defined instance name.\n\tApplyReconciliation(\n\t\tctx context.Context,\n\t\tinstanceID string,\n\t\tpayload *types.ApplyReconciliationPayload,\n\t) (*container.ApplyReconciliationResult, error)\n}\n```\nDeployEngine is an interface used to allow the CLI to interact with the deploy engine that implements the v1 API.\n\n```go\nfunc Create(confProvider *config.Provider, logger *zap.Logger) (DeployEngine, error)\n```\nCreate a new deploy engine client based on how the CLI is configured.\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/engine","name":"engine","synopsis":"","isRedistributable":true}
