handler

package module
v0.0.0-...-29b4654 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	APPLY = iota
	PLAN
	DESTROY
)
View Source
const (
	CREATED   = iota
	QUEUED    //Job is queued for execution by Terraform
	RUNNING   //Terraform is currently running this Job
	ASSERTING //working out whether there was an error in Terraform execution
	COMPLETE  //Job completed successfully
	JOBERROR  //There was an error outside of Terraform execution
	TFERROR   //Terrform returned errors
	TFWARNING //Terraform returned warnings but no errors
)
View Source
const (
	AWS = iota
	AZURE
	GCP
)

Variables

View Source
var JobContexts map[uuid.UUID]JobContext
View Source
var Jobs map[uuid.UUID]*Job

Functions

func AssertJobStatus

func AssertJobStatus(job *Job)

func ContextsHandlerInit

func ContextsHandlerInit(planLocation string, contextLocation string)

func CreateJobContext

func CreateJobContext(vendor int, credentials map[string]string, statefiles map[string]string) map[string]string

func CreateNewJobContext

func CreateNewJobContext() uuid.UUID

func JobHandler

func JobHandler(job *Job)

func JobHandlerInit

func JobHandlerInit(plan_location string, context_location string)

func QueryJobStatus

func QueryJobStatus(jobId uuid.UUID) int

func SetCredentials

func SetCredentials(contextID uuid.UUID, credentials map[string]string)

func SetStateFiles

func SetStateFiles(contextID uuid.UUID, statefiles map[string]string)

func SetVendor

func SetVendor(contextID uuid.UUID, vendor int)

Types

type Job

type Job struct {
	JobID     uuid.UUID
	ContextID uuid.UUID
	Request   JobRequest
	Response  JobResponse
	Status    int
}

func CreateJob

func CreateJob(jobInstructions JobInstructions, jobContext JobContext, action int, stage string) *Job

type JobContext

type JobContext struct {
	ContextID   uuid.UUID
	Statefiles  map[string]string
	Vendor      int
	Credentials map[string]string
}

type JobInstructions

type JobInstructions struct {
	ContextID    uuid.UUID              `json:"context_id"`
	TfVars       map[string]interface{} `json:"tfvars"`
	RemoteStates []string               `json:"remote_states"`
}

type JobRequest

type JobRequest struct {
	Action int

	Stage string
	// contains filtered or unexported fields
}

type JobResponse

type JobResponse struct {
	TfOutput string
	TfError  error
}

func GetJobResponse

func GetJobResponse(jobId uuid.UUID) JobResponse

type JsonJobContext

type JsonJobContext struct {
	Vendor      string            `json:"vendor"`
	Statefiles  map[string]string `json:"statefiles"`
	Credentials map[string]string `json:"credentials"`
}

type StatefileLocations

type StatefileLocations struct {
	Statefiles map[string]string `json:"statefiles"`
}

type Vendor

type Vendor struct {
	Vendor string `json:"vendor"`
}

Jump to

Keyboard shortcuts

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