state

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort

func Sort(i, j *Resource) int

Types

type Resource

type Resource struct {
	Address ResourceAddress
	Status  ResourceStatus
}

Resource is a pug state resource.

type ResourceAddress

type ResourceAddress string

type ResourceStatus

type ResourceStatus string
const (
	// Idle means the resource is idle (no tasks are currently operating on
	// it).
	Idle ResourceStatus = "idle"
	// Removing means the resource is in the process of being removed.
	Removing ResourceStatus = "removing"
	// Tainting means the resource is in the process of being tainted.
	Tainting ResourceStatus = "tainting"
	// Tainted means the resource is currently tainted
	Tainted ResourceStatus = "tainted"
	// Untainting means the resource is in the process of being untainted.
	Untainting ResourceStatus = "untainting"
)

type Service

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

func NewService

func NewService(ctx context.Context, opts ServiceOptions) *Service

func (*Service) Delete

func (s *Service) Delete(workspaceID resource.ID, addrs ...ResourceAddress) (*task.Task, error)

func (*Service) Get

func (s *Service) Get(workspaceID resource.ID) (*State, error)

Get retrieves the state for a workspace.

func (*Service) Reload

func (s *Service) Reload(workspaceID resource.ID) (*task.Task, error)

Reload creates a task to repopulate the local cache of the state of the given workspace.

func (*Service) Subscribe

func (s *Service) Subscribe(ctx context.Context) <-chan resource.Event[*State]

func (*Service) Taint

func (s *Service) Taint(workspaceID resource.ID, addr ResourceAddress) (*task.Task, error)

func (*Service) Untaint

func (s *Service) Untaint(workspaceID resource.ID, addr ResourceAddress) (*task.Task, error)

type ServiceOptions

type ServiceOptions struct {
	ModuleService    *module.Service
	WorkspaceService *workspace.Service
	TaskService      *task.Service
	Logger           logging.Interface
}

type State

type State struct {
	WorkspaceID resource.ID
	Resources   map[ResourceAddress]*Resource
	State       StateStatus
}

func EmptyState

func EmptyState(workspaceID resource.ID) *State

func NewState

func NewState(workspaceID resource.ID, file StateFile) *State

type StateFile

type StateFile struct {
	FormatVersion    string `json:"format_version"`
	TerraformVersion string `json:"terraform_version"`
	Values           StateFileValues
}

StateFile is the terraform state file contents

type StateFileModule

type StateFileModule struct {
	Resources    []StateFileResource
	ChildModules []StateFileModule `json:"child_modules"`
}

type StateFileOutput

type StateFileOutput struct {
	Value     json.RawMessage
	Sensitive bool
}

StateFileOutput is an output in the terraform state file

type StateFileResource

type StateFileResource struct {
	Address ResourceAddress
	Tainted bool
}

type StateFileValues

type StateFileValues struct {
	Outputs    map[string]StateFileOutput
	RootModule StateFileModule `json:"root_module"`
}

type StateStatus

type StateStatus string
const (
	// Idle indicates the resource is idle (no tasks are currently operating on
	// it).
	IdleState StateStatus = "idle"
	// Removing indicates the resource is in the process of being removed.
	ReloadingState = "reloading"
)

Jump to

Keyboard shortcuts

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