Documentation
¶
Index ¶
- type DummyVariableReference
- type ResourceDetails
- type ResourceDetailsCollection
- func (c *ResourceDetailsCollection) AddDummy(reference DummyVariableReference)
- func (c *ResourceDetailsCollection) AddResource(resource ...ResourceDetails)
- func (c *ResourceDetailsCollection) GetAllResource(resourceType string) []ResourceDetails
- func (c *ResourceDetailsCollection) GetResource(resourceType string, id string) string
- func (c *ResourceDetailsCollection) GetResourceCount(resourceType string, id string) string
- func (c *ResourceDetailsCollection) GetResourceDependency(resourceType string, id string) string
- func (c *ResourceDetailsCollection) GetResourceName(resourceType string, id string) string
- func (c *ResourceDetailsCollection) GetResourcePointer(resourceType string, id *string) *string
- func (c *ResourceDetailsCollection) GetResourceVersionCurrent(resourceType string, id string) string
- func (c *ResourceDetailsCollection) GetResourceVersionLookup(resourceType string, id string) string
- func (c *ResourceDetailsCollection) GetResources(resourceType string, ids ...string) []string
- func (c *ResourceDetailsCollection) HasResource(id string, resourceType string) bool
- type ResourceParameter
- type ToHcl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DummyVariableReference ¶ added in v0.1.1161
The DummyVariableReference struct defines the details of a variable that had a dummy value injected into it.
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
// Step templates have a calculated version value that is only available when the template is created. This value
// is an expression that is used to reference the newly created version value.
VersionLookup string
// Step templates have a version field that is calculated by Octopus. This value captures the current value from
// the space being exported.
VersionCurrent string
// Step templates can be based on community step templates. The URL of the community step template is used as
// and external ID that links resources between spaces.
ExternalID 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
DummyVariables []DummyVariableReference
// contains filtered or unexported fields
}
func (*ResourceDetailsCollection) AddDummy ¶ added in v0.1.1161
func (c *ResourceDetailsCollection) AddDummy(reference DummyVariableReference)
AddDummy adds a dummy variable reference to the collection
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) GetResourceVersionCurrent ¶ added in v0.1.1204
func (c *ResourceDetailsCollection) GetResourceVersionCurrent(resourceType string, id string) string
GetResourceVersionCurrent returns the current version of the resource being exported.
func (*ResourceDetailsCollection) GetResourceVersionLookup ¶ added in v0.1.1204
func (c *ResourceDetailsCollection) GetResourceVersionLookup(resourceType string, id string) string
GetResourceVersionLookup returns the terraform syntax to lookup the version of the new resource.
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