infra

package
v0.59.0-devel Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package infra implements utilities to interact with a Pulumi infrastructure

Package infra implements utilities to interact with a Pulumi infrastructure

Package infra implements utilities to interact with a Pulumi infrastructure

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetStackOption added in v0.56.0

type GetStackOption func(*getStackParams)

GetStackOption is a function that sets a parameter for GetStack function

func WithCancelTimeout added in v0.56.0

func WithCancelTimeout(cancelTimeout time.Duration) GetStackOption

WithCancelTimeout sets the cancel timeout for the stack

func WithConfigMap added in v0.56.0

func WithConfigMap(config runner.ConfigMap) GetStackOption

WithConfigMap sets the configuration map for the stack

func WithDatadogEventSender added in v0.56.0

func WithDatadogEventSender(datadogEventSender datadogEventSender) GetStackOption

WithDatadogEventSender sets the datadog event sender for the stack

func WithDestroyTimeout added in v0.56.0

func WithDestroyTimeout(destroyTimeout time.Duration) GetStackOption

WithDestroyTimeout sets the destroy timeout for the stack

func WithFailOnMissing added in v0.56.0

func WithFailOnMissing(failOnMissing bool) GetStackOption

WithFailOnMissing sets the failOnMissing flag for the stack

func WithLogWriter added in v0.56.0

func WithLogWriter(logWriter io.Writer) GetStackOption

WithLogWriter sets the log writer for the stack

func WithUpTimeout added in v0.56.0

func WithUpTimeout(upTimeout time.Duration) GetStackOption

WithUpTimeout sets the up timeout for the stack

type RetryStrategy added in v0.58.0

type RetryStrategy func(error, int) (RetryType, []GetStackOption)

RetryStrategy is a function that given the current error and the number of retries, returns the type of retry to perform and a list of options to modify the configuration

type RetryType added in v0.58.0

type RetryType string

RetryType is an enum to specify the type of retry to perform

const (
	ReUp     RetryType = "ReUp"     // ReUp retries the up operation
	ReCreate RetryType = "ReCreate" // ReCreate retries the up operation after destroying the stack
	NoRetry  RetryType = "NoRetry"  // NoRetry does not retry the up operation
)

type StackManager

type StackManager struct {

	// RetryStrategy defines how to handle retries. By default points to StackManager.getRetryStrategyFrom but can be overridden
	RetryStrategy RetryStrategy
	// contains filtered or unexported fields
}

StackManager handles

func GetStackManager

func GetStackManager() *StackManager

GetStackManager returns a stack manager, initialising on first call

func (*StackManager) Cleanup

func (sm *StackManager) Cleanup(ctx context.Context) []error

Cleanup delete any existing stack

func (*StackManager) DeleteStack

func (sm *StackManager) DeleteStack(ctx context.Context, name string, logWriter io.Writer) (err error)

DeleteStack safely deletes a stack

func (*StackManager) ForceRemoveStackConfiguration

func (sm *StackManager) ForceRemoveStackConfiguration(ctx context.Context, name string) (err error)

ForceRemoveStackConfiguration removes the configuration files pulumi creates for managing a stack. It DOES NOT perform any cleanup of the resources created by the stack. Call `DeleteStack` for correct cleanup.

func (*StackManager) GetPulumiStackName added in v0.50.0

func (sm *StackManager) GetPulumiStackName(name string) (_ string, err error)

GetPulumiStackName returns the Pulumi stack name The internal Pulumi stack name should normally remain hidden as all the Pulumi interactions should be done via the StackManager. The only use case for getting the internal Pulumi stack name is to interact directly with Pulumi for debug purposes.

func (*StackManager) GetStack

func (sm *StackManager) GetStack(ctx context.Context, name string, config runner.ConfigMap, deployFunc pulumi.RunFunc, failOnMissing bool) (_ *auto.Stack, _ auto.UpResult, err error)

GetStack creates or return a stack based on stack name and config, if error occurs during stack creation it destroy all the resources created

func (*StackManager) GetStackNoDeleteOnFailure

func (sm *StackManager) GetStackNoDeleteOnFailure(ctx context.Context, name string, deployFunc pulumi.RunFunc, options ...GetStackOption) (_ *auto.Stack, _ auto.UpResult, err error)

GetStackNoDeleteOnFailure creates or return a stack based on stack name and config, if error occurs during stack creation, it will not destroy the created resources. Using this can lead to resource leaks.

Jump to

Keyboard shortcuts

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