data

package
v0.1.1107-mattc-variab... 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, MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceDetails

type ResourceDetails struct {
	// Id is the octopus ID of the exported resource
	Id string
	// Name is the name of the resource
	Name string
	// ResourceType is the type of Octopus resource (almost always related to the path that the resource is loaded from)
	ResourceType string
	// Lookup is the ID of the resource created or looked up by Terraform
	Lookup string
	// Dependency provides a way for one resource to depend on this resource. Usually the same of the Lookup, but can be
	// a reference to a group of resources in stateless mode.
	Dependency string
	// Count stores the HCL assigned to the count attribute. This is useful when child resources need to have the same
	// count value as a parent.
	Count string
	// FileName is the file contains the exported resource
	FileName string
	// ToHCL is a function that generates the HCL from the Octopus resource
	ToHcl ToHcl
	// A collection of any parameters that relate to the resource. These are used when building up a step template.
	Parameters []ResourceParameter
}

ResourceDetails is used to capture the dependencies required by the root resources that was exported. The process works like this: 1. The root resources is captured in a ResourceDetails from the Octopus API. 2. Any dependencies of the root object are captured in their own ResourceDetails objects. 3. Repeat step 2 for dependencies of dependencies. 4. Once all dependencies are captured, run ToHcl feeding in the collection of ResourceDetails built in steps 1 - 3. 5. ToHcl converts the object to HCL, and uses the Lookup field in the appropriate ResourceDetails to reference a dependency.

type ResourceDetailsCollection

type ResourceDetailsCollection struct {
	Resources []ResourceDetails
	// contains filtered or unexported fields
}

func (*ResourceDetailsCollection) AddResource

func (c *ResourceDetailsCollection) AddResource(resource ...ResourceDetails)

AddResource adds a resource to the collection

func (*ResourceDetailsCollection) GetAllResource

func (c *ResourceDetailsCollection) GetAllResource(resourceType string) []ResourceDetails

GetAllResource returns a slice of resources in the collection of type resourceType

func (*ResourceDetailsCollection) GetResource

func (c *ResourceDetailsCollection) GetResource(resourceType string, id string) string

GetResource returns the terraform references for a given resource type and id. If the resource is not found, an empty string is returned. There is no valid reason to return an empty string, but we treat a mostly valid output as a "graceful fallback" rather than failing hard, as the resulting text can still be edited by hand.

func (*ResourceDetailsCollection) GetResourceCount added in v0.1.956

func (c *ResourceDetailsCollection) GetResourceCount(resourceType string, id string) string

GetResourceCount returns the terraform count attribute for a given resource type and id. The returned string is used only for the depends_on field, as it may reference to a collection of resources rather than a single ID.

func (*ResourceDetailsCollection) GetResourceDependency

func (c *ResourceDetailsCollection) GetResourceDependency(resourceType string, id string) string

GetResourceDependency returns the terraform references for a given resource type and id. The returned string is used only for the depends_on field, as it may reference to a collection of resources rather than a single ID.

func (*ResourceDetailsCollection) GetResourceName added in v0.1.959

func (c *ResourceDetailsCollection) GetResourceName(resourceType string, id string) string

GetResourceName returns the terraform name attribute for a given resource type and id. The returned string is used only for the depends_on field, as it may reference to a collection of resources rather than a single ID.

func (*ResourceDetailsCollection) GetResourcePointer

func (c *ResourceDetailsCollection) GetResourcePointer(resourceType string, id *string) *string

GetResourcePointer returns the Terraform reference for a given resource type and id as a string pointer.

func (*ResourceDetailsCollection) GetResources

func (c *ResourceDetailsCollection) GetResources(resourceType string, ids ...string) []string

GetResources returns the Terraform references for resources of the given type and with the supplied ids.

func (*ResourceDetailsCollection) HasResource

func (c *ResourceDetailsCollection) HasResource(id string, resourceType string) bool

HasResource returns true if the resource with the id and resourceType exist in the collection, and false otherwise

type ResourceParameter added in v0.1.900

type ResourceParameter struct {
	VariableName  string
	Description   string
	Label         string
	ResourceName  string
	ParameterType string
	Sensitive     bool
	DefaultValue  string
}

type ToHcl

type ToHcl func() (string, error)

Jump to

Keyboard shortcuts

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