converters

package
v0.1.648 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0, MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountConverter

type AccountConverter struct {
	Client                    client.OctopusClient
	EnvironmentConverter      ConverterById
	TenantConverter           ConverterById
	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
}

func (AccountConverter) GetResourceType

func (c AccountConverter) GetResourceType() string

func (AccountConverter) ToHcl

func (c AccountConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (AccountConverter) ToHclById

func (c AccountConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (AccountConverter) ToHclLookupById

func (c AccountConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type AzureCloudServiceTargetConverter

type AzureCloudServiceTargetConverter struct {
	Client                 client.OctopusClient
	MachinePolicyConverter ConverterById
	AccountConverter       ConverterById
	EnvironmentConverter   ConverterById
	ExcludeAllTargets      bool
}

func (AzureCloudServiceTargetConverter) GetResourceType

func (c AzureCloudServiceTargetConverter) GetResourceType() string

func (AzureCloudServiceTargetConverter) ToHcl

func (AzureCloudServiceTargetConverter) ToHclById

func (AzureCloudServiceTargetConverter) ToHclLookupById

func (c AzureCloudServiceTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type AzureServiceFabricTargetConverter

type AzureServiceFabricTargetConverter struct {
	Client                    client.OctopusClient
	MachinePolicyConverter    ConverterById
	EnvironmentConverter      ConverterById
	ExcludeAllTargets         bool
	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
}

func (AzureServiceFabricTargetConverter) GetResourceType

func (c AzureServiceFabricTargetConverter) GetResourceType() string

func (AzureServiceFabricTargetConverter) ToHcl

func (AzureServiceFabricTargetConverter) ToHclById

func (AzureServiceFabricTargetConverter) ToHclLookupById

func (c AzureServiceFabricTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type AzureWebAppTargetConverter

type AzureWebAppTargetConverter struct {
	Client                 client.OctopusClient
	MachinePolicyConverter ConverterById
	AccountConverter       ConverterById
	EnvironmentConverter   ConverterById
	ExcludeAllTargets      bool
}

func (AzureWebAppTargetConverter) GetResourceType

func (c AzureWebAppTargetConverter) GetResourceType() string

func (AzureWebAppTargetConverter) ToHcl

func (AzureWebAppTargetConverter) ToHclById

func (c AzureWebAppTargetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (AzureWebAppTargetConverter) ToHclLookupById

func (c AzureWebAppTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type CertificateConverter

type CertificateConverter struct {
	Client                    client.OctopusClient
	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
}

func (CertificateConverter) GetResourceType

func (c CertificateConverter) GetResourceType() string

func (CertificateConverter) ToHcl

func (c CertificateConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (CertificateConverter) ToHclById

func (c CertificateConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (CertificateConverter) ToHclLookupById

func (c CertificateConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type ChannelConverter

type ChannelConverter struct {
	Client             client.OctopusClient
	LifecycleConverter ConverterAndLookupById
}

func (ChannelConverter) GetGroupResourceType

func (c ChannelConverter) GetGroupResourceType(projectId string) string

func (ChannelConverter) GetResourceType

func (c ChannelConverter) GetResourceType() string

func (ChannelConverter) ToHclByProjectIdWithTerraDependencies

func (c ChannelConverter) ToHclByProjectIdWithTerraDependencies(projectId string, terraformDependencies map[string]string, dependencies *ResourceDetailsCollection) error

func (ChannelConverter) ToHclLookupByProjectIdWithTerraDependencies

func (c ChannelConverter) ToHclLookupByProjectIdWithTerraDependencies(projectId string, terraformDependencies map[string]string, dependencies *ResourceDetailsCollection) error

ToHclLookupByProjectIdWithTerraDependencies exports the channel set as a complete resource, but will reference external resources like lifecycles as data source lookups.

type CloudRegionTargetConverter

type CloudRegionTargetConverter struct {
	Client                 client.OctopusClient
	MachinePolicyConverter ConverterById
	EnvironmentConverter   ConverterById
	ExcludeAllTargets      bool
}

func (CloudRegionTargetConverter) GetResourceType

func (c CloudRegionTargetConverter) GetResourceType() string

func (CloudRegionTargetConverter) ToHcl

func (CloudRegionTargetConverter) ToHclById

func (c CloudRegionTargetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (CloudRegionTargetConverter) ToHclLookupById

func (c CloudRegionTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type ConvertToHclByResource

type ConvertToHclByResource[C any] interface {
	ToHclByResource(resource C, dependencies *ResourceDetailsCollection) error
}

ConvertToHclByResource converts objects directly

type ConvertToHclLookupByResource added in v0.1.565

type ConvertToHclLookupByResource[C any] interface {
	ToHclLookupByResource(resource C, dependencies *ResourceDetailsCollection) error
}

ConvertToHclByResource creates a data lookup from the objects

type Converter

type Converter interface {
	// ToHcl converts all the resources of a given type to HCL. This is used when converting a space.
	ToHcl(dependencies *ResourceDetailsCollection) error
}

Converter converts all objects in bulk

type ConverterAndLookupById

type ConverterAndLookupById interface {
	ConverterById
	ConverterLookupById
}

ConverterAndLookupById converts an individual resource by ID to HCL and to a data lookup

type ConverterAndLookupByIdAndName

type ConverterAndLookupByIdAndName interface {
	ConverterByIdWithName
	ConverterLookupByIdWithName
}

ConverterAndLookupByIdAndName converts an individual resource by ID to HCL and to a data lookup

type ConverterAndLookupByIdWithNameAndParent

type ConverterAndLookupByIdWithNameAndParent interface {
	ConverterByIdWithNameAndParent
	ConverterLookupByIdWithNameAndParent
}

ConverterAndLookupByIdWithNameAndParent converts a resource by its ID, uses the supplied name, and has a reference to its parent, and can also reference external resources via data source lookups

type ConverterAndLookupByProjectId

type ConverterAndLookupByProjectId interface {
	ConverterByProjectId
	ConverterLookupByProjectId
}

ConverterAndLookupByProjectId converts objects to HCL and data lookups based on their relationship to a project

type ConverterAndLookupByProjectIdAndName

type ConverterAndLookupByProjectIdAndName interface {
	ConverterByProjectIdAndName
	ConverterLookupByProjectIdAndName
}

ConverterAndLookupByProjectIdAndName converts objects to HCL and data lookups based on their relationship to a project

type ConverterAndLookupByProjectIdWithTerraDependencies

type ConverterAndLookupByProjectIdWithTerraDependencies interface {
	ConverterByProjectIdWithTerraDependencies
	ConverterLookupByProjectIdWithTerraDependencies
}

ConverterAndLookupByProjectIdWithTerraDependencies converts objects to HCL and data lookups based on their relationship to a project

type ConverterById

type ConverterById interface {
	// ToHclById converts a single resource by its ID. This is used when converting a single project,
	// and then converting anything that the project references (like feeds, accounts, environments etc).
	ToHclById(id string, dependencies *ResourceDetailsCollection) error
}

ConverterById converts an individual resource by its ID

type ConverterByIdWithName

type ConverterByIdWithName interface {
	ToHclByIdAndName(id string, name string, dependencies *ResourceDetailsCollection) error
}

ConverterByIdWithName converts an individual resource by its ID, and uses the supplied name for the Terraform resource

type ConverterByIdWithNameAndParent

type ConverterByIdWithNameAndParent interface {
	ToHclByIdAndName(id string, name string, parentLookup string, dependencies *ResourceDetailsCollection) error
}

ConverterByIdWithNameAndParent converts a resource by its ID, uses the supplied name, and has a reference to its parent

type ConverterByProjectId

type ConverterByProjectId interface {
	ToHclByProjectId(projectId string, dependencies *ResourceDetailsCollection) error
}

ConverterByProjectId converts objects based on their relationship to a project

type ConverterByProjectIdAndName

type ConverterByProjectIdAndName interface {
	ToHclByProjectIdAndName(projectId string, parentName string, parentLookup string, dependencies *ResourceDetailsCollection) error
}

ConverterByProjectIdAndName converts objects based on their relationship to a project, with the ability to reference the parent

type ConverterByProjectIdWithName

type ConverterByProjectIdWithName interface {
	ToHclByProjectIdAndName(id string, name string, dependencies *ResourceDetailsCollection) error
}

ConverterByProjectIdWithName converts objects based on their relationship to a project, and uses the supplied name for the Terraform resource

type ConverterByProjectIdWithTerraDependencies

type ConverterByProjectIdWithTerraDependencies interface {
	ToHclByProjectIdWithTerraDependencies(projectId string, terraformDependencies map[string]string, dependencies *ResourceDetailsCollection) error
}

ConverterByProjectIdWithTerraDependencies converts objects based on their relationship to a project, with manual terraform dependencies

type ConverterByTenantId

type ConverterByTenantId interface {
	ToHclByTenantId(projectId string, dependencies *ResourceDetailsCollection) error
}

ConverterByTenantId converts objects based on the relationship to a tenant

type ConverterLookupById

type ConverterLookupById interface {
	// ToHclLookupById is used to create a data resource that queries a space for an existing resource. This
	// is used when converting a project with the -lookupProjectDependencies argument specified. It allows a project
	// to reference existing resources like accounts, feeds, environments etc in the space in which the project
	// is imported.
	ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error
}

ConverterLookupById converts an individual resource by its ID to a data lookup

type ConverterLookupByIdWithName

type ConverterLookupByIdWithName interface {
	ToHclLookupByIdAndName(id string, name string, dependencies *ResourceDetailsCollection) error
}

ConverterLookupByIdWithName converts an individual resource by its ID, uses the supplied name for the Terraform resource, and references external resources via a data source lookup

type ConverterLookupByIdWithNameAndParent

type ConverterLookupByIdWithNameAndParent interface {
	ToHclLookupByIdAndName(id string, name string, parentLookup string, dependencies *ResourceDetailsCollection) error
}

ConverterLookupByIdWithNameAndParent converts a resource by its ID, uses the supplied name, and has a reference to its parent, and references external resources via data source lookups

type ConverterLookupByProjectId

type ConverterLookupByProjectId interface {
	ToHclLookupByProjectId(projectId string, dependencies *ResourceDetailsCollection) error
}

ConverterLookupByProjectId converts objects to data lookups based on their relationship to a project

type ConverterLookupByProjectIdAndName

type ConverterLookupByProjectIdAndName interface {
	ToHclLookupByProjectIdAndName(projectId string, parentName string, parentLookup string, dependencies *ResourceDetailsCollection) error
}

ConverterLookupByProjectIdAndName converts objects to data lookups based on their relationship to a project, with the ability to reference the parent

type ConverterLookupByProjectIdWithTerraDependencies

type ConverterLookupByProjectIdWithTerraDependencies interface {
	ToHclLookupByProjectIdWithTerraDependencies(projectId string, terraformDependencies map[string]string, dependencies *ResourceDetailsCollection) error
}

ConverterLookupByProjectIdWithTerraDependencies converts objects based on their relationship to a project, with manual terraform dependencies, and using a lookup for dependencies

type DefaultExcluder added in v0.1.548

type DefaultExcluder struct {
}

func (DefaultExcluder) IsResourceExcluded added in v0.1.548

func (e DefaultExcluder) IsResourceExcluded(resourceName string, excludeAll bool, excludeThese []string, excludeAllButThese []string) bool

type DeploymentProcessConverter

type DeploymentProcessConverter struct {
	Client                 client.OctopusClient
	OctopusActionProcessor OctopusActionProcessor
	IgnoreProjectChanges   bool
	WorkerPoolProcessor    OctopusWorkerPoolProcessor
}

func (DeploymentProcessConverter) GetResourceType

func (c DeploymentProcessConverter) GetResourceType() string

func (DeploymentProcessConverter) ToHclByIdAndName

func (c DeploymentProcessConverter) ToHclByIdAndName(id string, projectName string, dependencies *ResourceDetailsCollection) error

func (DeploymentProcessConverter) ToHclLookupByIdAndName

func (c DeploymentProcessConverter) ToHclLookupByIdAndName(id string, projectName string, dependencies *ResourceDetailsCollection) error

type DummySecret added in v0.1.641

type DummySecret struct {
}

DummySecret is a simple service that returns the dummy value to use in place of a secret. This is required because the Octopus API never exports secrets, so octoterra can not include secrets in the exported Terraform module. It can be useful, however, to create resources that depend on secret values and update those secrets later. To do this, octoterra can optionally default secret values to dummy values.

func (DummySecret) GetDummyCertificate added in v0.1.642

func (e DummySecret) GetDummyCertificate() *string

func (DummySecret) GetDummyCertificatePassword added in v0.1.642

func (e DummySecret) GetDummyCertificatePassword() *string

func (DummySecret) GetDummySecret added in v0.1.641

func (e DummySecret) GetDummySecret() *string

type DummySecretGenerator added in v0.1.641

type DummySecretGenerator interface {
	GetDummySecret() *string
	GetDummyCertificate() *string
	GetDummyCertificatePassword() *string
}

DummySecretGenerator defines the service used to generate dummy secret values

type EnvironmentConverter

type EnvironmentConverter struct {
	Client client.OctopusClient
}

func (EnvironmentConverter) GetResourceType

func (c EnvironmentConverter) GetResourceType() string

func (EnvironmentConverter) ToHcl

func (c EnvironmentConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (EnvironmentConverter) ToHclById

func (c EnvironmentConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (EnvironmentConverter) ToHclLookupById

func (c EnvironmentConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type ExcludeByName added in v0.1.548

type ExcludeByName interface {
	IsResourceExcluded(resourceName string, excludeAll bool, excludeThese []string, excludeAllButThese []string) bool
}

ExcludeByName has logic for excluding resources based on some filters. Excluded resources are typically supplied from the command line.

type FeedConverter

type FeedConverter struct {
	Client                    client.OctopusClient
	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
}

func (FeedConverter) GetResourceType

func (c FeedConverter) GetResourceType() string

func (FeedConverter) ToHcl

func (c FeedConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (FeedConverter) ToHclById

func (c FeedConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (FeedConverter) ToHclLookupById

func (c FeedConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type GitCredentialsConverter

type GitCredentialsConverter struct {
	Client                    client.OctopusClient
	SpaceResourceName         string
	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
}

func (GitCredentialsConverter) GetResourceType

func (c GitCredentialsConverter) GetResourceType() string

func (GitCredentialsConverter) ToHcl

func (GitCredentialsConverter) ToHclById

func (c GitCredentialsConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (GitCredentialsConverter) ToHclLookupById

func (c GitCredentialsConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type KubernetesTargetConverter

type KubernetesTargetConverter struct {
	Client                 client.OctopusClient
	MachinePolicyConverter ConverterById
	AccountConverter       ConverterById
	CertificateConverter   ConverterById
	EnvironmentConverter   ConverterById
	ExcludeAllTargets      bool
}

func (KubernetesTargetConverter) GetResourceType

func (c KubernetesTargetConverter) GetResourceType() string

func (KubernetesTargetConverter) ToHcl

func (KubernetesTargetConverter) ToHclById

func (c KubernetesTargetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (KubernetesTargetConverter) ToHclLookupById

func (c KubernetesTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type LibraryVariableSetConverter

type LibraryVariableSetConverter struct {
	Client                          client.OctopusClient
	VariableSetConverter            ConverterByIdWithNameAndParent
	Excluded                        args.ExcludeLibraryVariableSets
	ExcludeLibraryVariableSetsRegex args.ExcludeLibraryVariableSets

	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
	// contains filtered or unexported fields
}

func (*LibraryVariableSetConverter) GetResourceType

func (c *LibraryVariableSetConverter) GetResourceType() string

func (*LibraryVariableSetConverter) ToHcl

func (*LibraryVariableSetConverter) ToHclById

func (c *LibraryVariableSetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (*LibraryVariableSetConverter) ToHclLookupById

func (c *LibraryVariableSetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type LifecycleConverter

type LifecycleConverter struct {
	Client               client.OctopusClient
	EnvironmentConverter ConverterById
}

func (LifecycleConverter) GetResourceType

func (c LifecycleConverter) GetResourceType() string

func (LifecycleConverter) ToHcl

func (c LifecycleConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (LifecycleConverter) ToHclById

func (c LifecycleConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (LifecycleConverter) ToHclLookupById

func (c LifecycleConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type ListeningTargetConverter

type ListeningTargetConverter struct {
	Client                 client.OctopusClient
	MachinePolicyConverter ConverterById
	EnvironmentConverter   ConverterById
	ExcludeAllTargets      bool
}

func (ListeningTargetConverter) GetResourceType

func (c ListeningTargetConverter) GetResourceType() string

func (ListeningTargetConverter) ToHcl

func (ListeningTargetConverter) ToHclById

func (c ListeningTargetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (ListeningTargetConverter) ToHclLookupById

func (c ListeningTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type MachinePolicyConverter

type MachinePolicyConverter struct {
	Client client.OctopusClient
}

func (MachinePolicyConverter) GetResourceType

func (c MachinePolicyConverter) GetResourceType() string

func (MachinePolicyConverter) ToHcl

func (MachinePolicyConverter) ToHclById

func (c MachinePolicyConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

type OctopusActionProcessor

type OctopusActionProcessor struct {
	FeedConverter           ConverterAndLookupById
	AccountConverter        ConverterAndLookupById
	WorkerPoolConverter     ConverterAndLookupById
	EnvironmentConverter    ConverterAndLookupById
	GitCredentialsConverter ConverterAndLookupById
	DetachProjectTemplates  bool
	WorkerPoolProcessor     OctopusWorkerPoolProcessor
}

OctopusActionProcessor exposes a bunch of common functions for exporting the processes associated with projects and runbooks.

func (OctopusActionProcessor) ConvertContainer

func (c OctopusActionProcessor) ConvertContainer(container octopus.Container, dependencies *ResourceDetailsCollection) *terraform.TerraformContainer

func (OctopusActionProcessor) DetachStepTemplates

func (c OctopusActionProcessor) DetachStepTemplates(properties map[string]string) map[string]string

DetachStepTemplates detaches step templates, which is achieved by removing the template properties

func (OctopusActionProcessor) ExportAccounts

func (c OctopusActionProcessor) ExportAccounts(recursive bool, lookup bool, steps []octopus.Step, dependencies *ResourceDetailsCollection) error

func (OctopusActionProcessor) ExportEnvironments

func (c OctopusActionProcessor) ExportEnvironments(recursive bool, lookup bool, steps []octopus.Step, dependencies *ResourceDetailsCollection) error

func (OctopusActionProcessor) ExportFeeds

func (c OctopusActionProcessor) ExportFeeds(recursive bool, lookup bool, steps []octopus.Step, dependencies *ResourceDetailsCollection) error

func (OctopusActionProcessor) ExportGitCredentials added in v0.1.605

func (c OctopusActionProcessor) ExportGitCredentials(recursive bool, lookup bool, steps []octopus.Step, dependencies *ResourceDetailsCollection) error

func (OctopusActionProcessor) ExportWorkerPools

func (c OctopusActionProcessor) ExportWorkerPools(recursive bool, lookup bool, steps []octopus.Step, dependencies *ResourceDetailsCollection) error

func (OctopusActionProcessor) GetFeatures

func (c OctopusActionProcessor) GetFeatures(properties map[string]any) []string

func (OctopusActionProcessor) GetRoles

func (c OctopusActionProcessor) GetRoles(properties map[string]string) []string

func (OctopusActionProcessor) GetRunOnServer

func (c OctopusActionProcessor) GetRunOnServer(properties map[string]any) bool

func (OctopusActionProcessor) RemoveUnnecessaryActionFields

func (c OctopusActionProcessor) RemoveUnnecessaryActionFields(properties map[string]string) map[string]string

RemoveUnnecessaryActionFields removes generic property bag values that have more specific terraform properties

func (OctopusActionProcessor) RemoveUnnecessaryStepFields

func (c OctopusActionProcessor) RemoveUnnecessaryStepFields(properties map[string]string) map[string]string

RemoveUnnecessaryStepFields removes generic property bag values that have more specific terraform properties

func (OctopusActionProcessor) ReplaceIds

func (c OctopusActionProcessor) ReplaceIds(properties map[string]string, dependencies *ResourceDetailsCollection) map[string]string

type OctopusWorkerPoolProcessor added in v0.1.458

type OctopusWorkerPoolProcessor struct {
	WorkerPoolConverter     ConverterAndLookupById
	LookupDefaultWorkerPool bool
	Client                  client.OctopusClient
}

OctopusWorkerPoolProcessor exposes a bunch of common functions for exporting the processes associated with projects and runbooks.

func (OctopusWorkerPoolProcessor) ResolveWorkerPoolId added in v0.1.458

func (c OctopusWorkerPoolProcessor) ResolveWorkerPoolId(workerPoolId string) (string, error)

ResolveWorkerPoolId looks up the default worker pool if the action does not specify a pool. This allows the exported project to reference the same worker pool rather than falling back to the default.

type OfflineDropTargetConverter

type OfflineDropTargetConverter struct {
	Client                    client.OctopusClient
	MachinePolicyConverter    ConverterById
	EnvironmentConverter      ConverterById
	ExcludeAllTargets         bool
	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
}

func (OfflineDropTargetConverter) GetResourceType

func (c OfflineDropTargetConverter) GetResourceType() string

func (OfflineDropTargetConverter) ToHcl

func (OfflineDropTargetConverter) ToHclById

func (c OfflineDropTargetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (OfflineDropTargetConverter) ToHclLookupById

func (c OfflineDropTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type PollingTargetConverter

type PollingTargetConverter struct {
	Client                 client.OctopusClient
	MachinePolicyConverter ConverterById
	EnvironmentConverter   ConverterById
	ExcludeAllTargets      bool
}

func (PollingTargetConverter) GetResourceType

func (c PollingTargetConverter) GetResourceType() string

func (PollingTargetConverter) ToHcl

func (PollingTargetConverter) ToHclById

func (c PollingTargetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (PollingTargetConverter) ToHclLookupById

func (c PollingTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type ProjectConverter

type ProjectConverter struct {
	Client                      client.OctopusClient
	LifecycleConverter          ConverterAndLookupById
	GitCredentialsConverter     ConverterAndLookupById
	LibraryVariableSetConverter ConverterAndLookupById
	ProjectGroupConverter       ConverterAndLookupById
	DeploymentProcessConverter  ConverterAndLookupByIdAndName
	TenantConverter             ConverterAndLookupByProjectId
	ProjectTriggerConverter     ConverterByProjectIdWithName
	VariableSetConverter        ConverterAndLookupByProjectIdAndName
	ChannelConverter            ConverterAndLookupByProjectIdWithTerraDependencies
	RunbookConverter            ConverterAndLookupByIdAndName
	IgnoreCacManagedValues      bool
	ExcludeAllRunbooks          bool
	IgnoreProjectChanges        bool
	IgnoreProjectGroupChanges   bool
	IgnoreProjectNameChanges    bool
	ExcludeProjects             args.ExcludeProjects
	ExcludeProjectsRegex        args.ExcludeProjectsRegex
	ExcludeAllProjects          bool

	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
	// contains filtered or unexported fields
}

func (ProjectConverter) GetResourceType

func (c ProjectConverter) GetResourceType() string

func (ProjectConverter) ToHcl

func (c ProjectConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (ProjectConverter) ToHclById

func (c ProjectConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (ProjectConverter) ToHclLookupById

func (c ProjectConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

ToHclLookupById exports a self-contained representation of the project where external resources like environments, lifecycles, feeds, accounts etc are resolved with data lookups.

type ProjectGroupConverter

type ProjectGroupConverter struct {
	Client client.OctopusClient
}

func (ProjectGroupConverter) GetResourceType

func (c ProjectGroupConverter) GetResourceType() string

func (ProjectGroupConverter) ToHcl

func (c ProjectGroupConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (ProjectGroupConverter) ToHclById

func (c ProjectGroupConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (ProjectGroupConverter) ToHclLookupById

func (c ProjectGroupConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type ProjectTriggerConverter

type ProjectTriggerConverter struct {
	Client client.OctopusClient
}

func (ProjectTriggerConverter) GetGroupResourceType

func (c ProjectTriggerConverter) GetGroupResourceType(projectId string) string

func (ProjectTriggerConverter) GetResourceType

func (c ProjectTriggerConverter) GetResourceType() string

func (ProjectTriggerConverter) ToHclByProjectIdAndName

func (c ProjectTriggerConverter) ToHclByProjectIdAndName(projectId string, projectName string, dependencies *ResourceDetailsCollection) error

type ResourceDetails

type ResourceDetails struct {
	Id           string
	ResourceType string
	Lookup       string
	FileName     string
	ToHcl        ToHcl
}

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
}

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) 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 RunbookConverter

type RunbookConverter struct {
	Client                  client.OctopusClient
	RunbookProcessConverter ConverterAndLookupByIdAndName
	EnvironmentConverter    ConverterAndLookupById
	ExcludedRunbooks        args.ExcludeRunbooks
	ExcludeRunbooksRegex    args.ExcludeRunbooks

	IgnoreProjectChanges bool
	// contains filtered or unexported fields
}

func (*RunbookConverter) GetGroupResourceType

func (c *RunbookConverter) GetGroupResourceType(projectId string) string

func (*RunbookConverter) GetResourceType

func (c *RunbookConverter) GetResourceType() string

func (*RunbookConverter) ToHclByIdAndName

func (c *RunbookConverter) ToHclByIdAndName(projectId string, projectName string, dependencies *ResourceDetailsCollection) error

func (*RunbookConverter) ToHclLookupByIdAndName

func (c *RunbookConverter) ToHclLookupByIdAndName(projectId string, projectName string, dependencies *ResourceDetailsCollection) error

type RunbookProcessConverter

type RunbookProcessConverter struct {
	Client                 client.OctopusClient
	OctopusActionProcessor OctopusActionProcessor
	IgnoreProjectChanges   bool
	WorkerPoolProcessor    OctopusWorkerPoolProcessor
}

func (RunbookProcessConverter) GetResourceType

func (c RunbookProcessConverter) GetResourceType() string

func (RunbookProcessConverter) ToHclByIdAndName

func (c RunbookProcessConverter) ToHclByIdAndName(id string, runbookName string, dependencies *ResourceDetailsCollection) error

func (RunbookProcessConverter) ToHclLookupByIdAndName

func (c RunbookProcessConverter) ToHclLookupByIdAndName(id string, runbookName string, dependencies *ResourceDetailsCollection) error

type SpaceConverter

type SpaceConverter struct {
	Client                            client.OctopusClient
	AccountConverter                  Converter
	FeedConverter                     Converter
	EnvironmentConverter              Converter
	LibraryVariableSetConverter       Converter
	LifecycleConverter                Converter
	WorkerPoolConverter               Converter
	TagSetConverter                   Converter
	GitCredentialsConverter           Converter
	ProjectGroupConverter             Converter
	ProjectConverter                  Converter
	TenantConverter                   Converter
	CertificateConverter              Converter
	TenantVariableConverter           Converter
	MachinePolicyConverter            Converter
	KubernetesTargetConverter         Converter
	SshTargetConverter                Converter
	ListeningTargetConverter          Converter
	PollingTargetConverter            Converter
	CloudRegionTargetConverter        Converter
	OfflineDropTargetConverter        Converter
	AzureCloudServiceTargetConverter  Converter
	AzureServiceFabricTargetConverter Converter
	AzureWebAppTargetConverter        Converter
}

SpaceConverter creates the files required to create a new space. These files are used in a separate terraform project, as you first need to a create a space, and then configure a second provider to use that space.

func (SpaceConverter) ToHcl

func (c SpaceConverter) ToHcl(dependencies *ResourceDetailsCollection) error

ToHcl is a bulk export that takes advantage of the collection endpoints to download and export everything with no filter and with the least number of network calls.

type SshTargetConverter

type SshTargetConverter struct {
	Client                 client.OctopusClient
	MachinePolicyConverter ConverterById
	AccountConverter       ConverterById
	EnvironmentConverter   ConverterById
	ExcludeAllTargets      bool
}

func (SshTargetConverter) GetResourceType

func (c SshTargetConverter) GetResourceType() string

func (SshTargetConverter) ToHcl

func (c SshTargetConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (SshTargetConverter) ToHclById

func (c SshTargetConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (SshTargetConverter) ToHclLookupById

func (c SshTargetConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

type TagSetConverter

type TagSetConverter struct {
	Client client.OctopusClient
}

func (TagSetConverter) GetResourceType

func (c TagSetConverter) GetResourceType() string

func (TagSetConverter) ToHcl

func (c TagSetConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (TagSetConverter) ToHclByResource

func (c TagSetConverter) ToHclByResource(tagSet octopus2.TagSet, dependencies *ResourceDetailsCollection) error

type TenantConverter

type TenantConverter struct {
	Client                  client.OctopusClient
	TenantVariableConverter ConverterByTenantId
	EnvironmentConverter    ConverterById
	TagSetConverter         ConvertToHclByResource[octopus2.TagSet]
	ExcludeTenants          args.ExcludeTenants
	ExcludeTenantsExcept    args.ExcludeTenantsExcept
	ExcludeAllTenants       bool
	Excluder                ExcludeByName
	ExcludeProjects         args.ExcludeProjects
	ExcludeProjectsRegex    args.ExcludeProjectsRegex
	ExcludeAllProjects      bool
	// contains filtered or unexported fields
}

func (TenantConverter) GetResourceType

func (c TenantConverter) GetResourceType() string

func (TenantConverter) ToHcl

func (c TenantConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (TenantConverter) ToHclById

func (c TenantConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (TenantConverter) ToHclByProjectId

func (c TenantConverter) ToHclByProjectId(projectId string, dependencies *ResourceDetailsCollection) error

func (TenantConverter) ToHclLookupByProjectId

func (c TenantConverter) ToHclLookupByProjectId(projectId string, dependencies *ResourceDetailsCollection) error

type TenantVariableConverter

type TenantVariableConverter struct {
	Client                    client.OctopusClient
	ExcludeTenants            args.ExcludeTenants
	ExcludeTenantsExcept      args.ExcludeTenantsExcept
	ExcludeAllTenants         bool
	Excluder                  ExcludeByName
	DummySecretVariableValues bool
	DummySecretGenerator      DummySecretGenerator
}

func (TenantVariableConverter) GetResourceType

func (c TenantVariableConverter) GetResourceType() string

func (TenantVariableConverter) ToHcl

func (TenantVariableConverter) ToHclByTenantId

func (c TenantVariableConverter) ToHclByTenantId(id string, dependencies *ResourceDetailsCollection) error

type TerraformProviderGenerator

type TerraformProviderGenerator struct {
	TerraformBackend         string
	ProviderVersion          string
	ExcludeProvider          bool
	IncludeOctopusOutputVars bool
}

TerraformProviderGenerator creates the common terraform files required to populate a space including the provider, terraform config, and common vars

func (TerraformProviderGenerator) ToHcl

func (c TerraformProviderGenerator) ToHcl(directory string, dependencies *ResourceDetailsCollection)

type ToHcl

type ToHcl func() (string, error)

type VariableSetConverter

type VariableSetConverter struct {
	Client                            client.OctopusClient
	ChannelConverter                  ConverterByProjectIdWithTerraDependencies
	EnvironmentConverter              ConverterAndLookupById
	TagSetConverter                   TagSetConverter
	AzureCloudServiceTargetConverter  ConverterAndLookupById
	AzureServiceFabricTargetConverter ConverterAndLookupById
	AzureWebAppTargetConverter        ConverterAndLookupById
	CloudRegionTargetConverter        ConverterAndLookupById
	KubernetesTargetConverter         ConverterAndLookupById
	ListeningTargetConverter          ConverterAndLookupById
	OfflineDropTargetConverter        ConverterAndLookupById
	PollingTargetConverter            ConverterAndLookupById
	SshTargetConverter                ConverterAndLookupById
	AccountConverter                  ConverterAndLookupById
	FeedConverter                     ConverterAndLookupById
	CertificateConverter              ConverterAndLookupById
	WorkerPoolConverter               ConverterAndLookupById
	IgnoreCacManagedValues            bool
	DefaultSecretVariableValues       bool
	DummySecretVariableValues         bool
	ExcludeProjectVariables           args.ExcludeVariables
	ExcludeProjectVariablesRegex      args.ExcludeVariables

	IgnoreProjectChanges             bool
	DummySecretGenerator             DummySecretGenerator
	ExcludeVariableEnvironmentScopes args.ExcludeVariableEnvironmentScopes
	// contains filtered or unexported fields
}

VariableSetConverter exports variable sets. Note that we only access variable sets as dependencies of other resources, like project variables or library variable sets. There is no global collection or all endpoint that we can use to dump variables in bulk.

func (*VariableSetConverter) GetGroupResourceType

func (c *VariableSetConverter) GetGroupResourceType(projectId string) string

func (*VariableSetConverter) GetResourceType

func (c *VariableSetConverter) GetResourceType() string

func (*VariableSetConverter) ToHclByIdAndName

func (c *VariableSetConverter) ToHclByIdAndName(id string, parentName string, parentLookup string, dependencies *ResourceDetailsCollection) error

func (*VariableSetConverter) ToHclByProjectIdAndName

func (c *VariableSetConverter) ToHclByProjectIdAndName(projectId string, parentName string, parentLookup string, dependencies *ResourceDetailsCollection) error

ToHclByProjectIdAndName is called when returning variables from projects. This is because the variable set ID defined on a CaC enabled project is not available from the global /variablesets endpoint, and can only be accessed from the project resource.

func (*VariableSetConverter) ToHclLookupByIdAndName

func (c *VariableSetConverter) ToHclLookupByIdAndName(id string, parentName string, parentLookup string, dependencies *ResourceDetailsCollection) error

ToHclLookupByIdAndName exports the variable set as a complete resource, but will reference external resources like accounts, feeds, worker pools, certificates, environments, and targets as data source lookups.

func (*VariableSetConverter) ToHclLookupByProjectIdAndName

func (c *VariableSetConverter) ToHclLookupByProjectIdAndName(projectId string, parentName string, parentLookup string, dependencies *ResourceDetailsCollection) error

type WorkerPoolConverter

type WorkerPoolConverter struct {
	Client client.OctopusClient
}

func (WorkerPoolConverter) GetResourceType

func (c WorkerPoolConverter) GetResourceType() string

func (WorkerPoolConverter) ToHcl

func (c WorkerPoolConverter) ToHcl(dependencies *ResourceDetailsCollection) error

func (WorkerPoolConverter) ToHclById

func (c WorkerPoolConverter) ToHclById(id string, dependencies *ResourceDetailsCollection) error

func (WorkerPoolConverter) ToHclLookupById

func (c WorkerPoolConverter) ToHclLookupById(id string, dependencies *ResourceDetailsCollection) error

Jump to

Keyboard shortcuts

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