connections

package
v1.0.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeMap = map[string]Typer{
		"array": {
			AttrType:     "schema.SetAttribute",
			TfType:       "Set",
			ReadAttrType: "types.SetType",
			GoType:       "[]",
		},
		"object": {
			AttrType:     "schema.SingleNestedAttribute",
			TfType:       "Object",
			ReadAttrType: "types.ObjectType",
			GoType:       "struct",
		},
		"": {
			AttrType:     "schema.StringAttribute",
			TfType:       "String",
			ReadAttrType: "types.StringType",

			GoType: "string",
		},
		"string": {
			AttrType:     "schema.StringAttribute",
			TfType:       "String",
			ReadAttrType: "types.StringType",
			Default: DefaultValue{
				Value:  "stringdefault.StaticString(\"\")",
				Import: "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault",
			},
			GoType: "string",
		},
		"number": {
			AttrType:     "schema.NumberAttribute",
			TfType:       "Number",
			ReadAttrType: "types.NumberType",
			Default: DefaultValue{
				Value:  "int64default.StaticInt64(0)",
				Import: "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default",
			},
			GoType: "int64",
		},
		"bool": {
			AttrType:     "schema.BoolAttribute",
			TfType:       "Bool",
			ReadAttrType: "types.BoolType",
			GoType:       "bool",
		},
		"boolean": {
			AttrType:     "schema.BoolAttribute",
			TfType:       "Bool",
			ReadAttrType: "types.BoolType",
			GoType:       "bool",
		},
		"int": {
			AttrType:     "schema.Int64Attribute",
			TfType:       "Int64",
			ReadAttrType: "types.NumberType",
			Default: DefaultValue{
				Value:  "int64default.StaticInt64(0)",
				Import: "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default",
			},
			GoType: "int64",
		},
		"int64": {
			AttrType:     "schema.Int64Attribute",
			TfType:       "Int64",
			ReadAttrType: "types.NumberType",
			Default: DefaultValue{
				Value:  "int64default.StaticInt64(0)",
				Import: "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default",
			},
			GoType: "int64",
		},
		"integer": {
			AttrType:     "schema.Int64Attribute",
			TfType:       "Int64",
			ReadAttrType: "types.NumberType",
			Default: DefaultValue{
				Value:  "int64default.StaticInt64(0)",
				Import: "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default",
			},
			GoType: "int64",
		},
	}
)

Functions

func GenerateConnections

func GenerateConnections(ctx context.Context) error

func TerraformResourceName

func TerraformResourceName(connection string) string

func ValidName

func ValidName(s string) string

A name must start with a letter or underscore and may contain only letters, digits, underscores, and dashes. e.g 100_users -> _100_users

Types

type Attribute

type Attribute struct {
	Name                string `yaml:"name"`
	CapName             string `yaml:"-"`
	Sensitive           bool   `yaml:"sensitive"`
	Required            bool   `yaml:"required"`
	Optional            bool   `yaml:"optional"`
	Computed            bool   `yaml:"computed"`
	Type                string `yaml:"type"`
	Description         string `yaml:"description"`
	Example             string `yaml:"example"`
	ExampleTypeOverride string `yaml:"example_type_override"`

	TfType string `yaml:"-"`
	// AttrType is the Terraform schema.* type for the attribute.
	AttrType     string       `yaml:"-"`
	AttrReadType string       `yaml:"-"`
	AttrName     string       `yaml:"-"`
	Default      DefaultValue `yaml:"-"`
	Attributes   []Attribute
	Elem         *Attribute
}

type Connection

type Connection struct {
	// Name is the human readable name for the connection type
	Name string `yaml:"name"`
	// Conn is the connection type name formatted for use in the Terraform
	// resource.
	Conn string `yaml:"-"`
	// Connection is the connection type name formatted for use in the Terraform
	// resource.
	Connection string `yaml:"connection"`
	// ResourceName overrides the name of the resource; if not present the
	// connection type is used.
	ResourceName string
	// Type is the Polytomic connection type.
	Type         string          `yaml:"type"`
	Attributes   []Attribute     `yaml:"attributes"`
	Config       string          `yaml:"config"`
	Datasource   bool            `yaml:"datasource"`
	Resource     bool            `yaml:"resource"`
	ExtraImports map[string]bool `yaml:"-"`
	Imports      string          `yaml:"-"`
}

type Connections

type Connections struct {
	Connections []Connection `yaml:"connections"`
}

type DefaultValue

type DefaultValue struct {
	Value  string
	Import string
}

type Importable

type Importable struct {
	Name         string
	ResourceName string
}

type Typer

type Typer struct {
	AttrType     string
	TfType       string
	ReadAttrType string
	Default      DefaultValue
	GoType       string
}

Jump to

Keyboard shortcuts

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