Documentation ¶
Index ¶
- func BuildersToString(builders ...Builder) string
- type AttributeRefMixinInterface
- type AttributeRefStrictMixinInterface
- type AttributesRefStrictMixinPrerequisitesInterface
- type Builder
- type CanReferenceAttributes
- type ConfigStringer
- type DataSourceBuilder
- type DefaultBlockLabelsMixinPrerequisitesInterface
- type DefaultConfigStringerMixinPrerequisites
- type HasAttributes
- type HasBlockIdentifier
- type HasBlockLabels
- type HasBlockName
- type HasSourceType
- type HasUniqueName
- type ResourceBuilder
- type SourceBlockNameMixinPrerequisitesInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildersToString ¶
Types ¶
type AttributeRefMixinInterface ¶
type AttributeRefMixinInterface interface { // Should return `BlockName()+"."+attributeName` for blocks that can be referenced. // Resources may or may not contain have the `resource.` suffix in the reference. AttributeRef(string) string }
func NewAttributeRefMixin ¶
func NewAttributeRefMixin(blockName HasBlockName) AttributeRefMixinInterface
type AttributeRefStrictMixinInterface ¶
type AttributeRefStrictMixinInterface interface { // Should return `BlockName()+"."+attributeName` for blocks that can be referenced. // Resources may or may not contain have the `resource.` suffix in the reference. // Panics if the block cannot be referenced (ex. output blocks) // Panics if the attribute is not present in Attributes() AttributeRefStrict(string) string }
func NewAttributesRefStrictMixin ¶
func NewAttributesRefStrictMixin(prereqs AttributesRefStrictMixinPrerequisitesInterface) AttributeRefStrictMixinInterface
type AttributesRefStrictMixinPrerequisitesInterface ¶
type AttributesRefStrictMixinPrerequisitesInterface interface { HasAttributes AttributeRefMixinInterface }
type Builder ¶
type Builder interface { HasBlockName HasBlockIdentifier HasBlockLabels HasAttributes ConfigStringer }
TODO: Add support for blocks
type CanReferenceAttributes ¶
type CanReferenceAttributes interface { AttributeRefMixinInterface AttributeRefStrictMixinInterface }
type ConfigStringer ¶
type ConfigStringer interface { // Returns the HCL multiline configuration string for the block ToConfigString() string }
func NewDefaultConfigStringerMixin ¶
func NewDefaultConfigStringerMixin(prereqs defaultConfigStringerMixinPrerequisitesInterface) ConfigStringer
NewDefaultConfigStringerMixin creates a new defaultConfigStringerMixin with the given prerequisites.
type DataSourceBuilder ¶
type DataSourceBuilder interface { Builder HasSourceType HasUniqueName CanReferenceAttributes // DataSourceName is the fully-qualified name of a data source that can be referenced // Should be formatted like `data.hcp_packer_version`, the same as BlockName() DataSourceName() string }
func CloneDataSourceBuilder ¶
func CloneDataSourceBuilder(oldBuilder DataSourceBuilder) DataSourceBuilder
func NewDataSourceBuilder ¶
func NewDataSourceBuilder(sourceType string, uniqueName string) DataSourceBuilder
type DefaultBlockLabelsMixinPrerequisitesInterface ¶
type DefaultBlockLabelsMixinPrerequisitesInterface interface { HasSourceType HasUniqueName }
type DefaultConfigStringerMixinPrerequisites ¶
type DefaultConfigStringerMixinPrerequisites struct { HasBlockIdentifier HasBlockLabels HasAttributes }
DefaultConfigStringerMixinPrerequisites can be used to merge component elements of the default config stringer mixin prerequisites interface into a single object if there is not another way to meet the interface requirements.
type HasAttributes ¶
type HasAttributes interface { // Attributes for the block, keyed by attribute name // The value should be the literal text value of the attribute, // as it would be typed in a terraform configuration file. // May contain terraform expressions and attribute references. // // Examples: // greeting: `"hello"` for `greeting = "hello"` // version_fingerprint: `data.hcp_packer_version.latest.fingerprint` for `version_fingerprint = data.hcp_packer_version.latest.fingerprint` Attributes() map[string]string GetAttribute(string) string SetAttribute(string, string) }
func NewAttributesMixin ¶
func NewAttributesMixin(initialAttributes map[string]string) HasAttributes
type HasBlockIdentifier ¶
type HasBlockIdentifier interface { // Unquoted Block identifier, like `resource`, `data`, or `output` BlockIdentifier() string }
type HasBlockLabels ¶
type HasBlockLabels interface { // Unquoted Block labels // The SourceType should be the first entry if HasSourceType is true. // The UniqueName should be the second entry if HasUniqueName is true. (first if HasSourceType is false) BlockLabels() []string }
func NewDefaultBlockLabelsMixin ¶
func NewDefaultBlockLabelsMixin(prereqs DefaultBlockLabelsMixinPrerequisitesInterface) HasBlockLabels
NewDefaultBlockLabelsMixin creates a new defaultBlockLabelsMixin with the given prerequisites. The default block labels are the SourceType and UniqueName, in that order, omitted if they are set to empty strings.
type HasBlockName ¶
type HasBlockName interface { // The fully-qualified name of a block that can be referenced // // Example: // `hcp_packer_channel.prod` (a resource) or // `data.hcp_packer_version.latest` (a data source) BlockName() string }
func NewSourceBlockNameMixin ¶
func NewSourceBlockNameMixin(blockname SourceBlockNameMixinPrerequisitesInterface) HasBlockName
NewSourceBlockNameMixin creates a new block name mixin for a resource or data source.
type HasSourceType ¶
type HasSourceType interface { // Unquoted source type // // Example: "hcp_packer_version" for `data.hcp_packer_version.prod` SourceType() string }
func NewSourceTypeMixin ¶
func NewSourceTypeMixin(sourceType string) HasSourceType
type HasUniqueName ¶
type HasUniqueName interface { // Unquoted unique name, like for resources/data sources/inputs/outputs // // Example: "prod" for `data.hcp_packer_version.prod` UniqueName() string }
func NewUniqueNameMixin ¶
func NewUniqueNameMixin(uniqueName string) HasUniqueName
type ResourceBuilder ¶
type ResourceBuilder interface { Builder HasSourceType HasUniqueName CanReferenceAttributes // The fully-qualified name of a resource that can be referenced // // Should be formatted like `hcp_packer_channel.prod`, similar to // BlockName(), but without the "resource." prefix ResourceName() string }
func CloneResourceBuilder ¶
func CloneResourceBuilder(oldBuilder ResourceBuilder) ResourceBuilder
func NewResourceBuilder ¶
func NewResourceBuilder(sourceType string, uniqueName string) ResourceBuilder
type SourceBlockNameMixinPrerequisitesInterface ¶
type SourceBlockNameMixinPrerequisitesInterface interface { HasBlockIdentifier HasSourceType HasUniqueName }