Documentation ¶
Index ¶
- Variables
- func BuildBlockPath(paths ...string) string
- func ExprAsMap(expr hcl.Expression) (map[string][]string, hcl.Diagnostics)
- func ExprAsStringSlice(expr hcl.Expression) ([]string, hcl.Diagnostics)
- type Block
- type BlockType
- type Config
- type DataBlock
- func (d *DataBlock) BlockName() string
- func (d *DataBlock) BlockType() BlockType
- func (p *DataBlock) Create(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
- func (d *DataBlock) Dependencies() []string
- func (d *DataBlock) ID() int64
- func (d *DataBlock) PreProcessHCLBlock(block *hcl.Block, ctx *hcl.EvalContext) error
- type GriffonBlock
- func (g *GriffonBlock) BlockName() string
- func (g *GriffonBlock) BlockType() BlockType
- func (g *GriffonBlock) Dependencies() []string
- func (g *GriffonBlock) ID() int64
- func (g *GriffonBlock) PreProcessHCLBlock(block *hcl.Block, ctx *hcl.EvalContext) error
- func (g *GriffonBlock) ProcessConfiguration(ctx *hcl.EvalContext) error
- type InstanceBlock
- type OSDataBlock
- type PlanDataBlock
- type RegionDataBlock
- type ResourceBlock
- func (r *ResourceBlock) BlockName() string
- func (r *ResourceBlock) BlockType() BlockType
- func (r *ResourceBlock) Dependencies() []string
- func (r *ResourceBlock) Get(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
- func (r *ResourceBlock) ID() int64
- func (r *ResourceBlock) PreProcessHCLBlock(block *hcl.Block, ctx *hcl.EvalContext) error
- type SSHKeyBlock
- type StartupScriptBlock
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BuildBlockPath ¶
func ExprAsStringSlice ¶
func ExprAsStringSlice(expr hcl.Expression) ([]string, hcl.Diagnostics)
Types ¶
type Block ¶
type Block interface { ID() int64 BlockType() BlockType BlockName() string // Separate the block into its configuration and dependencies PreProcessHCLBlock(block *hcl.Block, evalCtx *hcl.EvalContext) error // Process the configuration ProcessConfiguration(evalCtx *hcl.EvalContext) error // Get Dependencies Dependencies() []string // Get the data block Get(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error // Create the block by making API calls Create(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error // ToCtyValue ToCtyValue() (cty.Value, error) }
type BlockType ¶
type BlockType string
const ( GriffonBlockType BlockType = "griffon" DataBlockType BlockType = "data" RegionBlockType BlockType = "region" PlanBlockType BlockType = "plan" OSBlockType BlockType = "os" ResourceBlockType BlockType = "resource" SSHKeyBlockType BlockType = "ssh_key" StartupScriptBlockType BlockType = "startup_script" InstanceBlockType BlockType = "instance" )
type Config ¶
type Config struct { EvaluationOrder []int64 `json:"evaluation_order,omitempty"` Griffon GriffonBlock `hcl:"griffon,block" json:"griffon"` Data map[BlockType]map[string]Block `hcl:"data,block" json:"data"` Resources map[BlockType]map[string]Block `hcl:"resources,block" json:"resources"` }
func (*Config) AddResource ¶
type DataBlock ¶
type DataBlock struct { GraphID int64 `json:"graph_id"` Type BlockType `hcl:"type,label"` Name string `hcl:"name,label"` Config hcl.Body DependsOn []string `json:"depends_on"` }
func (*DataBlock) Dependencies ¶
func (*DataBlock) PreProcessHCLBlock ¶
type GriffonBlock ¶
type GriffonBlock struct { GraphID int64 Region string `hcl:"region,attr"` VultrAPIKey string `hcl:"vultr_api_key"` Block }
func (*GriffonBlock) BlockName ¶
func (g *GriffonBlock) BlockName() string
func (*GriffonBlock) BlockType ¶
func (g *GriffonBlock) BlockType() BlockType
func (*GriffonBlock) Dependencies ¶
func (g *GriffonBlock) Dependencies() []string
func (*GriffonBlock) ID ¶
func (g *GriffonBlock) ID() int64
func (*GriffonBlock) PreProcessHCLBlock ¶
func (g *GriffonBlock) PreProcessHCLBlock(block *hcl.Block, ctx *hcl.EvalContext) error
func (*GriffonBlock) ProcessConfiguration ¶
func (g *GriffonBlock) ProcessConfiguration(ctx *hcl.EvalContext) error
type InstanceBlock ¶
type InstanceBlock struct { Region string `hcl:"region,attr" json:"region,omitempty"` Plan string `hcl:"plan,attr" json:"plan,omitempty"` OsID int `hcl:"os_id,attr" json:"os_id,omitempty"` SshKeyID string `hcl:"sshkey_id,attr" json:"sshkey_id,omitempty"` StartupScriptID string `hcl:"script_id,attr" json:"script_id,omitempty"` Hostname string `hcl:"hostname,attr" json:"hostname"` Tags []string `hcl:"tag,attr" json:"tags"` VID string `json:"id,omitempty" cty:"id"` Os string `json:"os,omitempty" cty:"os"` RAM int `json:"ram,omitempty" cty:"ram"` Disk int `json:"disk,omitempty" cty:"disk"` MainIP string `json:"main_ip,omitempty" cty:"main_ip"` VCPUCount int `json:"vcpu_count,omitempty" cty:"vcpu_count"` DefaultPassword string `json:"default_password,omitempty" cty:"default_password"` DateCreated string `json:"date_created,omitempty" cty:"date_created"` Status string `json:"status,omitempty" cty:"status"` PowerStatus string `json:"power_status,omitempty" cty:"power_status"` ServerStatus string `json:"server_status,omitempty" cty:"server_status"` InternalIP string `json:"internal_ip,omitempty" cty:"internal_ip"` ResourceBlock }
func (*InstanceBlock) Create ¶
func (i *InstanceBlock) Create(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
func (*InstanceBlock) ProcessConfiguration ¶
func (i *InstanceBlock) ProcessConfiguration(ctx *hcl.EvalContext) error
func (*InstanceBlock) ToCtyValue ¶
func (i *InstanceBlock) ToCtyValue() (cty.Value, error)
type OSDataBlock ¶
type OSDataBlock struct { VID int `json:"id" cty:"id"` OSName string `json:"name" cty:"name"` Arch string `json:"arch" cty:"arch"` Family string `json:"family" cty:"family"` DataBlock // contains filtered or unexported fields }
func (*OSDataBlock) Get ¶
func (o *OSDataBlock) Get(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
Get
func (*OSDataBlock) ProcessConfiguration ¶
func (o *OSDataBlock) ProcessConfiguration(ctx *hcl.EvalContext) error
type PlanDataBlock ¶
type PlanDataBlock struct { VID string `json:"id" cty:"id"` VCPUCount int `json:"vcpu_count" cty:"vcpu_count"` RAM int `json:"ram" cty:"ram"` Disk int `json:"disk" cty:"disk"` DiskCount int `json:"disk_count" cty:"disk_count"` Bandwidth int `json:"bandwidth" cty:"bandwidth"` MonthlyCost float32 `json:"monthly_cost" cty:"monthly_cost"` PlanType string `json:"type" cty:"type"` Locations []string `json:"locations"` DataBlock // contains filtered or unexported fields }
func (*PlanDataBlock) Get ¶
func (p *PlanDataBlock) Get(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
Get
func (*PlanDataBlock) ProcessConfiguration ¶
func (p *PlanDataBlock) ProcessConfiguration(evalCtx *hcl.EvalContext) error
func (*PlanDataBlock) ToCtyValue ¶
func (p *PlanDataBlock) ToCtyValue() (cty.Value, error)
ToCtyValue
type RegionDataBlock ¶
type RegionDataBlock struct { VID string `json:"id" cty:"id"` City string `json:"city" cty:"city"` Country string `json:"country" cty:"country"` Continent string `json:"continent" cty:"continent"` Options []string `json:"options" ` DataBlock }
func (*RegionDataBlock) Get ¶
func (r *RegionDataBlock) Get(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
GET
func (*RegionDataBlock) ProcessConfiguration ¶
func (r *RegionDataBlock) ProcessConfiguration(ctx *hcl.EvalContext) error
DataBlock -> RegionDataBlock
func (*RegionDataBlock) ToCtyValue ¶
func (r *RegionDataBlock) ToCtyValue() (cty.Value, error)
ToCtyValue
type ResourceBlock ¶
type ResourceBlock struct { GraphID int64 `json:"graph_id"` Type BlockType `hcl:"type,label" json:"type"` Name string `hcl:"name,label" json:"name"` Config hcl.Body DependsOn []string `json:"depends_on"` }
func (*ResourceBlock) BlockName ¶
func (r *ResourceBlock) BlockName() string
func (*ResourceBlock) BlockType ¶
func (r *ResourceBlock) BlockType() BlockType
func (*ResourceBlock) Dependencies ¶
func (r *ResourceBlock) Dependencies() []string
func (*ResourceBlock) Get ¶
func (r *ResourceBlock) Get(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
Implement Get
func (*ResourceBlock) ID ¶
func (r *ResourceBlock) ID() int64
func (*ResourceBlock) PreProcessHCLBlock ¶
func (r *ResourceBlock) PreProcessHCLBlock(block *hcl.Block, ctx *hcl.EvalContext) error
type SSHKeyBlock ¶
type SSHKeyBlock struct { SSHKey string `hcl:"ssh_key" json:"ssh_key,omitempty" cty:"ssh_key"` DateCreated string `json:"date_created,omitempty" cty:"date_created"` VID string `json:"id,omitempty" cty:"id"` ResourceBlock }
func (*SSHKeyBlock) Create ¶
func (s *SSHKeyBlock) Create(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
func (*SSHKeyBlock) ProcessConfiguration ¶
func (s *SSHKeyBlock) ProcessConfiguration(ctx *hcl.EvalContext) error
type StartupScriptBlock ¶
type StartupScriptBlock struct { Script string `hcl:"script" json:"script,omitempty" cty:"script"` VID string `json:"id,omitempty" cty:"id"` VDateCreated string `json:"date_created,omitempty" cty:"date_created"` VDateModified string `json:"date_modified,omitempty" cty:"date_modified"` VType string `json:"type,omitempty" cty:"type"` ResourceBlock }
func (*StartupScriptBlock) Create ¶
func (s *StartupScriptBlock) Create(ctx context.Context, evalCtx *hcl.EvalContext, vc *govultr.Client) error
func (*StartupScriptBlock) ProcessConfiguration ¶
func (s *StartupScriptBlock) ProcessConfiguration(ctx *hcl.EvalContext) error
func (*StartupScriptBlock) ToCtyValue ¶
func (s *StartupScriptBlock) ToCtyValue() (cty.Value, error)
ToCtyValue
Click to show internal directories.
Click to hide internal directories.