schema

package
v1.10.7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ConfigPath = "pennywise_projects_config.yaml"
)

Variables

This section is empty.

Functions

func WriteProjectsConfig added in v1.7.0

func WriteProjectsConfig(projects []Project) error

Types

type Action added in v1.7.0

type Action string
const (
	ActionCreate Action = "CREATE"
	ActionModify Action = "MODIFY"
	ActionRemove Action = "REMOVE"
)

type ComponentDiff added in v1.7.0

type ComponentDiff struct {
	Component cost.Component

	Current   *cost.Component
	CompareTo *cost.Component

	Action   Action
	CostDiff decimal.Decimal
}

ComponentDiff type to show diff of a Component

type IngestionJob

type IngestionJob struct {
	ID       int32              `json:"id"`
	Provider string             `json:"provider"`
	Location string             `json:"location"`
	Service  string             `json:"service"`
	Status   IngestionJobStatus `json:"status"`
	ErrorMsg string             `json:"error_msg"`
}

type IngestionJobStatus

type IngestionJobStatus string
const (
	IngestionJobCreated    IngestionJobStatus = "CREATED"
	IngestionJobInProgress IngestionJobStatus = "IN_PROGRESS"
	IngestionJobSucceeded  IngestionJobStatus = "SUCCEEDED"
	IngestionJobFailed     IngestionJobStatus = "FAILED"
)

type ModularStateDiff added in v1.7.0

type ModularStateDiff struct {
	Resources    map[string]ResourceDiff
	ChildModules map[string]ModularStateDiff

	PriorCost decimal.Decimal
	NewCost   decimal.Decimal
	Action    Action
}

func (*ModularStateDiff) TotalResourcesCount added in v1.7.0

func (s *ModularStateDiff) TotalResourcesCount() int

type ModuleDef added in v1.7.0

type ModuleDef struct {
	Address      string        `json:"address"`
	ChildModules []ModuleDef   `json:"child_modules"`
	Resources    []ResourceDef `json:"resources"`
}

ModuleDef is a single module definition.

type Project added in v1.7.0

type Project struct {
	ID             string              `yaml:"id"`
	Name           string              `yaml:"name"`
	CreatedAt      time.Time           `yaml:"created_at"`
	Directory      string              `yaml:"directory"`
	Description    string              `yaml:"description"`
	Tags           map[string][]string `yaml:"tags"`
	LastSubmission time.Time           `yaml:"last_submission"`
	SubmissionsIds []string            `yaml:"submissions_ids"`
}

func CreateProject added in v1.7.0

func CreateProject(name, directory, description string, tags map[string][]string) (*Project, error)

CreateProject creates a new project

func GetProjects added in v1.7.0

func GetProjects() ([]Project, error)

func (*Project) AddSubmission added in v1.7.0

func (p *Project) AddSubmission(sub Submission)

AddSubmission add a new submission to the project

type ProviderName

type ProviderName string
const (
	AzureProvider ProviderName = "azurerm"
	AWSProvider   ProviderName = "aws"
)

type ResourceDef

type ResourceDef struct {
	Address      string                 `json:"address"`
	Type         string                 `json:"type"`
	Name         string                 `json:"name"`
	RegionCode   string                 `json:"region_code"`
	ProviderName ProviderName           `json:"provider_name"`
	Values       map[string]interface{} `json:"values"`
}

ResourceDef is a single resource definition.

type ResourceDiff added in v1.7.0

type ResourceDiff struct {
	Address     string
	Provider    ProviderName
	Type        string
	Skipped     bool
	IsSupported bool

	ComponentDiffs map[string][]ComponentDiff
	PriorCost      decimal.Decimal
	NewCost        decimal.Decimal
	Action         Action
}

ResourceDiff type to show diff of a Resource

type StateDiff added in v1.7.0

type StateDiff struct {
	Resources map[string]ResourceDiff
	PriorCost decimal.Decimal
	NewCost   decimal.Decimal
}

type Submission added in v1.7.0

type Submission struct {
	ID        string        `json:"id"`
	CreatedAt time.Time     `json:"created_at"`
	ProjectId string        `json:"project_id"`
	Resources []ResourceDef `json:"resources"`
}

Submission to store and track resources and usage data for each run

func CreateSubmission added in v1.7.0

func CreateSubmission(resources []ResourceDef) (*Submission, error)

CreateSubmission creates a new submission to store resources and usage data

func GetLatestSubmission added in v1.7.0

func GetLatestSubmission() (*Submission, error)

func ReadSubmissionFile added in v1.7.0

func ReadSubmissionFile(id string) (*Submission, error)

ReadSubmissionFile Reads a submission from a file

func (*Submission) StoreAsFile added in v1.7.0

func (s *Submission) StoreAsFile() error

StoreAsFile stores the submission as a file in .pennywise/submissions directory

type SubmissionV2 added in v1.7.0

type SubmissionV2 struct {
	ID         string    `json:"id"`
	Version    string    `json:"version"`
	CreatedAt  time.Time `json:"created_at"`
	ProjectId  string    `json:"project_id"`
	RootModule ModuleDef `json:"root_modules"`
}

SubmissionV2 to store and track resources and usage data for each run

func CreateSubmissionV2 added in v1.7.0

func CreateSubmissionV2(module ModuleDef) (*SubmissionV2, error)

CreateSubmissionV2 creates a new version2 submission to store resources and usage data

func GetLatestSubmissionV2 added in v1.7.0

func GetLatestSubmissionV2() (*SubmissionV2, error)

func ReadSubmissionFileV2 added in v1.7.0

func ReadSubmissionFileV2(id string) (*SubmissionV2, error)

ReadSubmissionFileV2 Reads a submission from a file

func (*SubmissionV2) GetResources added in v1.7.0

func (s *SubmissionV2) GetResources() []ResourceDef

func (*SubmissionV2) StoreAsFile added in v1.7.0

func (s *SubmissionV2) StoreAsFile() error

StoreAsFile stores the submission as a file in .pennywise/submissions directory

type SubmissionsDiff added in v1.7.0

type SubmissionsDiff struct {
	Current   Submission `json:"current"`
	CompareTo Submission `json:"compare_to"`
}

type SubmissionsDiffV2 added in v1.7.0

type SubmissionsDiffV2 struct {
	Current   SubmissionV2 `json:"current"`
	CompareTo SubmissionV2 `json:"compare_to"`
}

Jump to

Keyboard shortcuts

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