model

package
v1.0.6-rc175 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AgentImage = "public.ecr.aws/entigolabs/entigo-infralib-agent"
View Source
const AgentImageDocker = "docker.io/entigolabs/entigo-infralib-agent"
View Source
const AgentSource = "agent-source.zip"
View Source
const LatestImageVersion = "latest"
View Source
const ProjectImage = "public.ecr.aws/entigolabs/entigo-infralib-base"
View Source
const ProjectImageDocker = "docker.io/entigolabs/entigo-infralib-base"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionCommand

type ActionCommand string
const (
	PlanCommand               ActionCommand = "plan"
	ApplyCommand              ActionCommand = "apply"
	PlanDestroyCommand        ActionCommand = "plan-destroy"
	ApplyDestroyCommand       ActionCommand = "apply-destroy"
	ArgoCDPlanCommand         ActionCommand = "argocd-plan"
	ArgoCDApplyCommand        ActionCommand = "argocd-apply"
	ArgoCDPlanDestroyCommand  ActionCommand = "argocd-plan-destroy"
	ArgoCDApplyDestroyCommand ActionCommand = "argocd-apply-destroy"
)

type AgentReplaceType

type AgentReplaceType string
const (
	AgentReplaceTypeVersion   AgentReplaceType = "version"
	AgentReplaceTypeAccountId AgentReplaceType = "accountId"
)

type Approve

type Approve string
const (
	ApproveMinor  Approve = "minor"
	ApproveMajor  Approve = "major"
	ApproveAlways Approve = "always"
	ApproveNever  Approve = "never"
)

type AwsDefaultTags

type AwsDefaultTags struct {
	Tags map[string]string `yaml:"tags,omitempty"`
}

func (AwsDefaultTags) IsEmpty

func (d AwsDefaultTags) IsEmpty() bool

type AwsIgnoreTags

type AwsIgnoreTags struct {
	KeyPrefixes []string `yaml:"key_prefixes,omitempty"`
	Keys        []string `yaml:"keys,omitempty"`
}

func (AwsIgnoreTags) IsEmpty

func (i AwsIgnoreTags) IsEmpty() bool

type AwsProvider

type AwsProvider struct {
	IgnoreTags  AwsIgnoreTags  `yaml:"ignore_tags,omitempty"`
	DefaultTags AwsDefaultTags `yaml:"default_tags,omitempty"`
}

func (AwsProvider) IsEmpty

func (a AwsProvider) IsEmpty() bool

type Bucket

type Bucket interface {
	GetRepoMetadata() (*RepositoryMetadata, error)
	PutFile(file string, content []byte) error
	GetFile(file string) ([]byte, error)
	DeleteFile(file string) error
	DeleteFiles(files []string) error
	CheckFolderExists(folder string) (bool, error)
	ListFolderFiles(folder string) ([]string, error)
	ListFolderFilesWithExclude(folder string, excludeFolders Set[string]) ([]string, error)
	Delete() error
}

type Builder

type Builder interface {
	CreateProject(projectName, repoURL, stepName string, step Step, imageVersion, imageSource string, vpcConfig *VpcConfig) error
	CreateAgentProject(projectName string, awsPrefix string, imageVersion string, cmd common.Command) error
	GetProject(projectName string) (*Project, error)
	UpdateAgentProject(projectName, version, cloudPrefix string) error
	UpdateProject(projectName, repoURL, stepName string, step Step, imageVersion, imageSource string, vpcConfig *VpcConfig) error
	DeleteProject(projectName string, step Step) error
}

type CloudProvider

type CloudProvider interface {
	SetupResources() Resources
	GetResources() Resources
	DeleteResources(deleteBucket bool, deleteServiceAccount bool)
	CreateServiceAccount()
}

type CloudResources

type CloudResources struct {
	ProviderType ProviderType
	Bucket       Bucket
	Pipeline     Pipeline
	CodeBuild    Builder
	SSM          SSM
	CloudPrefix  string
	BucketName   string
}

func (CloudResources) GetBucket

func (c CloudResources) GetBucket() Bucket

func (CloudResources) GetBucketName

func (c CloudResources) GetBucketName() string

func (CloudResources) GetBuilder

func (c CloudResources) GetBuilder() Builder

func (CloudResources) GetCloudPrefix

func (c CloudResources) GetCloudPrefix() string

func (CloudResources) GetPipeline

func (c CloudResources) GetPipeline() Pipeline

func (CloudResources) GetProviderType

func (c CloudResources) GetProviderType() ProviderType

func (CloudResources) GetSSM

func (c CloudResources) GetSSM() SSM

type Config

type Config struct {
	Prefix           string         `yaml:"prefix,omitempty" fake:"{word}"`
	Sources          []ConfigSource `yaml:"sources,omitempty" fakesize:"1"`
	AgentVersion     string         `yaml:"agent_version,omitempty" fake:"{version}"`
	BaseImageSource  string         `yaml:"base_image_source,omitempty"`
	BaseImageVersion string         `yaml:"base_image_version,omitempty"`
	Steps            []Step         `yaml:"steps,omitempty" fakesize:"1"`
}

type ConfigSource

type ConfigSource struct {
	URL     string   `yaml:"url" fake:"{url}"`
	Version string   `yaml:"version,omitempty"`
	Include []string `yaml:"include,omitempty"`
	Exclude []string `yaml:"exclude,omitempty"`
}

type File

type File struct {
	Name    string `yaml:"-"`
	Content []byte `yaml:"-"`
}

type FileNotFoundError

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

func NewFileNotFoundError

func NewFileNotFoundError(fileName string) FileNotFoundError

func (FileNotFoundError) Error

func (e FileNotFoundError) Error() string

func (FileNotFoundError) Unwrap

func (e FileNotFoundError) Unwrap() error

type KubernetesProvider

type KubernetesProvider struct {
	IgnoreAnnotations []string `yaml:"ignore_annotations,omitempty"`
	IgnoreLabels      []string `yaml:"ignore_labels,omitempty"`
}

func (KubernetesProvider) IsEmpty

func (k KubernetesProvider) IsEmpty() bool

type Module

type Module struct {
	Name         string                 `yaml:"name"`
	Source       string                 `yaml:"source,omitempty"`
	HttpUsername string                 `yaml:"http_username,omitempty"`
	HttpPassword string                 `yaml:"http_password,omitempty"`
	Version      string                 `yaml:"version,omitempty"`
	Inputs       map[string]interface{} `yaml:"inputs,omitempty" fakesize:"2,5"`
	InputsFile   string                 `yaml:"-"`
	FileContent  []byte                 `yaml:"-"`
}

type ModuleType

type ModuleType string
const (
	ModuleTypeCustom ModuleType = "custom"
)

type ModuleVersion

type ModuleVersion struct {
	Version   string
	Changed   bool
	SourceURL string
}

type Parameter

type Parameter struct {
	Value *string
	Type  string
}

type ParameterNotFoundError

type ParameterNotFoundError struct {
	Name string
	Err  error
}

func (*ParameterNotFoundError) Error

func (e *ParameterNotFoundError) Error() string

func (*ParameterNotFoundError) Unwrap

func (e *ParameterNotFoundError) Unwrap() error

type Pipeline

type Pipeline interface {
	CreatePipeline(projectName, stepName string, step Step, bucket Bucket) (*string, error)
	CreateAgentPipelines(prefix, projectName, bucket string) error
	UpdatePipeline(pipelineName, stepName string, step Step, bucket string) error
	StartAgentExecution(pipelineName string) error
	StartPipelineExecution(pipelineName, stepName string, step Step, customRepo string) (*string, error)
	WaitPipelineExecution(pipelineName, projectName string, executionId *string, autoApprove bool, stepType StepType) error
	DeletePipeline(projectName string) error
	StartDestroyExecution(projectName string) error
}

type PipelineChanges

type PipelineChanges struct {
	Changed   int
	Destroyed int
	NoChanges bool
}

type Project

type Project struct {
	Name  string
	Image string
}

type Provider

type Provider struct {
	Inputs     map[string]interface{} `yaml:"inputs,omitempty"`
	Aws        AwsProvider            `yaml:"aws"`
	Kubernetes KubernetesProvider     `yaml:"kubernetes"`
}

func (Provider) IsEmpty

func (p Provider) IsEmpty() bool

type ProviderType

type ProviderType string
const (
	AWS    ProviderType = "AWS"
	GCLOUD ProviderType = "GCLOUD"
)

type ReplaceType

type ReplaceType string
const (
	ReplaceTypeSSM          ReplaceType = "ssm"
	ReplaceTypeSSMCustom    ReplaceType = "ssm-custom"
	ReplaceTypeGCSM         ReplaceType = "gcsm"
	ReplaceTypeGCSMCustom   ReplaceType = "gcsm-custom"
	ReplaceTypeOutput       ReplaceType = "output"
	ReplaceTypeOutputCustom ReplaceType = "output-custom"
	ReplaceTypeTOutput      ReplaceType = "toutput"
	ReplaceTypeConfig       ReplaceType = "config"
	ReplaceTypeAgent        ReplaceType = "agent"
	ReplaceTypeModule       ReplaceType = "tmodule"
)

type RepositoryMetadata

type RepositoryMetadata struct {
	Name string
	URL  string
}

type Resources

type Resources interface {
	GetProviderType() ProviderType
	GetBucket() Bucket
	GetPipeline() Pipeline
	GetBuilder() Builder
	GetSSM() SSM
	GetCloudPrefix() string
	GetBucketName() string
	GetBackendConfigVars(string) map[string]string
}

type SSM

type SSM interface {
	GetParameter(name string) (*Parameter, error)
	PutParameter(name string, value string) error
	DeleteParameter(name string) error
}

type SafeCounter

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

func (*SafeCounter) Add

func (sc *SafeCounter) Add(delta int)

func (*SafeCounter) Count

func (sc *SafeCounter) Count() int64

func (*SafeCounter) Done

func (sc *SafeCounter) Done()

func (*SafeCounter) HasCount

func (sc *SafeCounter) HasCount() bool

func (*SafeCounter) Wait

func (sc *SafeCounter) Wait()

type Set

type Set[T comparable] map[T]bool

func NewSet

func NewSet[T comparable]() Set[T]

func ToSet

func ToSet[T comparable](items []T) Set[T]

func (Set[T]) Add

func (s Set[T]) Add(item T)

func (Set[T]) Contains

func (s Set[T]) Contains(item T) bool

func (Set[T]) Remove

func (s Set[T]) Remove(item T)

func (Set[T]) Size

func (s Set[T]) Size() int

func (Set[T]) String

func (s Set[T]) String() string

func (Set[T]) ToSlice

func (s Set[T]) ToSlice() []T

type Source

type Source struct {
	URL               string
	Version           *version.Version
	NewestVersion     *version.Version
	StableVersion     *version.Version
	Releases          []*version.Version
	Modules           Set[string]
	PreviousChecksums map[string]string
	CurrentChecksums  map[string]string
	Includes          Set[string]
	Excludes          Set[string]
}

type State

type State struct {
	Steps []*StateStep `yaml:"steps"`
}

type StateModule

type StateModule struct {
	Name           string      `yaml:"name"`
	Version        string      `yaml:"version,omitempty"`
	AppliedVersion *string     `yaml:"applied_version,omitempty"`
	Source         string      `yaml:"source,omitempty"`
	Type           *ModuleType `yaml:"type,omitempty"`
	AutoApprove    bool        `yaml:"-"` // always omit
}

type StateStep

type StateStep struct {
	Name      string         `yaml:"name"`
	AppliedAt time.Time      `yaml:"applied_at,omitempty"`
	Modules   []*StateModule `yaml:"modules"`
}

type Step

type Step struct {
	Name                  string   `yaml:"name" fake:"{word}"`
	Type                  StepType `yaml:"type,omitempty" fake:"{stepType}"`
	Approve               Approve  `yaml:"approve,omitempty"`
	BaseImageSource       string   `yaml:"base_image_source,omitempty"`
	BaseImageVersion      string   `yaml:"base_image_version,omitempty" fake:"{version}"`
	Vpc                   VPC      `yaml:"vpc,omitempty"`
	KubernetesClusterName string   `yaml:"kubernetes_cluster_name,omitempty"`
	ArgocdNamespace       string   `yaml:"argocd_namespace,omitempty"`
	RepoUrl               string   `yaml:"repo_url,omitempty"`
	Provider              Provider `yaml:"provider,omitempty"`
	Modules               []Module `yaml:"modules,omitempty" fakesize:"1"`
	Files                 []File   `yaml:"-"`
}

type StepType

type StepType string
const (
	StepTypeTerraform StepType = "terraform"
	StepTypeArgoCD    StepType = "argocd-apps"
)

type VPC

type VPC struct {
	Attach           *bool  `yaml:"attach,omitempty"`
	Id               string `yaml:"id,omitempty"`
	SubnetIds        string `yaml:"subnet_ids,omitempty"`
	SecurityGroupIds string `yaml:"security_group_ids,omitempty"`
}

type VpcConfig

type VpcConfig struct {
	SecurityGroupIds []string
	Subnets          []string
	VpcId            *string
}

Jump to

Keyboard shortcuts

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